LAN device with multiple on/off toggles?


I have a LAN device that I’m trying to write a device handler for. There are multiple features that can be turned on and off, but SmartThings only lets me have a single “on()” and “off()” per device handler. Is there any way to differentiate ?

I can’t really even write it as two separate device handlers, since I can’t have duplicate network IDs, and the network ID has to be “HexIP:HexPort” to work properly. Any suggestions?


There’s a DTH for Aeon or perhaps (Quirky?) power strip that is a good example.

You have to create a service manager with a main device (on1, on2, …) and a set of child Device instances. Capability Switch only supports on/off … with no options to specify which sub-switch … so you need individual instances in order to be conforming.

Here is the code for the Aeon Powerstrip; but it does not automatically create child Device instances … you have to create Virtual Switches manually.

There may be some newer examples (and LAN related), but this gets the concept across for a start.

BTW: A good LAN example is probably Philips Hue. It’s Service Manager (“Connect”) SmartApp spawns a device for every lightbulb linked to the Hue Bridge.

Yeah, the Aeon Power Strip uses the onX functions and a global on() that turns all on. CoRE understands onX, offX, setLevelX, etc. for X between 1 and 8, so it can easily control it. But child devices seems the more conventional way to go.

1 Like