Hi I have been working to switch off the AC when the door sensors are open a x minutes. No issue with this, but I have been testing and I noticed that if the door sensor is out of communication i.e. the battery is flat it defaults to tripped in the GUI and set the variable to match.
If the door sensor code is running it will consider that the door is open and will switch off the AC, and you will enter a deadly loop with the renter turning on the AC and Vera turning it off since it thinks the door is open when the issue is that the sensor is down.
To fix this I thought of forcing a poll and checking the result. This is where I get into trouble the luup function I used is…
lul_resultcode, lul_resultstring, lul_job, lul_returnarguments = luup.call_action(“urn:micasaverde-com:serviceId:HaDevice1”,“Poll”,{},3)
Firstly where are the expected return values described in the Wiki or manual. I cannot find this described. In my tests…
lul_resultcode returns a 0 always regardless of the state of the device on or off.
lul_resultstring returns nothing regardless
lul_job returns a variable that changes every time so I assume it is a system variable
lul_returnargument returns a table
Two questions
- Where are the return variables for Luup functions described
- How can you implement code to avoid the dead loop if the device status is “dead”
Many thanks