How to handle asymetric values in channel types

As I’m setting up my ChannelTypeProvider I’m contemplating how to handle the many asymmetric cases I have.

For example, a symmetric case is where you have a simple switch. The switch has two position, on and off. So, there are two commands you would send to the channel, on and off. Subsequently, because it’s symmetric, the status you would get on the channel would be on and off.

But when commands and status is asymmetric, then what? Take for example the lamp on a projector. There are two possible commands, on and off. However, there are 4 different statuses. When I command the projector to turn on, the lamp should come back with a status of on, but when I command the lamp to turn off, the status will at first come back “cooling”. During the cooling status the power switch should be disabled because power state commands are invalid in that state. Finally, the projector will decide it’s sufficiently cool and the status will change to off, which then allows the on command to be re-enabled. Then there is “Emergency” status, which is an asynchronous status that basically means the projector is off-line until the condition has been dealt with and manually cleared.

How would such channel be defined? It didn’t seem possible to designate values that are specific to commands and those that are specific to status. How should this be handled?

–TIA

I don’t know if the following combination works. But you can create channels with a fixed set of options states and commands (must be a String item-type):

<state readOnly="true">
    <options>
        <option value="ON">On</option>
        <option value="OFF">Off</option>
        <option value="COOLING">Cooling</option>
        <option value="EMERGENCY">Emergency</option>
    </options>
</state>
<command>
    <options>
        <option value="ON">On</option>
        <option value="OFF">Off</option>
    </options>
</command>
1 Like

That does look like the perfect answer to the question. However, it left me struggling with that kind of a representation being very awkward from a UI perspective.

Then it occurred to me that I should probably be thinking of channels representing a logical model, decoupled from the physical Thing protocol. If you model it logically, you have three channels; an On/Off switch, a Cooling light/indicator, and an Emergency light/indicator.

The switch is either On or Off. When the status is Cooling, the switch is Off and disabled, the Cooling indicator is on, and the Emergency indicator is off. That feels like the most natural way to model this specific scenario.

But it’s good to know what options are available.

Thanks!