Page 1 of 1
time variable?
Posted: Sunday 28 May 2017 8:37
by micksel
Hi everyone,
I would like to create something like this,
If power < 1w and nobodyhome=true and this has been like this for 5 min then
set switch of 300 min
Is this possible in blocky?
Re: time variable?
Posted: Sunday 28 May 2017 9:04
by Egregius
I suggest you look at the possible script languages like lua, php, shell, python,... Then everything is possible.
Re: time variable?
Posted: Sunday 28 May 2017 11:11
by mrf68
Hi micksel,
as far as I know there's no Blockly component like "otherdevices_lastupdate" in LUA. But you can create your own timer. I'll show you an example:
I created a user variable with the name "teller" and the variable type = "Integer". I used an existing switch "OnOff 2" and created the following Blockly:

- blocklytimer.jpg (136.1 KiB) Viewed 1011 times
When the switch is Off, the "teller" will increase every minute untill it reaches "5". When the switch is On, it will set the "teller" to "0". There is one catch: status will only change on the full minute. So when the switch turns On at 13:42:02 and it turns Off at 13:42:56, the script will not set the "teller" to "0". And at exactly midnight (= 00:00) it will not do anything.
Maybe this info helps a little.