Page 1 of 1

[SOLVED] Noob question: how to switch lights after powefailure

Posted: Sunday 16 February 2020 19:02
by Sjonnie2017
Hi All,

I wanted to create a Blockly to switch of all ZiBee lights after a power failure or a brown-out. As it happens all my ZigBee devices turn on after a power failure which is a nuisance when I am not at home.

I created the following Blockly:

Image

EDIT: Changing the "or" to "and" made the blockly work :)

It works (or I think it does) when the sun has not set. Unfortunately the script switches of the lights even if the sun is set :shock:

Any help greatly appreciated :)

Greetz,

Sjonnie

Re: Noob question: how to switch lights after powefailure

Posted: Monday 17 February 2020 11:08
by kuifje
Sjonnie,

If there is a sunrise there will be no sunset at the same time.
When there is a sunrise you need to connect a timestamp or a user variable to this action. This way no action will take place after sunrise.
For example: if sunrise and time is >7:00 and user variable sunrise =0 set user variable =1 and lights off. if then sunset and time = 23:00 and user variable =1 set user variable=0
I hope this gets you in the right direction and correct me if i am wrong with this example.

Kuifje

Re: Noob question: how to switch lights after powefailure

Posted: Monday 17 February 2020 18:52
by Sjonnie2017
Hi,

Thanks for your support. I changed the blockly a bit different than you suggested after reading some other completely unrelated thread. I changed it to:

Time > Sunrise and Time < Sunset and Plafond Haard is on

It is now well after sunset and I turned on the specified light. All other lights stay on now. Will have to wait till tomorrow to test is the blockly works when the sun has risen or set. Let's see what happens :)

EDIT: The thread/post I was referring to: https://www.domoticz.com/forum/viewtopi ... 09#p231492

Re: Noob question: how to switch lights after powefailure

Posted: Tuesday 18 February 2020 10:07
by mrf68
Because of the “or” between sunrise and sunset, this will always be true. When it’s 23:00h, it’s not < sunset, but it is certainly > sunrise. When it’s 03:45h, it’s not > sunrise, but definitely < sunset. So, if I’m correct, this will always switch the scene when Plafond Haard is turned on.

Re: Noob question: how to switch lights after powefailure

Posted: Tuesday 18 February 2020 18:14
by Sjonnie2017
mrf68 wrote: Tuesday 18 February 2020 10:07 Because of the “or” between sunrise and sunset, this will always be true. When it’s 23:00h, it’s not < sunset, but it is certainly > sunrise. When it’s 03:45h, it’s not > sunrise, but definitely < sunset. So, if I’m correct, this will always switch the scene when Plafond Haard is turned on.
You are right :) That's why I changed the "or" to "and". I noticed this change made the lights stay on after sunset (as they were supposed to) and I planned to test today before sunset. Unfortunately I was literally 5 minutes too late :oops: Testing will be tomorrow I suppose...

Re: Noob question: how to switch lights after powefailure

Posted: Thursday 20 February 2020 18:09
by Sjonnie2017
I was on time this time :mrgreen:

Changing the "or" to "and" did the trick. Lights switch off nicely when "Plafond Haard" is on between sunrise and sunset.

Up to the next blockly (basically the same routine but then during nighttime) :)

Greetz,

Sjonnie