Updating Setpoint device and script - logic is failing me
Posted: Friday 03 March 2017 13:13
I have a added a Setpoint device (tadosetpoint) and can use this to override my heating if the needs arises. If I change its value (e.g. current heating program is 18deg to 21deg), it runs a script (using LUA devicechanged[tadosetpoint]). Reason I'm calling a PHP script is that I already have coded functions for the Tado and don't have the LUA knowledge to simply change them. Guess I could if needed, but the logic in the problem would still remain.
The LUA/PHP part is works fine by itself. However, I also want to be able to get the setpoint value on a regular basis from the thermostat (separate script that pulls information from Tado every minute and updates devices if they've changed, but if I update the device it'll trigger running of the script again and likely end up in a never ending loop. Any suggestions?
Code as it stands:
The LUA/PHP part is works fine by itself. However, I also want to be able to get the setpoint value on a regular basis from the thermostat (separate script that pulls information from Tado every minute and updates devices if they've changed, but if I update the device it'll trigger running of the script again and likely end up in a never ending loop. Any suggestions?
Code as it stands:
Code: Select all
local tadosetpoint = 'Tado Setpoint'
commandArray = {}
if devicechanged[tadosetpoint] then
tadosetpoint_temp = tonumber(otherdevices_svalues[tadosetpoint])
if tadosetpoint_temp > 25 then
print('Tado Setpoint too HIGH - Out of permissible range')
elseif tadosetpoint_temp < 6 then
print('Tado Setpoint too LOW - Out of permissible range')
else
os.execute('php70 -f /volume1/web/heating/tado.php '..tadosetpoint_temp)
print('Tado Setpoint Change to: '..tadosetpoint_temp)
end
end
return commandArray