Multitype channel

Hi! I’ve been trying to write binding for multichannel device. Each channel can be a switch or dimmer or … - depending on the configuration.
Tell me please best practices and examples how to implement this kind of thing?

If the device is a switch/dimmer, then you should simply use the dimmer as the channel type. A dimmer inherits from a switch, so the dimmer can handle ON/OFF states as well as dimmer level states.

If you’re looking for something more generic, then it’s more difficult since the binding doesn’t know the item type (ie the binding has no visibility - currently - of the item).

1 Like

@tim06ka, I would advice to discuss thus development/API related questions directly at https://www.eclipse.org/forums/index.php/f/271/.

1 Like

Yes, my case is more generic - every channel can be input or output. I would like to be able to change the channel type in openhab UI, not in source code (xml).

Thanks, I’ll try