Virtual Thermostat
Posted: Tuesday 02 April 2019 19:21
Trying to make this work. When I have otherdevices['Varmeovn WC 1.etg'] == 'On' / 'Off'. Script won't execute.
When I remove otherdevices['Varmeovn WC 1.etg'] == 'xx' Script works but updates every time temp or setpoint changes (of cours)
Why won't script work when otherdevices['Varmeovn WC 1.etg'] == 'On' / 'Off'' is present? I tried change it with a variable. Same thing
Code: Select all
Setpoint = tonumber(otherdevices_svalues ['WC 1.etg'])
Temp = tonumber(otherdevices_svalues ['WC 1 etg'])
Hysteresis = 0.5
commandArray = {}
if (devicechanged['WC 1.etg'] or devicechanged['WC 1 etg']) then
if (Temp + Hysteresis < Setpoint) and otherdevices['Varmeovn WC 1.etg'] == 'On' then
commandArray['Varmeovn WC 1.etg'] = 'Off'
print ("Varmeovn inaktiv")
elseif
(Temp - Hysteresis > Setpoint) and otherdevices['Varmeovn WC 1.etg'] == 'Off' then
commandArray['Varmeovn WC 1.etg'] = 'On'
print ("Varmeovn aktiv")
end
end
return commandArray
Code: Select all
Setpoint = tonumber(otherdevices_svalues ['WC 1.etg'])
Temp = tonumber(otherdevices_svalues ['WC 1 etg'])
Hysteresis = 0.5
commandArray = {}
if (devicechanged['WC 1.etg'] or devicechanged['WC 1 etg']) then
if (Temp + Hysteresis < Setpoint) then
commandArray['Varmeovn WC 1.etg'] = 'Off'
print ("Varmeovn inaktiv")
elseif
(Temp - Hysteresis > Setpoint) then
commandArray['Varmeovn WC 1.etg'] = 'On'
print ("Varmeovn aktiv")
end
end
return commandArray