Code: Select all
-- script_time_HeizungSchlafzimmer.lua
function TimeElapsed(s)
year = string.sub(s, 1, 4)
month = string.sub(s, 6, 7)
day = string.sub(s, 9, 10)
hour = string.sub(s, 12, 13)
minutes = string.sub(s, 15, 16)
seconds = string.sub(s, 18, 19)
t1 = os.time()
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = os.difftime (t1, t2)
return difference
end
debug_option = 1
TemperatureUpdateElapsed = TimeElapsed(otherdevices_lastupdate['Schlafzimmer'])
sTemp = tonumber(otherdevices_svalues['Schlafzimmer'])
if debug_option == 2 then print( "script_time_HeizungSchlafzimmer.lua: Starting..." ) end
if debug_option == 2 then print("script_time_HeizungSchlafzimmer.lua: TemperatureUpdateElapsed is " .. TemperatureUpdateElapsed) end
if debug_option == 2 then print("otherdevices_svalues['Schlafzimmer'] = " .. sTemp .. " degrees.") end
if debug_option == 2 then print("otherdevices['Heizkreis Schlafzimmer'] = " .. otherdevices['Heizkreis Salon']) end
commandArray = {}
if (TemperatureUpdateElapsed > 600 and TemperatureUpdateElapsed < 700) then
-- this will allow the room thermostat (set at 22 degrees) to control the max temperature.
commandArray['SendNotification'] ='Schlafzimmer Temp sensor has not sent an update in 10 minutes. Disabling Domoticz temperature control.'
commandArray['Heizkreis Schlafzimmer'] ='On'
end
if otherdevices_svalues['Thermostat Schlafzimmer'] == "Off" and otherdevices['Heizkreis Schlafzimmer'] == 'On' then
if debug_option == 1 then print("Thermostat Schlafzimmer off. Turning central heating OFF." ) end
commandArray['Heizkreis Schlafzimmer'] = 'Off'
else
setpoint = tonumber(math.floor( otherdevices_svalues['Thermostat Schlafzimmer'] ) + 13 )
if debug_option == 2 then print("otherdevices_svalues['Thermostat Schlafzimmer'] = " .. setpoint .. " degrees.") end
if sTemp < setpoint then
if otherdevices['Heizkreis Schlafzimmer'] == 'Off' then
if debug_option == 1 then print("Temperature Schlafzimmer below thermostat set point. Calling for heat." ) end
commandArray['Heizkreis Schlafzimmer'] = 'On'
end
else
if otherdevices['Heizkreis Schlafzimmer'] == 'On' then
if debug_option == 1 then print("Schlafzimmer Thermostat set point reached. Call for heat stopped." ) end
commandArray['Heizkreis Schlafzimmer'] = 'Off'
end
end
end
return commandArray
So I would like to have a dimmer cell where dimmer value is exchanged by setpoint.
I don't need this anymore because use Setpoint instead.