Scripts for my smart home setup.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.7 KiB

return {
on = {
devices = {
'Temperatur_Wohnzimmer',
'Temperatur_Balkon'
},
timer = {
'10 minutes after sunset', -- domoticz.data.warm_on reset time
}
},
data = {
warm_on = { initial = 0 }
},
execute = function(domoticz, item)
local temp_room_high = 24
local temp_room_low = 23
local temp_outside_high = 28
local temp_outside_low = 26
if (domoticz.devices('Temperatur_Balkon').temperature >= temp_outside_high and domoticz.devices('Temperatur_Wohnzimmer').temperature >= temp_room_high and domoticz.time.isDayTime and domoticz.data.warm_on == 0) then
domoticz.log('Es ist warm, Rollladen runter.')
domoticz.data.warm_on = 1
if (domoticz.devices('Tür_Balkon').state == 'Locked') then
domoticz.scenes('Rollladen_Nacht').switchOn()
else
domoticz.scenes('Rollladen_Nacht_ohne_Balkon').switchOn()
end
domoticz.devices('Rollladen_Eltern').dimTo(60).afterMin(2) -- Correct the position of the roller blinds in the bedroom.
elseif (domoticz.data.warm_on == 1 and domoticz.time.isDayTime and (domoticz.devices('Temperatur_Balkon').temperature <= temp_outside_low or domoticz.devices('Temperatur_Wohnzimmer').temperature <= temp_room_low)) then
domoticz.log('Es ist nicht so warm, Rollladen hoch.')
domoticz.data.warm_on = 0
domoticz.scenes('Rollladen_Tag').switchOn()
elseif (domoticz.data.warm_on == 1 and domoticz.time.matchesRule('10 minutes after sunset')) then
domoticz.log('Es ist zu warm aber jetzt ist Nacht, warm_on zurücksetzen.')
domoticz.data.warm_on = 0
end
end
}