Page 1 of 1
How responsive / reactive is Blockly?
Posted: Monday 24 June 2019 12:14
by leecollings
I have a general question I'm thinking about, and wonder if someone could confirm what I believe?
Originally, I had a blockly script that turned on various siwtches when it reached Sunset (This was an indoor dusk setting to automatically turn some lights on).
This worked well, but I then further integrated our Nest Home/Away status to only turn lights on if we are at home. So the blockly now looks for Sunset as a time, and 'Away' being off, to then trigger the lights.
My question now is, if when we return home and Nest turns Away off.. will the blockly script then run as both conditions are met (Time is sunset, and Away if off)?
Or should the time condition be changed so it's more like if time is Sunset OR LATER?
Re: How responsive / reactive is Blockly?
Posted: Monday 24 June 2019 12:42
by waaren
leecollings wrote: Monday 24 June 2019 12:14
Or should the time condition be changed so it's more like if time is Sunset OR LATER?
Sunrise and Sunset are both moments in time in domoticz and only true at the minute. So Yes you should change it to Time >= Sunset
But that will introduce a small complication as it will trigger the action every time the Blockly is triggered. If that is a problem for your setup another condition must be added. ( something like: and devicename = Off )
Re: How responsive / reactive is Blockly?
Posted: Monday 24 June 2019 12:46
by leecollings
Hmm yeah I see the issue there.
I could just create a new event that literally does the reverse then and looks for if Time is after sunset, and the away switch is turned Off, to fire the same light sequence.
Or would that still trigger every second (because it would always be true after that?)
Re: How responsive / reactive is Blockly?
Posted: Monday 24 June 2019 13:14
by waaren
leecollings wrote: Monday 24 June 2019 12:46
Or would that still trigger every second (because it would always be true after that?)
It would trigger every minute but if you add that extra condition to check if the lights are already on, it will not send the switch On command

- After Sunset
- After Sunset.png (75.61 KiB) Viewed 1643 times
Re: How responsive / reactive is Blockly?
Posted: Monday 24 June 2019 13:18
by leecollings
Ah I see, sorry I didn't quite get what you meant by adding the extra device condition.
That makes sense no, although I may have to create a dummy switch for that, as I just list each individual light in a 'Set' line.
Re: How responsive / reactive is Blockly?
Posted: Monday 24 June 2019 16:53
by Egregius
You could use a dummy switch that has timers on sunrise/sunset. Depending on your timers call it IsDay or IsNight or something.
Then use that switch in the device script of your Home/Away device to see if it's dark or not.
Or learn lua, dzVents or Pass2PHP and feel the real power of domoticz
