This object is in archive! 
Best way to create rule for Office Light
Need Answer
Hi guys,
I have installed a DoorSensor and a Fibaro Motion Detector in the office.
I wish to turn the lights on (switch on) whenever the door sensor is activated, and the to switch the lights off 20 minutes after the last detected movement or door activity.
I also want the system to send me a push message light is turned on (from off position), and when the light is turned off.
What's the best way to achieve this using the rules creator?
Best regards,
Robert
No connection
Real-time notifications may not work
Hey robert, I think the easiest way is to create a variable that is changed according to movement or door opening/closing. I used something like this to determine if their is anyone home and to activate the alarm after 30 minutes if not. This way you can add more sensors later if needed.
For the light, you will need to use a single relay with an 2nd input, such as Zipato single module. This input is what you need to connect to the switch and use the rules to trigger on this. Otherwise the rule will always activate when the light turns on, whether by the switch manually, or virtually via the app or a rule, because everything will come through as via the main input on the module.
Hey robert, I think the easiest way is to create a variable that is changed according to movement or door opening/closing. I used something like this to determine if their is anyone home and to activate the alarm after 30 minutes if not. This way you can add more sensors later if needed.
For the light, you will need to use a single relay with an 2nd input, such as Zipato single module. This input is what you need to connect to the switch and use the rules to trigger on this. Otherwise the rule will always activate when the light turns on, whether by the switch manually, or virtually via the app or a rule, because everything will come through as via the main input on the module.
Adrian,
I thought about adding rules just like you mention, i.e. testing for changes to a variable which is being set when devices trigger. I do, however, get error message "When Clause has no Event Dependency" when trying to save "When variable IsMovement = 1"...
Is this a "warning" rather than an error, and the code will actually run and trigger whenever there is a change to the variable?
Best regards,
Robert
Adrian,
I thought about adding rules just like you mention, i.e. testing for changes to a variable which is being set when devices trigger. I do, however, get error message "When Clause has no Event Dependency" when trying to save "When variable IsMovement = 1"...
Is this a "warning" rather than an error, and the code will actually run and trigger whenever there is a change to the variable?
Best regards,
Robert
Adrian,
Enclosed is a screen dump showing the rules I'm trying to create. As you can see, the WHEN-rules which test on a variable are rejected by the compiler.
Brgds,
Robert
Adrian,
Enclosed is a screen dump showing the rules I'm trying to create. As you can see, the WHEN-rules which test on a variable are rejected by the compiler.
Brgds,
Robert
Hi Robert, None of your rules have an event dependency on movement=1, they are all >0.
I can see rule 7 will not work because you are trying to set a variable to -1, try just the number 1. I had this issue, just pick a number.
And another rule 6 is triggered by the variable of less than 0. Variables can not be negative.
What is the debugmode variable?
With everything you have here, the movement variable will never be greater than 0, so no rules will run.
Hi Robert, None of your rules have an event dependency on movement=1, they are all >0.
I can see rule 7 will not work because you are trying to set a variable to -1, try just the number 1. I had this issue, just pick a number.
And another rule 6 is triggered by the variable of less than 0. Variables can not be negative.
What is the debugmode variable?
With everything you have here, the movement variable will never be greater than 0, so no rules will run.
Adrian
(The DebugMode variable is a setting so I can enable/disable spam messages when developing; I've removed them from the enclosed pic for clearity).
I have cleaned up the example which will not compile and also enclosed the error message.
How did you manage to compile/save/load WHEN blocks which test on a boolean variable ?
Brgds
Robert
Adrian
(The DebugMode variable is a setting so I can enable/disable spam messages when developing; I've removed them from the enclosed pic for clearity).
I have cleaned up the example which will not compile and also enclosed the error message.
How did you manage to compile/save/load WHEN blocks which test on a boolean variable ?
Brgds
Robert
Adrian,
If I have understood things correctly, the virtual devices rely on web services or similar running at Zipato's hosting partner, where an HTTP request is sent from the Zipabox whenever somethings change, and where the web service update the virtual meter.
If this is correct, anything relying on a virtual meter/device will have a slight delay in execution, and will fail completely if the Zipabox is offline...?
Adrian,
If I have understood things correctly, the virtual devices rely on web services or similar running at Zipato's hosting partner, where an HTTP request is sent from the Zipabox whenever somethings change, and where the web service update the virtual meter.
If this is correct, anything relying on a virtual meter/device will have a slight delay in execution, and will fail completely if the Zipabox is offline...?
Replies have been locked on this page!