How responsive / reactive is Blockly?

Moderator: leecollings

Post Reply
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

How responsive / reactive is Blockly?

Post 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?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: How responsive / reactive is Blockly?

Post 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 )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: How responsive / reactive is Blockly?

Post 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?)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: How responsive / reactive is Blockly?

Post 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
After Sunset.png (75.61 KiB) Viewed 1533 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
leecollings
Posts: 167
Joined: Tuesday 30 June 2015 18:09
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: United Kingdom
Contact:

Re: How responsive / reactive is Blockly?

Post 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.
User avatar
Egregius
Posts: 2592
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: How responsive / reactive is Blockly?

Post 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 ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest