Rule machine question


#1

I'm using Hubduino to monitor sound levels, and if the kids are too loud, it turns the TV off for 15 mins. I just put this rule in. Polling is every 3 seconds.

Since the trigger is changed and the polling is every 3 seconds, does my ELSE statement queue up a ton of "On" actions on the backend? Or is it smart enough to see that it's a duplicate and ignore it? If not, what do I need to do to fix this?

Screenshot%20from%202019-07-09%2000-36-51


Feature request: Condition that compares variable to now()
#2

(Sorry, off topic!) That's mean! :smiley: Do you turn the rule off when you watch football?


#3

I have restrictions set up so it only works during hours that I'm working (M-F, 7am to 6pm)


#4

I think it's going to queue it up. One thing you could do is have a global variable like turn_on_delay_is_active, set it to true when you queue up the delayed On action, and avoid queuing up additional delayed On actions if the variable is already set to true.

Also, you'll need to set the variable back to false appropriately - perhaps right after the Cancel Delayed Actions line.

What would be ideal is there was some way to find out if a delayed action has already been queued up.

Hope this helps.


#5

If you use the "contact sensor" feature of the HubDuino driver that I wrote for you, instead of an analog signal that is always changing, then there will only be two states, "open" and "closed" and thus the value will rarely change.


#6

FYI - you can also just use the Private Boolean feature of every rule instead of a global variable for flow control like this. :wink: