Code: Select all
t1 = os.time()
s = otherdevices_lastupdate['Ventilator']
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)
commandArray = {}
t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds}
difference = (os.difftime (t1, t2))
if devicechanged['Werkstatt_Humidity'] ~= nil then
print("luftfeuchtigkeit in Werkstatt ist: " .. devicechanged['Werkstatt_Humidity'] .. " %" .. " - Ventilator Temp. ist: " .. otherdevices['Ventilator'] .. " °C")
if (devicechanged['Werkstatt_Humidity'] >= 75) then
if (otherdevices['Ventilator'] == 'Off' and difference > 3600) then
print("Luftfeuchtigkeit in Werkstatt ist über 80%, schalte Ventilator ein. ")
commandArray['Ventilator']='On FOR 10'
end
end
end
return commandArray