Announcement

Collapse
No announcement yet.

Cancel a Delayed Device Action

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Cancel a Delayed Device Action

    This Action will cancel any delayed Actions for a particular Device. When an Action to Control a Device is used, there is an option to Delay the Action. This is covered here.

    As described in the thread linked above, each Delayed Device Action is stored in a special Delayed Actions Event Group



    The Events will refer to the specific Device and be named as such. Here is the result of an Event being run 4 times. The Event action is to turn Device 1 On.

    Click image for larger version

Name:	DelayedActions.PNG
Views:	631
Size:	19.5 KB
ID:	1269923

    If Event below Cancelling Delayed Device Actions for Device1, it will Cancel all Delayed Device Actions for that device, whether there is only 1 or many. In this case, all 4 temporary Events will be deleted.

    Click image for larger version

Name:	CancelDelayedDeviceAction.PNG
Views:	525
Size:	24.1 KB
ID:	1269924

    A use case for this Action can be for motion controlled lighting. Say you have an Event that turns the lights On after there is Motion and you want them to be turned Off after 5 minutes as long as Motion is not triggered again. This simple Event will do it all. If Motion is detected, the Event Runs. The first thing it does is to look for any Delayed Device Actions for the Light that might have been created by prior running of this Event. Then the light is turned on and finally a Delayed Device Action to turn the light Off after 5 minutes is created. If the Event is run again the entire process is repeated. If it is run again before the 5 minute delay has elapsed, the Delayed Device Action is removed and a fresh one for 5 minutes later is created. This can be repeated as lo9ng as there is motion in the room, preventing the lights from being turned Off while someone is in the room.

    Click image for larger version

Name:	CancelDelayedDeviceAction1.PNG
Views:	543
Size:	38.3 KB
ID:	1269925
    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

    #2
    Originally posted by randy View Post

    Click image for larger version

Name:	CancelDelayedDeviceAction1.PNG
Views:	543
Size:	38.3 KB
ID:	1269925
    I'm puzzled that this works reliably.
    I am under the impression that event actions are processed simultaneously, not sequentially.
    Why doesn't the first event action (at least sometimes) undo the last event action in this example?
    Does the action to remove delayed events and device actions have special priority?

    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    Comment


      #3
      Originally posted by Uncle Michael View Post
      I'm puzzled that this works reliably.
      I am under the impression that event actions are processed simultaneously, not sequentially.
      Why doesn't the first event action (at least sometimes) undo the last event action in this example?
      Does the action to remove delayed events and device actions have special priority?
      Because the prior Delayed Device Action is deleted prior to creating the new one. I understand your concern, but it has never been an issue in the nearly 10 years I have been using HS3/HS4. Even though the actions are spun off in threads virtually all at once, and run in parallel, they still end up running close to in order. There is no special priority.

      The remove Delayed Device Action looks in the Delayed Actions group in Events and deletes all applying to that device. This is probably going to take only milliseconds to complete. Creating a Delayed Device Action is done in that same group and also should only take milliseconds to complete. When the remove action is run, the create has not yet completed.

      HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

      Comment

      Working...
      X