Convert Lua to dzvents
Posted: Monday 08 January 2018 20:25
Hi,
I have for some days trying to convert my Lua script to a dzVents script which I use to control my light at home based on time and lux.
Have been trying with all possible combination but I can't figure out how to solve it.
Is there someone who know how to re-write this Lua code into dzvents code?
Thanks!
I have for some days trying to convert my Lua script to a dzVents script which I use to control my light at home based on time and lux.
Have been trying with all possible combination but I can't figure out how to solve it.
Is there someone who know how to re-write this Lua code into dzvents code?
Thanks!
Code: Select all
commandArray = {}
time = os.date('%H:%M')
lowLightValue = tonumber(otherdevices['Luxsensor'])
lowLightSetPoint = 12
offTime = 'Off AFTER 1800'
--============================== Köksfönster ==============================--
if (time == '05:30' and lowLightValue < lowLightSetPoint and uservariables['Weekend'] == 'False') then
commandArray['Köksfönstret']='On'
elseif (time == '07:30' and lowLightValue < lowLightSetPoint and uservariables['Weekend'] == 'True') then
commandArray['Köksfönstret']='On'
elseif (lowLightValue > lowLightSetPoint and uservariables['lowLightKöksfönster'] == '0' and time > '05:30' and time < '22:30') then
commandArray['Köksfönstret']=offTime
commandArray['Variable:lowLightKöksfönster'] = '1'
elseif (lowLightValue < lowLightSetPoint and uservariables['lowLightKöksfönster'] == '1' and time > '05:30' and time < '22:30') then
commandArray['Köksfönstret']='On'
commandArray['Variable:lowLightKöksfönster'] = '0'
elseif (time == '22:30') then
commandArray['Köksfönstret']='Off'
end
return commandArray