This object is in archive! 

Start a rule based on a variable changing

Thijs Schreijer shared this question 10 years ago
Need Answer

Is it possible to trigger a rule upon the value change of a variable? With this I mean the value "changing" (no matter what the value was before, nor what it is now)


A WHEN clause does not accept a dependency on a variable only, then it errors "When clause has no event dependency" when saving the rule.


Usecase; decomposing rules into simpler blocks. eg. create a single variable 'wholeHomeMotion' that is '1' when any motion detector is triggered, and only '0' when all are in 'NO_MOTION' state. Now I have several rules all with a long list of motionsensor comparisons. By using such a variable, I could simply a single rule setting the variable, and all other rules just 'wholeHomeMotion = 1'.

I'd like to use a similar construct for reading the on/off status of the TV, Beamer and laundrymachine based on current power consumption.


Any ideas?

Replies (4)

photo
2

I think you can use a virtual switch for that purpose in stead of a variable

photo
1

That's how I resolved it. But the virtual devices clutter the interface, so I would have preferred a variable, but this works too.

photo
1

I have the same issue, I want to set a variable (named "Day") which triggers to 1 or 0 based on an Astro scheduler. This way I can't avoid to build a scheduler each time I need this information, but I'm not able to detect when Day varaible triggers from 0 to 1 or from 1 to 0... And using a virtual switch in this case is not really a workaround :P

I vote for your question :)

photo
1

If you create a virtual switch you can just hide it so you can't see it in the device overview. You can however have it show up in the rule creator. Works perfectly and does not mess up your interface.

photo
1

That Works perfectly,

and if you use a Virtual Level Control instead a virtual switch, you can use it as a variable with values from 0 to 100.

photo
Leave a Comment
 
Attach a file