Issue With First Luup Code

i am trying to make a scene which runs every 5 minutes, if the humidity of my room is lower than 29.9 then turn my humidifier on, else turn it off. my code so far is:

[code]local humidity = luup.variable_get(“urn:upnp-org:serviceId:Humidity Sensor”,“CurrentLevel”, 13)

if ((tonumber(humidity) < 29.9)
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “0”}, 5)
else
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = “1”}, 5)[/code]

however this doesnt seem to work, can anybody help me out? what am i missing?

since trying this i have also tried:

local humidity = luup.variable_get("urn:upnp-org:serviceId:HumiditySensor1","CurrentLevel", 13) local max = 30 if (tonumber(humidity) < max) then luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 5) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 5) end

this doesnt come up with an error however doesnt turn the switch on or off

There is an error in the service id for humidity sensor. Try this:

local humidity = luup.variable_get("urn:micasaverde-com:serviceId:HumiditySensor1","CurrentLevel", 13) if (tonumber(humidity) < 30) then luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 5) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 5) end

got it working in the end, made it slightly more advanced by installing the variable container app, now it takes a maximum humidity from the veritable container app, meaning i dont need to change the lua code just to alter this.

local Humidity = luup.variable_get("urn:micasaverde-com:serviceId:HumiditySensor1" , "CurrentLevel" , 13) local max = luup.variable_get("urn:upnp-org:serviceId:VContainer1","Variable2", 37) if (tonumber(Humidity) < tonumber(max)) then luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "1"}, 5) else luup.call_action("urn:upnp-org:serviceId:SwitchPower1", "SetTarget", {newTargetValue = "0"}, 5) end