Help needed with script
Moderator: leecollings
-
- Posts: 68
- Joined: Sunday 10 June 2018 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Help needed with script
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.
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.
- Attachments
-
- Screenshot_20180615-124857_Chrome.jpg (127.22 KiB) Viewed 1678 times
-
- Posts: 117
- Joined: Saturday 31 August 2013 14:48
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Eindhoven (NL)
- Contact:
Re: Help needed with script
This is my script
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Help needed with script
i use the timer section for this:


raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 68
- Joined: Sunday 10 June 2018 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Help needed with script
It doesn't work with the timer section. The light goes on at 06.00 while sunrise has been.
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Help needed with script
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.
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
Re: Help needed with script
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.
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Help needed with script
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
}
raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 68
- Joined: Sunday 10 June 2018 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Help needed with script
Let me know 

-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Help needed with script
update: it dit turn on the lights, now lets see if they are off tomorrow morning

raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 68
- Joined: Sunday 10 June 2018 16:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Help needed with script
And and?
-
- Posts: 241
- Joined: Tuesday 16 May 2017 13:05
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: The Neterlands
- Contact:
Re: Help needed with script
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
i only could not test the morning because obviously the sun rises way too early now

raspberry pi | xiaomi vacuum | yeelight | philips hue | zwave | ubiquiti unifi | harmony | sonoff | zigbee2mqtt | https://www.youtube.com/channel/UC2Zidl ... m1OLuNldfQ
-
- Posts: 15
- Joined: Wednesday 19 December 2018 14:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.10427
- Contact:
Re: Help needed with script
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!
Who is online
Users browsing this forum: No registered users and 0 guests