Page 1 of 1

Why does one script not work while they are almost exactly the same??

Posted: Saturday 30 May 2020 10:16
by rick8245
Hi ,

I have 2 scripts of two lamps.

The first one is called: Tuinlamp_voor and this is working fine (Tuinlamp_voor_OK.png)

The second one is called: Buitenlamp_voor and this one does not work at all. (Buitenlamp_voor_NOK.png)


Both scripts are exactly the same .
There is only 1 difference.
In the first script the end time is 23:59
and in the second script the endtime is 05:00

I can not figure out why the first one runs very good and why the second one does not even start and so does nothing at all

Can somebody help me with this ??

Thanks in advance,


Rick

Re: Why does one script not work while they are almost exactly the same??

Posted: Saturday 30 May 2020 10:45
by BoelShit
If you look at the "Buitenlamp_voor" the sunset time is always after the 5:00 time as well. So it will turn on your light and immediately turn off due to the Else if. Your assumption is that the 5:00 is for the next day but it's also applicable for the same day ;)

Re: Why does one script not work while they are almost exactly the same??

Posted: Saturday 30 May 2020 10:47
by jkimmel
Try
blocklya.JPG
blocklya.JPG (17.63 KiB) Viewed 931 times
because time after sunset is > 05:00

I was a bit late ;)

Re: Why does one script not work while they are almost exactly the same??

Posted: Saturday 30 May 2020 11:07
by rick8245
Thanks guys,

I will try this.
And keep you updated

Re: Why does one script not work while they are almost exactly the same??

Posted: Saturday 30 May 2020 12:16
by MikeF
I think you mean:
Image
(or rather than and)

Re: Why does one script not work while they are almost exactly the same??

Posted: Saturday 30 May 2020 12:23
by waaren
I guess you need both..

blockly.png
blockly.png (40.4 KiB) Viewed 915 times

Re: Why does one script not work while they are almost exactly the same??

Posted: Saturday 30 May 2020 22:05
by rick8245
Guys,

thanks for the scripts.
I tried them both and the script of Waaren works exactly like I want.

Thanks also to Jkimmel and MikeF.

Regards,

Rick