Timers and Counters

Sorry, I couldn't find anything to help me in the forum.
Maybe it's a PLC programmer bias/frame but I feel the need to have timers and countdowns.
I can't find a way to do this.
For example:
Conditions : (It's been 4 hours that there is no movement and no buttons are pressed).
Run: (turn off lights, because I fell asleep on the couch).

If pressing the button is something that will always generate motion (e.g., because they're in the same room), then something like this would work easily in Rule Machine:

Trigger: Motion active OR button X pressed


Wait for events: Motion inactive --> timeout 4:00:00
IF (Motion inactive) THEN
  Off: Lights

If you really want button or motion and don't expect both at the same time, you'll have to use a workaround--for example, a separate rule that sets Private Boolean to False on this rule for four hours when the button gets pressed. Then the IF in this rule can be expanded to check the state of Private Boolean.

I do understand what you're saying: Rule Machine doesn't have "stays" as a sort of built-in feature like, for example, webCoRE does. Just "is" (or "becomes"). But it does have ways to do the same thing, sometimes with the need to combine multiple rules to get what you want (as in my second example above). So perhaps this is a feature request on your part. But the above is a way you can do that kind of thing now. Hope it helps!


My needs of timers and counters make me create this solution...
Let me know your idea about it.

Step 1: Create a Global Variable CNT...

Step 2: Create a Rule that every minute drecrease this varible (-1) to 0 with a very simple condition

You can put here all the variable you need to countdown

Step 3: Set the Variable to the value you need, in all the functions you need .
The countdown will restart from here.

Step 4: Create a Trigger when the Variable is =0 and do what you need

Whit this you can reset your counter whit many rules or triggers

Just a bit triky :slight_smile: but my PLC developer soul feel better now :- :stuck_out_tongue: :stuck_out_tongue:

And in Night mode ... i can fade off all lights after 2h that nothing move and no action are made in my home, because I fell asleep on the couch :slight_smile: :sleeping:

Clearly you do not have cats.

1 Like


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.