In Domoticz i have my location so have a sunset and sunrise time in dashboard.
have this dzEvent script but it does not work its also running in daytime.
Can someone assist me?
Code: Select all
return {
active = true,
on = {
timer = {'at nighttime'},
devices = {'Keuken Sensor'}
},
execute = function(domoticz, device)
-- ALWAYS NIGHTTIME ONLY --
-- KITCHEN LIGHT OFF WHEN GONNA SLEEP
if
domoticz.devices('Full Handmatige Modus').state == 'Off' and
domoticz.devices('Scene Goodnight').state == 'On' and
domoticz.devices('Keuken Sensor').state == 'Off' and
domoticz.devices('Kookplaat').state == 'On'
then
domoticz.devices('Kookplaat').switchOff().afterSec(3)
domoticz.log('--==<[GOODNIGHT AAN KEUKEN LICHT UIT]>==--', domoticz.LOG_FORCE)
-- ALWAYS NIGHTTIME ONLY --
-- KITCHEN LIGHT ON WHEN KODI IS OFF
elseif
domoticz.devices('Keuken Sensor').state == 'On' and
domoticz.devices('Kodi').state == 'Off' and
domoticz.devices('Kookplaat').state == 'Off'
then
domoticz.devices('Kookplaat').switchOn().afterSec(1)
domoticz.log('--==<[KEUKEN SENSOR AAN KEUKEN LICHT AAN]>==--', domoticz.LOG_FORCE)
-- ALWAYS NIGHTTIME ONLY --
-- KITCHEN LIGHT OFF WHEN KODI IS OFF
elseif
domoticz.devices('Keuken Sensor').state == 'Off' and
domoticz.devices('Kookplaat').state == 'On' and
domoticz.devices('Kodi').state == 'Off'
then
domoticz.devices('Kookplaat').switchOff().afterSec(1)
domoticz.log('--==<[KEUKEN SENSOR UIT KEUKEN LICHT UIT]>==--', domoticz.LOG_FORCE)
end
end
}