-->

Automating the Auto bay

Here’s an example of the code which handles the auto bay motion events.   The Axis IP camera in the bay makes a REST call to execute the “Then” clause when motion is detected, and “Else” when a motion event ends:

This project leverages the generous donations from Axis (Cameras and controller) and from Universal Devices (Automation Controller)

Saw Motion Auto Bay - [ID 0042][Parent 0013]
If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        $Motion_AutoBay += 1
        $Motion_AutoBay.Minutes_since_last  = 0
        Resource 'OccupancyPlotter.AutoBay'
        Run Program 'Thingspeak-Motion' (If)
        Repeat Every  5 minutes 
           $Motion_AutoBay += 5
           Run Program 'Thingspeak-Motion' (If)
           Resource 'OccupancyPlotter.AutoBay'
 
Else
        $Motion_AutoBay.EventCountToday += 1
        Wait  2 minutes 
        $Motion_AutoBay.MinutesToday += $Motion_AutoBay
        $Motion_AutoBay  = 0
        Run Program 'Thingspeak-Motion' (If)
        Resource 'OccupancyPlotter.All'
        Wait  3 minutes 
        $Motion_AutoBay.Minutes_since_last += 5
        Run Program 'Thingspeak-Motion' (If)
        Repeat Every  10 minutes 
           $Motion_AutoBay.Minutes_since_last += 10

This implements several counters, any of which can be published via outbound HTTPS “POST” messages (that is what the “Resource” lines are doing)

The ISY-994 allows us to forward these values to tools such as Thingspeak, IOTPlotter, Ubidots, Slack, GroveStream, etc for future analysis, visualization, etc.