Page 1 of 1

Can status times of switches be used in Blocky?

Posted: Monday 03 October 2022 17:14
by HoogendoornJH
The on/off times of switches are being monitored (see picture below). Can these times and status be queried, stored in variables and be used in Blocky? And if so, how?

schakeltijd.jpg
schakeltijd.jpg (125.96 KiB) Viewed 1662 times

Re: Can status times of switches be used in Blocky?

Posted: Monday 03 October 2022 17:34
by boum
No.

Even in classic Lua scripting or dzVents, you'll only have access to lastUpdate. You have to query the database to go deeper.

Re: Can status times of switches be used in Blocky?

Posted: Monday 03 October 2022 18:07
by willemd
I use DZvents and track the switch-on and switch-off times of switches in my boiler for hot water and central heating. In that way I am calcuating the total time hot water and/or central heating was used (with lastUpdate.secondsAgo). Those seconds are then used later to classify the gas usage into gas for hot water and gas for heating.

So, yes it is possible in DzVents. Just check lastUpdate.secondsAgo at the time of switch-off and you get the time since the previous switch-on.

If you want to add all those seconds together during a day or an hour for example, you can store the result of each lastUpdate.secondsAgo in persistent variables ( or you could use a separate device).

I am not sure how to do this in blockly or whether this is even possible.

Re: Can status times of switches be used in Blocky?

Posted: Tuesday 04 October 2022 8:25
by HoogendoornJH
Thanks for your reply. I've been meaning to delve into LUA or dzVents for a long time, but unfortunately it hasn't happened so far.