Page 1 of 1
is Blockly a one shot operation ?
Posted: Tuesday 23 August 2022 21:24
by Dave21w
What I mean by the title is if I create a block that says If the Lux level of a sensor is equal to or less than 90 then switch light A on and I then turn light A off manually will it turn it back on again or as it has already run once will that be it until the lux goes above 90 and then back below it again.
Thanks
Dave
Re: is Blockly a one shot operation ?
Posted: Tuesday 23 August 2022 23:57
by waltervl
A Blockly script is triggered by a change. The type of change can be set.
See wiki page
https://www.domoticz.com/wiki/Blockly#Triggers
So in your case if the trigger is device the lamp will always be switched on if the lux has a value greater than 90. If you switch the lamp off manually after a device change (could be any device) the script is triggered again and the lamp will be switched on.
But as I have no Blockly scripts running I am not 100% sure...
Re: is Blockly a one shot operation ?
Posted: Wednesday 24 August 2022 9:05
by Dave21w
OK looks like I need to do some research, I want the lounge table lamp to come on when my Lux sensor says its below 90 but obviously I need to turn it off when I go to bed !
Re: is Blockly a one shot operation ?
Posted: Wednesday 24 August 2022 10:07
by madpatrick
maybe this will help a bit

- 2022-08-24 10_04_53-Domoticz - Gebeurtenissen.png (29.49 KiB) Viewed 2407 times
It is now a very simple script and you can please with the parameters.
For example with the LUX/TIME/etc...
Re: is Blockly a one shot operation ?
Posted: Wednesday 24 August 2022 12:07
by Dave21w
Thanks for the suggestion, I have implemented something similar as you can see.

- Lux Switch.jpg (25.01 KiB) Viewed 2400 times
This allows me to turn the lamp off early as long as it's below 30 Lux outside without it then coming back on and stops it coming on early in the winter if it goes very cloudy during the day.
Re: is Blockly a one shot operation ?
Posted: Wednesday 24 August 2022 15:49
by solarboy
madpatrick wrote: ↑Wednesday 24 August 2022 10:07
maybe this will help a bit
2022-08-24 10_04_53-Domoticz - Gebeurtenissen.png
It is now a very simple script and you can please with the parameters.
For example with the LUX/TIME/etc...
Your "else if" has "<=" which is not correct, it can be "=" or "not ="