Sunset in function
Posted: Friday 29 May 2020 8:33
Hi all,
Just to check if there is an easier way.
I have triggers (devices) and based on their state there are several different actions.
One of them is if switch triggered and Lux < maxlux then postpone switching the lights till XX minutesAfterSunset.
As far as I know the sunset time is in a function only available in minutes after midnight not as a real time.. is that correct?
As a work around I now do:
Which is working fine btw just wondering if it could be done smarter
Happy to learn.
Kind regards
Just to check if there is an easier way.
I have triggers (devices) and based on their state there are several different actions.
One of them is if switch triggered and Lux < maxlux then postpone switching the lights till XX minutesAfterSunset.
As far as I know the sunset time is in a function only available in minutes after midnight not as a real time.. is that correct?
As a work around I now do:
Code: Select all
local hoursstring = dz.utils.stringSplit((dz.time.sunsetInMinutes+minutesAfterSunset)/60,".")
local hours = hoursstring[1]
local minutestring = dz.utils.stringSplit (hoursstring[2] / 100 * 60,".")
local minutes = minutestring[1]
local sunset = (hours..':'..minutes)
Happy to learn.
Kind regards