Announcement

Collapse
No announcement yet.

Triggering using the "in" operator as an expression

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

  • Triggering using the "in" operator as an expression

    I have a event that I want to trigger using the ET trigger "If Any device in the Group xxx had its value set and [expression] is true function.

    The group xxx is all central scene devices and I want it to trigger on the values 1000 (top button press) or 2000 (bottom button press)

    If I use the expression:
    ($$GLOBALVAR:ETDeviceValue: == 1000) || ($$GLOBALVAR:ETDeviceValue: == 2000)

    Then the event works and triggers.

    However, if I use the following expression with the "in" operator:
    in($$GLOBALVAR:ETDeviceValue:, 1000, 2000)
    The event fails to trigger.

    I understand that the second expression with the "in" operator should give me the same result as the first expression using the equality testing and the or operator. Any idea what I'm doing wrong?


    I'm using the beta ET plugin: 3.0.0.54 if that matters.

  • #2
    $$GLOBALVAR:ETDeviceValue: is only set if the trigger is fired, so this variable actually contains the value of the device that last fired a group trigger.
    You should use $NEWVALUE instead

    I tested a trigger using an expression like "in($NEWVALUE, 1000, 2000)", and it worked for me. Set the log level to Debug, and check the logs, you may have more information on what is going wrong.
    Last edited by spud; November 27th, 2018, 09:17 AM.

    Comment


    • #3
      I'll give it a try tonight. Thank you very much. And can you explain - why $NEWVALUE instead of $$NEWVALUE? I don't quite understand the logic of when to use one $ instead of $$ with variables.

      Comment


      • #4
        $NEWVALUE and $OLDVALUE are variables that I added in the EasyTrigger plugin specifically for device triggers with an expression, they only work in this context. Other replacement variables are more general and handled directly by HS3.
        I probably should have named them $$NEWVALUE and $$OLDVALUE to avoid some confusion

        Comment


        • #5
          Got it. I had assumed the $ was some kind of HomeSeer operator to recall the variable, but from that explanation, understand its really just a part of the name. That's helpful to know.

          Comment

          Working...
          X