Seconds between midnight and sunset
Posted: Monday 04 December 2017 22:33
I need to send a command to an espeasy device. It consist of the starttime and the duration. That way the espeasy can handle the "off" command by itself. This feels more secure then sending the "off" command separate. If that command is missed, the pump will keep on running in my pool
So i need the seconds between sunset and midnight
I tried the code below. I got stuck with the Time property. I do not know where to go or which function to use.
SunsetToMidnight is a uservariable
So i need the seconds between sunset and midnight
I tried the code below. I got stuck with the Time property. I do not know where to go or which function to use.
SunsetToMidnight is a uservariable
Code: Select all
return {
active = true,
on = {
timer = {'60 minutes before sunset'}
},
execute = function(domoticz,dummy)
local Time = require('Time')
local tA = Time('00:00:00')
local tB = Time('sunset')
print(tB.compare(tA).secs)
domoticz.variables('SunsetToMidnight').set(2378)
end
}