Channel (types): read only vs. read + writable

A question about channel types:
The channel type states if its state is read only or can be also written (e.g. if you use XML you can adjust this setting by using the readOnly attribute of the state element, or you can handle this programmatically).

There are “settings” of a channel type that can be overwritten by a channel (e.g. AutoUpdatePolicy to give one).

The read only attribute cannot be changed by a channel (so a specific instance of a type).

If a binding supports things that can provide the current state of a specific information without allowing the user to change that value and other things allows to modify the current value.

The state vs. command concept allows to use one item that represents a state and take a command to change the current value.

Should there always to channel type for a specific “information” one “read only” and the other “read writable” as soon as there are things that only provide a value and another one that allows to handle a command?

In general it should be 1 channel I think. But I’m not sure what you intend to do here. Can you give an example of what kind of functionality you want to support?

For example:

  • ventilation system of type A that provides its current rotation speed but does not allow to change it.
  • ventilation system of type B that provides its current rotation speed and allows to control the rotation speed.

For me it is one channel “rotation speed” the one provides a state and does not consume any command – it is read only, the other one provides a state and consumes command – it is not read only.

Same can be true for other things / channels, too.

A “thing” that provides the supply temperature (Vorlauftemperatur) and another one that allows to control it.

Regardless if we use one thing type or two thing type (for the thing that can be controlled and the non controllable thing) the question for the channel type remains.

I’m not sure if I understand what you intend. If it is only about having a channel readonly in one thing and not in another thing. You can have 2 thing types and use 2 different channel-types for each channel. A read only and a read/write channel type. The channel name in both of these thing types can be the same.

That’s exactly what my question is about:
If the only difference of two channels is if it is read only or read writable, do we really need to create two channel types?

Why can’t we overwrite the “read only” settings of a type by its specific usage similar to label, auto update policy etc.?

You can use one channel-type for both channels and add a DynamicStateDescriptionProvider to handle the read-only attribute (beside other attributes) depending on the thing-type.