sunset does not work
Posted: Saturday 18 April 2020 22:20
Hi all,
Ok I tried my first easy lua script today for switching garden lights at sunset and switch them off a few hours after.
When during testing I used a time it worked perfectly. When I us trigger 'at sunset' it doesn't work. If I use ' at nighttime' is does work.
So for the ease I made a short test script and I really don't know why sunset doesn't work it should I think.
Ok so according to domoticz the sunset was today at 20:42
I checked sunsetInMinutes to check sunset was indeed calculated correctly
Log with minute time sunset
You would expect that you would see the sunset with following as a trigger.. but it ain't
-- Code --
timer = {
'on after sunset every minute',
'on at nighttime every 5 minutes'
-- Log --
2020-04-18 22:33:25.568 (Buienradar) General/Custom Sensor (Rainfall next Hour)
2020-04-18 22:34:25.557 (Buienradar) General/Custom Sensor (Next Rainshower Leadtime)
2020-04-18 22:35:00.487 Status: dzVents: Info: ------ Start external script: test.lua:, trigger: "on at nighttime every 5 minutes"
2020-04-18 22:35:00.487 Status: dzVents: Info: sunset works 1242 sunset
2020-04-18 22:35:00.487 Status: dzVents: Info: ------ Finished test.lua
any help would be appreciated.
Kind regards robbert
Ok I tried my first easy lua script today for switching garden lights at sunset and switch them off a few hours after.
When during testing I used a time it worked perfectly. When I us trigger 'at sunset' it doesn't work. If I use ' at nighttime' is does work.
So for the ease I made a short test script and I really don't know why sunset doesn't work it should I think.
Ok so according to domoticz the sunset was today at 20:42
I checked sunsetInMinutes to check sunset was indeed calculated correctly
Code: Select all
return {
active = true,
on = {
timer = {
-- 'on at nighttime every 2 minutes' -- WORKED
-- 'on at 5 minutes before sunset' -- DIDN't WORK at 20:37
-- 'on at sunset' -- DIDN't WORK at 20:42
-- 'on 18/4 at 21:19' -- WORKED
}
},
execute = function(domoticz)
local sunset = domoticz.time.sunsetInMinutes
domoticz.log('sunset works ' ..sunset.. ' sunset')
end
}
Code: Select all
2020-04-18 22:00:00.095 Status: dzVents: Info: ------ Start external script: test.lua:, trigger: "on at nighttime every 2 minutes"
2020-04-18 22:00:00.095 Status: dzVents: Info: sunset works 1242 sunset
2020-04-18 22:00:00.095 Status: dzVents: Info: ------ Finished test.lua
-- Code --
timer = {
'on after sunset every minute',
'on at nighttime every 5 minutes'
-- Log --
2020-04-18 22:33:25.568 (Buienradar) General/Custom Sensor (Rainfall next Hour)
2020-04-18 22:34:25.557 (Buienradar) General/Custom Sensor (Next Rainshower Leadtime)
2020-04-18 22:35:00.487 Status: dzVents: Info: ------ Start external script: test.lua:, trigger: "on at nighttime every 5 minutes"
2020-04-18 22:35:00.487 Status: dzVents: Info: sunset works 1242 sunset
2020-04-18 22:35:00.487 Status: dzVents: Info: ------ Finished test.lua
any help would be appreciated.
Kind regards robbert