Page 1 of 1

Sunrise-sunset blocky not working

Posted: Monday 04 September 2017 19:55
by niclasc
I have 2 blocky scripts for setting a dummy switch on or off depending on if sun is up or down.

But it never switches on or off

Can anyone tell me why its not working?


Screenshot from 2017-09-04 19-50-59.png
Screenshot from 2017-09-04 19-50-59.png (23 KiB) Viewed 5249 times
Screenshot from 2017-09-04 19-50-34.png
Screenshot from 2017-09-04 19-50-34.png (24.28 KiB) Viewed 5249 times

Sunrise-sunset blocky not working

Posted: Monday 04 September 2017 21:53
by Andree
Becouse you have to set "OR" instead of "AND".
Time > Sunset OR time < Sunrise

Re: Sunrise-sunset blocky not working

Posted: Saturday 25 August 2018 9:55
by bldewit
I think these scripts are cancelling each other. All items in the IF-section are triggers, so if the first script turns it on, the second script is triggerred and switches it off...

Maybe switching the blockly category from ALL to TIME will solve it, but I have found LUA to be much more accurate in controlling which switches are used for triggering and which for reference. Also you have the benefit of nested IF's in LUA, which also gives more control.

Looking at the date of this post I sincerely hope you have already solved this problem though 😁

Re: Sunrise-sunset blocky not working

Posted: Saturday 25 August 2018 11:02
by Prutsium
Had a similar issue check here: http://www.domoticz.com/forum/viewtopic ... 42#p188942

In my case it was If/Or issue.

Re: Sunrise-sunset blocky not working

Posted: Wednesday 20 March 2019 21:41
by bldewit
Ok, maybe a tad late, but whatever.
Your first script will never become TRUE. It is fysically impossible to be earlier than sunrise AND later than sunset (on the same day). So, after the second script has turned your switch off, the first will never turn it on....

So, combining it to one blockly with 2 else-blocks might work:

If (before sunrise)
On
Elseif (between sunrise and sunset)
Off
Elseif (after sunset)
On