Announcement

Collapse
No announcement yet.

In device groups, can the action only apply to the device that triggered?

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

  • In device groups, can the action only apply to the device that triggered?

    New to working with groups but the ones I've done so far work great. Thanks spud

    I have quite a few insteon light switches/dimmers some of which are old and sometimes go into a 'unknown' (-1) status. Any device with that unknown status needs to be set to OFF. I created a group that contains all the devices and in the IF can test to see if any device in the group has a value of -1. However, how would I set just that device to OFF?

  • #2
    Yes, that can be done using the Set All Devices in [Group] to [Expression].


    The expression part is evaluated on a device-by-device basis, so you just need test if the $DEVICEVALUE variable for a device is -1, in which case, set the device to its off value (presumably that would be 0) and if the device is anything else, then set it to that current value $DEVICEVALUE effectively leaving it unchanged. You can do that with the expression
    if($DEVICEVALUE == -1, 0, $DEVICEVALUE)

    Comment


    • #3
      Thanks very much!! Works great.

      Comment


      • #4
        Originally posted by logbuilder View Post
        Thanks very much!! Works great.

        You're welcome. Also works great for things like lighting scenes where you want to set a minimum value if the lights are below that value (say 20%), but if a user has already turned them on to a brighter value, leave them as-is. For that, you do something like:
        if ($DEVICEVALUE < 20, 20, $DEVICEVALUE)

        I have a few interesting user where I combine this group expression function with Easy Trigger's push / pop function to set a group on a temporary basis - e.g., when the doorbell rings, push all the values to the stack, set the group to a minimum value, and then after a few minutes, restore the original set by popping the stack
        Etc.

        Best regards,
        JVM

        Comment


        • #5
          Originally posted by jvm View Post
          Yes, that can be done using the Set All Devices in [Group] to [Expression].


          The expression part is evaluated on a device-by-device basis, so you just need test if the $DEVICEVALUE variable for a device is -1, in which case, set the device to its off value (presumably that would be 0) and if the device is anything else, then set it to that current value $DEVICEVALUE effectively leaving it unchanged. You can do that with the expression
          if($DEVICEVALUE == -1, 0, $DEVICEVALUE)
          On first read this seemed like the perfect solution to a problem I have with sending commands to large groups of z-wave devices--e.g., "all off" to my lights and fans. Frequently 1 or 2 devices don't successfully receive the command. I've worked around the problem using ET's delay set to the minimum 1s between commands, but at the (relatively minor but sometimes inconvenient) price of taking a minute+ to cycle through all the devices. There are times when I'd like immediate response. I'd hoped setting device to expression could be used with the 3rd argument omitted, thereby not issuing a z-wave command when the expression evaluates false. In my example above, perhaps only 15-20 "off" commands would be issued typically and I'd likely have no problems with them going out simultaneously. spud Is this something you might consider implementing?
          -Wade

          Comment


          • #6
            Originally posted by cc4005 View Post

            On first read this seemed like the perfect solution to a problem I have with sending commands to large groups of z-wave devices--e.g., "all off" to my lights and fans. Frequently 1 or 2 devices don't successfully receive the command. I've worked around the problem using ET's delay set to the minimum 1s between commands, but at the (relatively minor but sometimes inconvenient) price of taking a minute+ to cycle through all the devices. There are times when I'd like immediate response. I'd hoped setting device to expression could be used with the 3rd argument omitted, thereby not issuing a z-wave command when the expression evaluates false. In my example above, perhaps only 15-20 "off" commands would be issued typically and I'd likely have no problems with them going out simultaneously. spud Is this something you might consider implementing?
            This lack of error catching / correction is an annoying problem with HomeSeer as a whole -- if a command fails, it would seem that HomeSeer should know that it failed. E.g., if you change a dimmer and it properly processes the command, HomeSeer should get a report of the new value - HomeSeer should check on this for each command sent and then re-send if it doesn't. Given HomeSeer seems to not provide this basic error catch / correct, it would be awesome if it could be provided by the Easy Trigger plugin for at least the Easy Trigger functions - e.g., if you turn off 100 devices, and Easy Trigger gets back reports for only 80 of them, it should re-try the remaining 20. Is something like this even possible? An obvious issue is it may only work for certain classes of devices that provide reports upon changes (e.g., Z-Wave Plus devices, maybe others?).
            .

            Comment


            • #7
              Originally posted by jvm View Post

              This lack of error catching / correction is an annoying problem with HomeSeer as a whole -- if a command fails, it would seem that HomeSeer should know that it failed. E.g., if you change a dimmer and it properly processes the command, HomeSeer should get a report of the new value - HomeSeer should check on this for each command sent and then re-send if it doesn't. Given HomeSeer seems to not provide this basic error catch / correct, it would be awesome if it could be provided by the Easy Trigger plugin for at least the Easy Trigger functions - e.g., if you turn off 100 devices, and Easy Trigger gets back reports for only 80 of them, it should re-try the remaining 20. Is something like this even possible? An obvious issue is it may only work for certain classes of devices that provide reports upon changes (e.g., Z-Wave Plus devices, maybe others?).
              .
              I guess we're straying from the topic, but this brings up a question I've had about z-wave errors that are logged. E.g.,
              Jul-21 4:05:44 PM Z-Wave Error Failed sending Z-Wave command to device: Lighting Utility Room UR Switch
              I get these regularly throughout the day, this one a few minutes ago. Z-wave data collision, radio interference, who knows...but it does seem HS tries again--or else logs the error prematurely--because the light did come on (triggered by motion in this case). It was a few seconds delayed, however. OTOH, sometimes the command is never received (or carried out) by the device when these log entries appear.

              Would be happy to move this to a new thread if there's useful discussion to be had about it.
              Last edited by cc4005; July 21st, 2019, 04:29 PM. Reason: typo
              -Wade

              Comment


              • #8
                It would seem to me that if the device has a plugin supporting it, the responsibility for retry,error handling and reporting should be in the plugin, not HS. In my systems, there are insteon devices, cameras, z-wave and tplink devices. All have plugins.

                Comment


                • #9
                  Originally posted by logbuilder View Post
                  It would seem to me that if the device has a plugin supporting it, the responsibility for retry,error handling and reporting should be in the plugin, not HS. In my systems, there are insteon devices, cameras, z-wave and tplink devices. All have plugins.
                  Can't argue with your point, although I'm not a PI developer so my perspective is limited. Worth noting that the z-wave plugin is HST's not 3rd party.
                  -Wade

                  Comment


                  • #10
                    I have opened this issue of command failure / error catching / correction as a new thread in the Z-Wave plugin forum.

                    See https://forums.homeseer.com/forum/li...ber-of-devices

                    Comment


                    • #11
                      Originally posted by cc4005 View Post
                      I'd hoped setting device to expression could be used with the 3rd argument omitted, thereby not issuing a z-wave command when the expression evaluates false. In my example above, perhaps only 15-20 "off" commands would be issued typically and I'd likely have no problems with them going out simultaneously. spud Is this something you might consider implementing?
                      I'm going to add a special NOOP value so that when the expression is evaluated to NOOP, the action does nothing. For example using a if expression like below in a Set Group to Expression action will do nothing for devices which have value >= 20

                      if ($DEVICEVALUE < 20, 20, NOOP)

                      This is what you want right?

                      Comment


                      • #12
                        Originally posted by spud View Post

                        I'm going to add a special NOOP value so that when the expression is evaluated to NOOP, the action does nothing. For example using a if expression like below in a Set Group to Expression action will do nothing for devices which have value >= 20

                        if ($DEVICEVALUE < 20, 20, NOOP)

                        This is what you want right?
                        Perfect! My first use will be my "all off" at night. Rather than 65 or so commands going out this should cut it to a couple dozen or less.

                        Thanks very much for this!
                        -Wade

                        Comment


                        • #13
                          Originally posted by spud View Post

                          I'm going to add a special NOOP value so that when the expression is evaluated to NOOP, the action does nothing. For example using a if expression like below in a Set Group to Expression action will do nothing for devices which have value >= 20

                          if ($DEVICEVALUE < 20, 20, NOOP)

                          This is what you want right?
                          That would be very helpful. Thanks.
                          I'd also suggest enhancing the text which now says "You can use $DEVICEVALUE and $DEVICEREF as placeholders, as well as replacement varibles" to give more of a hit about this functionality, like "Expression is separately evaluated for each device in the Group. You can use $DEVICEVALUE and $DEVICEREF (which are different for each device) as well as replacement variables to produce different setting values for each device."

                          Comment


                          • #14
                            Originally posted by spud View Post

                            I'm going to add a special NOOP value so that when the expression is evaluated to NOOP, the action does nothing. For example using a if expression like below in a Set Group to Expression action will do nothing for devices which have value >= 20

                            if ($DEVICEVALUE < 20, 20, NOOP)

                            This is what you want right?
                            Perfect! I can already think of several places I want to use this by reworking some cumbersome events.

                            Thanks!

                            -Barry

                            Comment


                            • #15
                              One additional thought, instead of having a "NOOP" as you've proposed, you could, instead, have a check box that says "Send Command Only If Expression Results In a New Value" with a default of being checked.

                              This would then be useful for any type of Group Expression rather than just the "IF" type statement.

                              For example, if I had very simple expression that was just the value of "0", and I checked the "Send Command Only If Expression Results In a New Value" a Set Device command would only be sent to devices that were not already zero.

                              Comment

                              Working...
                              X