Question: how to extend / reuse a binary light device

Hello,

I’m working on a gateway device. I’m looking for samples how to extend the binary light device so I can send my own commands through a gateway, but reuse the current implementation (UI, buttons etc.)

Currently I can pass all information received from the gateway to motion sensor and door sensor devices so they display the correct status. I’m ready for the next step sending commands through gateway to the real devices. I would like to reuse current implementations, but ‘tap’ into the part where information is send to the real device. Is this possible or do I have to write totaly new components?

Thanks

Sure, you can do that!

You need to define the “urn:upnp-org:serviceId:SwitchPower1” service.

If you take a look at my code here:

http://code.mios.com/trac/mios_mochad-x10/browser#trunk

specifically the I_Mochad.xml file, that is exactly what I do.

Great…thanks for the example. Exactly what I needed.

One extra question. I managed to reuse the binary light and send my own commands (light on/off) and the icon (lightbol) changes accordingly

Problem are the buttons. They stay the same color. This also applies to the sensors (armed, bypass). I can press the button, in the vera log I see the value set, but the actual button color stays the same.

Thanks

Do you work with this variable or with the Target variable? The buttons show the value of Status.

The status variable gets set using

luup.variable_set(“urn:upnp-org:serviceId:SwitchPower1”,“Status”,lul_settings.newTargetValue,lul_device)

In the UI I can see the status change directly, but the buttons are updated a long time later or are not updated at all (and so give wrong status).

I didn’t manage to reproduce this. I don’t know what could cause these delays. Can I see the code?