Last active
April 12, 2016 23:06
-
-
Save Evshved/c51d8ab14dd68395cc0d9918c83d448d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --[[ | |
| %% autostart | |
| %% properties | |
| %% globals | |
| --]] | |
| while true do | |
| local IdDeviceOfLamp = 1; | |
| local currentDate = os.date("*t"); | |
| local sunriseHour = fibaro:getValue(1, 'sunriseHour'); | |
| local sunsetHour = fibaro:getValue(1, 'sunsetHour'); | |
| local currentSec = tonumber(currentDate.hour) * 60 + tonumber(currentDate.min); | |
| local sunriseSec = tonumber(string.sub(sunriseHour, 1, 2)) * 60 + tonumber(string.sub(sunriseHour, 4)); | |
| local sunsetSec = tonumber(string.sub(sunsetHour, 1, 2)) * 60 + tonumber(string.sub(sunsetHour, 4)); | |
| if (currentSec>sunriseSec and currentSec<sunsetSec) then | |
| fibaro:call(IdDeviceOfLamp, 'turnOn') | |
| else | |
| fibaro:setGlobal(IdDeviceOfLamp, 'turnOff'); | |
| end | |
| fibaro:sleep(60000*10); | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment