Driver starting point/template for IP lighting connectivity

@signal15
Take a look at @ogiewon's code, it implements a Composite-Device, which is a model that should work for what you're doing.

Here's the specific codebase:

Specifically, the *parent*.groovy files, for the Drivers of the Parent Devices, and the child-{switch|dimmer-switch}.groovy files for the Child Devices

Yours will likely be a little different, since I imagine you'll need to use Protocol.TELNET instead of HTTP-based requests this code appears to be using.

To initialize the Telnet connection, the doc is scant, so best to look at things like the Alarm Panel Drivers (eg. DSC).

For mine, I use something like the following, as my panel expect line-delimited data, terminated by a CR.

   telnetConnect([termChars:[13]], ip, (int)port, null, null)

This is akin to the old <settings>/<protocol> section of a Vera Plugin's I_*.xml file.

The main difference you'll find is that the Child Devices typically need a specialized Child Driver file (like the above) in order to "send" actuation events (eg. "on" or "off") up to the parent to be handled (in your MiOP/Vera, that part was automatic)

Hope this helps..

1 Like