Help with luup please

I’m trying to implement some luup in a scene and I’m getting errors when I’m trying to save it. Could some one advise where I’m going wrong.

--Get Device status
local IDHeat = 58
local IDStat = 77
local HeatStatus = luup.variable_get("urn:upnp-org:serviceId:HVAC_UserOperatingMode1", "ModeStatus", IDHeat)
local SP_Target = luup.variable_get("urn:upnp-org:serviceId:TemperatureSetpoint1", "CurrentSetpoint", IDStat)
local SP_Current = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", IDStat)
if HeatStatus == "HeatOn" then
-- do some
   If (SP_Current < SP_Target) then
    -- turn on switch
    luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 111)
    -- turn off switch
   luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 111)
-- do some

I reformatted the code in your post so that it appears nicely in the forum’s presentation, and it appears that you have a capital ‘I’ at the start of one of your ‘if’ statements…

…it’s also missing an ‘end’ statement.

1 Like

Thank you. Much appreciated. I thought about the end statement after I posted but missed the capital I.

Thanks again.

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules