Page 1 of 1
Help needed with script
Posted: Monday 18 June 2018 19:58
by drwurn
What I want to accomplish is:
The light goes on at sunset, light goes out at 00:00
And the light goes on at 06:00 until sunrise. So these days the light stays out because sunrise is at 05:xx
Can't make it work.
Re: Help needed with script
Posted: Monday 18 June 2018 20:40
by niki_lauda

- 1.jpg (114.28 KiB) Viewed 1727 times
Create a dummy switch Zonsopgang/or sunrise that switches a few minutes before sunrise or after if you like.
This is my script
Re: Help needed with script
Posted: Monday 18 June 2018 21:00
by snellejellep
i use the timer section for this:

Re: Help needed with script
Posted: Thursday 21 June 2018 7:50
by drwurn
snellejellep wrote: ↑Monday 18 June 2018 21:00
i use the timer section for this:
It doesn't work with the timer section. The light goes on at 06.00 while sunrise has been.
Re: Help needed with script
Posted: Thursday 21 June 2018 8:08
by snellejellep
drwurn wrote: ↑Thursday 21 June 2018 7:50
It doesn't work with the timer section. The light goes on at 06.00 while sunrise has been.
that is an isssue a am having too, when i notice that sunrise is before 6:00 i turn off the timers that turn the lights on in the morning, you can see that in the screenshot i send.
so if someone does have a script that can do this, or maby, i can figure something out with dzvents.
Re: Help needed with script
Posted: Thursday 21 June 2018 8:44
by mrf68
To me, the blockly in the first post looks valid. “Can’t make it work” is too little info. Which part isn’t working? What does the log say at those specific moments that something should happen? For example: the log should say that the script has run at 00:00. Between 00:00 and 00:15 it should mention that 11 is turned off.
Re: Help needed with script
Posted: Thursday 21 June 2018 13:06
by snellejellep
i just created this dzvents script, i am gonna test that one tonight since it is dependant on the sunrise and sunset
Code: Select all
return {
on = {
timer = { "at 1:00",
"at sunset",
"at sunrise",
"at 6:00"
}
},
execute = function(dz, device)
local garden_lights = dz.groups("Tuinverlichting") --group used to switch multiple garden lights/switches
local morningtime = 360 --time in minutes after midnight sunrise should be for the garden lights to turn on
if dz.time.matchesRule("at sunset") then
garden_lights.switchOn()
elseif dz.time.matchesRule("at 1:00") then
garden_lights.switchOff()
elseif (sunriseinMinutes > "morningtime") and dz.time.matchesRule("at 6:00") then
garden_lights.switchOn()
elseif dz.time.matchesRule("at sunrise") then
garden_lights.switchOff()
end
end
}
Re: Help needed with script
Posted: Thursday 21 June 2018 21:24
by drwurn
Let me know

Re: Help needed with script
Posted: Thursday 21 June 2018 22:06
by snellejellep
drwurn wrote: ↑Thursday 21 June 2018 21:24
Let me know
update: it dit turn on the lights, now lets see if they are off tomorrow morning

Re: Help needed with script
Posted: Friday 22 June 2018 9:47
by drwurn
And and?
Re: Help needed with script
Posted: Friday 22 June 2018 9:55
by snellejellep
it did work! it turned the garden lights off at 1:00
i only could not test the morning because obviously the sun rises way too early now

Re: Help needed with script
Posted: Tuesday 24 December 2019 7:41
by rinyheuvelman
Although the claim of creating the script is over 18 months old, those who take the time and effort to help, deserve the credits for doing so!