using 3-in-1 sensors to control heating.

I’m puzzeled. Vera keeps telling me there is an error in my lua code for this scene. Can you see what is wrong? I tried to comment the script properly and make it reusable for others. Right now, it bombs out with an ERROR : Error in lua for scenes and events. Does anyone know what I am doing wrong here?

[code]-- add this luup code to the heating ON scene for this room.
local SWITCH_NO = 36 – change 36 to device ID HOME (1) / AWAY (0) virtual switch.
local SENSOR_NO = 25 – change 25 to device ID temperature sensor for room.
local TEMP_LOW_AWAY = 10 – change 10 to desired temp when away for frost protection.
local TEMP_LOW_HOME_DAY = 21 – change 21 to desired daytime temp when home.

– DO NOT EDIT ANYTHING BELOW THIS LINE.

luup.log(“HEATING ON LOOP START”) – debug only

local home = luup.variable_get(“urn:upnp-org:serviceId:VSwitch1”,“Status”,SWITCH_NO)
local temp = luup.variable_get(“urn:upnp-org:serviceId:TemperatureSensor1”,“CurrentTemperature”, SENSOR_NO)
luup.log(“HOME AWAY STATUS”) – debug only
luup.log(home) – debug only
luup.log(“ROOM TEMPERATURE”) – debug only
luup.log(tonumber(temp)) – debug only

if(home==“0”)then – nobody home status is AWAY.
if(tonumber(temp) => TEMP_LOW_AWAY) then – temperature high enough, do nothing.
luup.log(“DEBUG: AWAY and temp high enough”) – debug only
return false
elseif(tonumber(temp) < TEMP_LOW_AWAY) then – temperature too low, switch on heating.
luup.log(“DEBUG: AWAY and temp has not reached set temp”) – debug only
return true
else
luup.log(“DEBUG: something went wrong in heating ON AWAY loop”) – debug only
end – END home status is AWAY loop.
elseif(home==“1”)then – peeps at home status is HOME
if(tonumber(temp) => TEMP_LOW_HOME_DAY) then – temperature high enough, do nothing.
luup.log(“DEBUG: HOME and temp high enough”) – debug only
return false
elseif(tonumber(temp) < TEMP_LOW_HOME_DAY) then – temperature too low, switch on heating.
luup.log(“DEBUG: HOME and temp has not reached set temp”) – debug only
return true
else
luup.log(“DEBUG: something went wrong in heating ON HOME / AWAY loop”) – debug only
end – END home status is HOME loop.
end – END home status heating on loop.
[/code]

I think the problem is in the If then loops? Tried to copy smaller chunks of the above luup code in but Vera fails at the" if then loops". The Vera unit is remote, can’t ssh to it and only have access via de mios.com portal.

I tried the test luup code in the apps section and it fails, it does not tell me why. Is there a way I can debug this from remote? I’m a total noob to Luup code so am not sure if I posted a stupid question or not.

Haven’t looked in too much detail but “=>” should probably be “>=”

Thanks! I also got a hint in a private message but could not say thank you because I can’t reply to private messages yet. Thanks again! I wasted an entire evening on it but it works now! Time for me to expand the script that the night time temp also works (prevent me from waking up sweating in the middle of the night)