We have moved at community.getvera.com

Author Topic: Why does my LUUP code only trigger on the 44th minute of every hour?  (Read 763 times)

Offline NO2nice

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Hello,
I have a humidifier that is controlled by an Aeon Smart switch, simple power on/off. I have a 6in1 sensor that reports the humidity in the room.  The code below is run in a scene that is triggered every 5 minutes.  I ended up using this method because i couldnt figure out how to turn off the switch when the code returns false and i done know how often the sensors are polled.  Now i get alerts when the smart switch turns on or off and it only happens on the 44th minute on the hour.  Does anyone know what I am doing wrong? I want the switch to turn off/on whenever the humidity demands it and not just wait till the 44th minute.

SHUM = "urn:micasaverde-com:serviceId:HumiditySensor1"
OUTTEMP = "urn:upnp-org:serviceId:TemperatureSensor1"

HUM = luup.variable_get (SHUM, "CurrentLevel", 27)
TEMP = luup.variable_get (OUTTEMP, "CurrentTemperature", 41)

if (((tonumber(HUM) < 36)
and (tonumber(TEMP) >30))
or((tonumber(HUM) < 33)
and (tonumber(TEMP) >20))
or((tonumber(HUM) < 31)
and (tonumber(TEMP) >10))
or((tonumber(HUM) < 26)
and (tonumber(TEMP) >0))
or((tonumber(HUM) < 21)
and (tonumber(TEMP) >-10)))

then
luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=1},29) --This turns a switch with ID of DeviceID on
else

luup.call_action("urn:upnp-org:serviceId:SwitchPower1","SetTarget",{newTargetValue=0},29) --This turns a switch with ID of DeviceID off

end


Offline Chrisfraser05

  • Sr. Member
  • ****
  • Posts: 451
  • Karma: +16/-31
Re: Why does my LUUP code only trigger on the 44th minute of every hour?
« Reply #1 on: January 13, 2017, 03:26:22 pm »
My guess is that's when the device has polled and your humidity value is changed