Page 1 of 1

Turn light when is open door in night

Posted: Tuesday 01 January 2019 23:46
by Morfeus
Hello everyone,

This is my first topic on this page, I hope don't make big confusion.

I try made blockly for my garage gate if will be open and if only will be dark on outside then will be turn on lights on outside home.
I haven't lux sensor on outside and I try made from time sunrise and sunset but don't work.
I was looking everywhere information about this topic but found nothing.
Below you can find screen with my blockly, who knows what I made wrong?

I will be grateful for your helps!

Re: Turn light when is open door in night

Posted: Wednesday 02 January 2019 10:16
by Cybertom
that will not work because time is not compared with the same day. Make a dummy switch (isdark) and let it switch with a new blocky:
if time = sunset then switch dummyswitch (isdark) = "on"
if time = sunrise then switch dummyswitch (isdark) = "off"

and then compare this dummy switch with your blocky.
if (door sensor) = "open" and (isdark) = "on" then ......
or you can do it with a variable instead of a dummy switch

Re: Turn light when is open door in night

Posted: Wednesday 02 January 2019 11:09
by tozzke
This'll work perfectly as long as you use the correct time conditions....
In your blockly you're saying it to only trigger when later than sunrise and earlier than sunset (so when the sun is up), change that to '[time < sunrise] or [time > sunset]' ('or' because with time based events there isn't a single moment on a day that it's later than sunset AND earlier than sunrise (just as Cybertom mentioned))

Re: Turn light when is open door in night

Posted: Sunday 06 January 2019 22:52
by Morfeus
Now is working perfect, tozzke thank you very much for help.
Cybertom, I was thinking about this way, but I wanted use sunrise and sunset + blockly.

Thank you very much for help and quick answers! ;) :)