Rule with shared variables, multiple trippers, incrementation of uninitialized variable - will it w
Hi,
I am trying to set up "Are we at home right now?" rule that I want to work independent of order of events. The idea is that some actions should make the system draw the conclusion that we are at home. If none of these actions have occurred in the last hour, then we are probably away (or asleep).
Ok, I attach an image of the rule. The basic idea is that of simple reference counting and a virtual switch that signals the current state in a more simple way. The rule, however, builds on a couple of assumptions, and I just want to make sure that they are true in Rule creator:
* I have assumed that many instances of a rule may exist at a specific point in time. That is, if you have two triggers for the rule (WHEN) then one may trigger the rule, and the other may trigger the rule again just a second later.
* I have assumed that variables are shared between instances of the rule.
* I have assumed that a variable may be increased even though I never initialized it.
So, which one of these are correct?
Thanks!
Fredrik
Sound like a good ide.
One ide is also to have this "variable" "virtual switch" as a pre defined element in the rule creator that users can use to make it easier. Some temple rules is also a good ide.
I think it should be enough with for predefined elements.
Home, Away, and so on!
Sound like a good ide.
One ide is also to have this "variable" "virtual switch" as a pre defined element in the rule creator that users can use to make it easier. Some temple rules is also a good ide.
I think it should be enough with for predefined elements.
Home, Away, and so on!
I have something similiar, however i do it the other way around. I check if i am not at home. My reason for this is that i either want something to turn on instantly, like a light.. Or i want to turn something off when i'm not at home, for instance turn off the radio when motion hasn't been detected in the last hour.
My implementation is as follows. Create a Virtual Meter with a value called NoMotion (i have no door sensors like you, i only use motion sensors you can name the value anything you want).
The scheduler in the 'WHEN' triggers every minute. I have two motion sensors, one in my living room and one in my dining room.
If they are both on 'NoMotion' i increase my Virtual Meter NoMotion Counter, if one or both are on Motion then i reset the NoMotion Counter to 0.
This allowed me to turn of my radio after 1 hour of nomotion, then NoMotion Counter would then be at 60.
I hope this helps.
I have something similiar, however i do it the other way around. I check if i am not at home. My reason for this is that i either want something to turn on instantly, like a light.. Or i want to turn something off when i'm not at home, for instance turn off the radio when motion hasn't been detected in the last hour.
My implementation is as follows. Create a Virtual Meter with a value called NoMotion (i have no door sensors like you, i only use motion sensors you can name the value anything you want).
The scheduler in the 'WHEN' triggers every minute. I have two motion sensors, one in my living room and one in my dining room.
If they are both on 'NoMotion' i increase my Virtual Meter NoMotion Counter, if one or both are on Motion then i reset the NoMotion Counter to 0.
This allowed me to turn of my radio after 1 hour of nomotion, then NoMotion Counter would then be at 60.
I hope this helps.
Replies have been locked on this page!