I am new (but enthusiastic) to writing DzVents scripts and wanted to ensure that my first one is correct. My goal is to have the bedroom rolladen (blinds) lower to 40% if the room temperature is above 26degrees celsius and only between 1pm and 7pm. If the temperature ever drops to below 26 degrees then the rolladen should open (only if they are already in a 'closed' state). Here is my script:
Code: Select all
local Time = require('Time')
local t = Time()
return {
active = true,
on = {
devices = {
'SZ Temperature'
}
},
execute = function(domoticz, device, triggerInfo)
if (domoticz.devices["SZ Temperature"].temperature > 26 and (t.matchesRule('at 13:00-19:00'))) then
domoticz.devices['SZ Rolladen'].level(40)
elseif (domoticz.devices["SZ Temperature"].temperature < 26 and domoticz.devices['SZ Rolladen'].state == 'Closed') then
domoticz.devices ['SZ Rolladen'].open()
end
end
}
