I’ve been trying to wrap my SABnzbd control up into a device. It is acting as a BinaryLight - well, trying to.
If I set the “Status” variable manually using the luup.variable_set command in the Test Luup window, it happily toggles the status of the device in the Dashboard from On to Off and back again. For example:
luup.variable_set(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,1,)
makes it appear as if it is turned on.
However, I get a “Delivery Failed” whenever I press the On or Off button on the Dashboard. This is on UI4.
The code I am using is located at:
http://github.com/brettmichael/MIOS-SABnzbd/tree/master/src/
I’m hoping someone can eyeball the relevant lines of code and point me in the right direction - at the moment it isn’t doing anything except trying to toggle the status and it is based heavily on the EtherRain plugin.
Anyone from MCV? It’s kind of holding me up - I’ll try logging a support call in a couple of days but it seemed like a forum kind of thing. The lua is easy - it’s the integration with Vera that is lacking in examples.
In UI4, you’re required to implement all handlers, even for the built-in Device Types. In your case, this means implementing the handlers for the SwitchPower type.
If you want to see what this looks like, take a crack at:
http://code.mios.com/trac/mios_dscalarmpanel/browser/I_DscAlarmPanel2.xml#L396
it’s for a SecuritySensor1, and it’s Arm/Disarm buttons/actions, but the principals apply equally to your situation with SwitchPower just change the ServiceId and Name parameters to match those expected by the SwitchPower Device.
This is a change in behaviour from UI2, where you got a behavior for these Button presses “by default”.
Thanks Guessed - you rock. Sounds like a good enhancement to ui4 would be validating the XML has all the required actions defined before rendering it.
I’m away for a bit but will give it a crack as soon as I am back.
Thanks again.