No announcement yet.

Set Value of Device from Group Trigger

  • Filter
  • Time
  • Show
Clear All
new posts

    Set Value of Device from Group Trigger

    OK, I'm probably missing something but... I'm trying to set the value of the device from a Group trigger.

    Here's what I'm working on.. I have defined a group of lights that I want to turn off if any have been left on over an hour. Easy enough to check with "Any device in group as not changed in..."; however, how do I turn off just that device? What am I missing??


    Please clarify what you're trying to do. At first you said you want to turn off a group of lights ("group of lights that I want to turn off"), then you said you want to turn off just the one device.

    Turning off the whole group is easy with "Set Group of Devices to Expression" action. Turning off just the one will be a little trickier but can most likely be done. I'll wait to hear what exactly you're trying to do...


      Sorry for the confusion... I want to turn off the single device from the trigger.

      I have a Easy Trigger group of lights should never be on an extended period of time unless they were left on by accident (damn kids!!) If any of these lights has been on for over one hour, turn it off.


        Your use case seems like it would be a common one, and I'm surprised I haven't come across it before. Unfortunately, I don't see a straightforward way to handle it with just the built-in functions in EasyTrigger. The problem is that the built-in EasyTrigger actions don't provide a way to act upon just the device that triggered the event. You can only act upon all the group devices, or a pre-determined specific device.

        However, EasyTrigger does provide the triggering device info by way of HS global variables. So you could probably use the EasyTrigger global variables in an immediate script statement. It's a bit convoluted since we have to use CAPI controls, but something like this should get you going (fair warning, I did not test this):

        If Any device in group has been in range [1,255] for exactly 1 hour
        Then Execute the command: &hs.CAPIControlHandler(hs.CAPIGetSingleControl(hs.GetVar( ā€œetdeviceref"),False,"Off",True,False))

        One potential issue I can see with this is if two or more lights in the group happen to trigger the event at the same time, then you might get unpredictable behavior since the global variables will change rapidly.




            I considered the "Set All Devices in Group to Expression" action, and while it is a powerful tool that I use quite a bit, I don't see how it can be used in the OP use case to act upon only the device that triggered the event, i.e. only the light that has been on for more than an hour.

            The linked thread demonstrates how to evaluate if each device has a certain value, and only perform the action if it is that value. But for OP use case, we need to evaluate the time each light has been on, which I don't believe is possible in the EasyTrigger "Set Device to Expression" operators.


              I did see this thread before posting, but as teladog01 points out, I don't have a value to evaluate on, as other lights could be on that have not yet reached their time limit. The script statement actually worked very well but, as noted, it does have a problem with devices triggering at the same time -- it only acts on one of them. For now, however, it's a vast improvement so I'm using it until I come up with something else.

              I'm hoping spud might chime in, as it seems like having an Action that lets you set the value of the trigger device would be such a common need.