Announcement

Collapse
No announcement yet.

If any device in group has value set and is less/more than - using variables?

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

  • If any device in group has value set and is less/more than - using variables?

    I am using a number of thermostats to control our central heating, which are contained in a device group, and would like to remove constants from the event logic. Is it possible to use a variable (either global variable, or another device value) with the "If any device in a group has its value set and is less/more than..." trigger and "If any/all device in a group has a value that is less/more than..." condition?

    Thanks in advance.

  • #2
    adwuk - Yes. What you want to do is use the "Any device's value in this group had its value set and expression is true" function.
    The device that was just "set" will be identified in the Easy Trigger global variable "etDeviceRef" for its reference #, and "etDeviceValue" for its value. You can use these global variables, or you can use $NEWVALUE and $OLDVALUE in the expression which is where you conduct the less than or greater than test.

    Here's an example where I monitor a group of dimmers to see if any are set between 1-9% and, if so, take an action by running a CAPI control script to set the value to 10%. Note that in the script that follows I use a CAPI control command to act on the device "etdeviceref" which is the device that triggered the event. If you are acting on a physical device, you have to use a CAPI control. But you can act on a virtual device using the easier-to-understand script command &hs.SetDeviceByValueRef. For some more detail on using SetDeviceByValueRef with Easy Trigger, see Post #6, here: https://forums.homeseer.com/forum/ho...90#post1262490, or post #8 here: https://forums.homeseer.com/forum/ul...78#post1259878






    Click image for larger version  Name:	Capture.PNG Views:	1 Size:	141.4 KB ID:	1275263

    Comment


    • #3
      Thanks - that is a really useful example, and I see that I can use method above as the trigger for the second "OR IF" of this event. I have included the whole event definition below as the additional "AND IF" condition in the first "IF" I think can only be achieved with a script, unless you have a better way?

      Click image for larger version

Name:	event.png
Views:	19
Size:	52.8 KB
ID:	1275267

      Comment


      • #4
        Unfortunately you cannot use an expression in a group Condition.
        Randy Prade
        Aurora, CO
        Prades.net

        PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

        Comment


        • #5
          Originally posted by adwuk View Post
          Thanks - that is a really useful example, and I see that I can use method above as the trigger for the second "OR IF" of this event. I have included the whole event definition below as the additional "AND IF" condition in the first "IF" I think can only be achieved with a script, unless you have a better way?
          As a potentially "better" (simpler) way for that example, I might have gone with a simple recurring trigger as long as you can bear a minor lag between the detection of the less than 21 and the turning on of the boiler.

          IF (recurring trigger every 1 minutes)
          And IF you are in the heating time period
          And IF any device in the group is less than 21
          Then turn on the boiler


          The CPU overhead for the recurring trigger is negligible and this would only require the one trigger / condition group and you wouldn't have to worry about whether you were entering the heating period or were already in it. I'd also select the "Option" for this event and select "Cannot re-run for 15 minutes" to avoid too much cycling on/off of the boiler if the temperature sensor is at the threshold and could be bouncing above / below the threshold.

          Comment


          • #6
            Thanks for the suggestion. The example still suffers the same limitation of not being able to use an expression with a group condition. I think I will have a look at the code route. I am hoping to have one thermostat which my Mrs can adjust. Having explicit values hard coded won't help with that endeavour - so close with this route but failed at the last fence!

            Comment


            • #7
              Ask Spud to add support foe expressions for group Conditions in the feature request thread. He will probably add it to his todo list.
              Randy Prade
              Aurora, CO
              Prades.net

              PHLocation - Pushover - EasyTrigger - UltraECM3 - Ultra1Wire3 - Arduino

              Comment


              • #8
                Thanks, I have done.

                Comment


                • #9
                  Originally posted by adwuk View Post
                  Thanks for the suggestion. The example still suffers the same limitation of not being able to use an expression with a group condition. I think I will have a look at the code route. I am hoping to have one thermostat which my Mrs can adjust. Having explicit values hard coded won't help with that endeavour - so close with this route but failed at the last fence!
                  Maybe I don't understand what you are trying to do.

                  Is the issue that you don't want to hard code the comparison value -- in your example, the '21'?

                  If that's the goal, you may be able to do this using virtual devices and the replacement variable $$DVR:ref#:

                  To do this, create a virtual device that you use for the comparison value. Let's call it "Temperature Threshold" and have that be settable to a numeric value using a slider, drop-down, or however you want. Let's assume that virtual device has the HomeSeer reference ID value of 678. From HomeSeer, you can then set it to the value you want for the comparison (21 in your example).

                  Then, set your group's Easy Trigger as ...

                  IF any device in group ABCD had its value changed and expression is True

                  and in the expression put something like : $NEWVALUE < $$DVR:678:

                  This should then compare the changed device's value to your virtual device with the HomeSeer reference 678. I haven't tested this, but I believe it should work.

                  Comment


                  • #10
                    Originally posted by jvm View Post
                    Then, set your group's Easy Trigger as ...
                    IF any device in group ABCD had its value changed and expression is True
                    and in the expression put something like : $NEWVALUE < $$DVR:678:
                    This should then compare the changed device's value to your virtual device with the HomeSeer reference 678. I haven't tested this, but I believe it should work.
                    That works fine for the trigger, but it doesn't work for a condition, so your example of a recurring trigger with condition won't work, nor will the one that I posted above. I have added it to the wish list, and I am hoping that it will be easy to do given that most of it must already be there.

                    Comment

                    Working...
                    X