Hi all,
I am using OH in order to connect my KNX devices with the remaining world, and started with OH2.4 and the KNX2 binding for this.
From the beginning the knx2 binding and myself are not best friends. The integration of the OH and the KNX bus is not perfect, mainly because the command and the status is not distinguished well, and the usage of the -control channel configuration is not self-explaining.
I like the differentiation between command and status in OH. Usually the same is done on the KNX side. So why not try to map both worlds?
Most of the KNX configurators distinguish between groups addresses used for commands (e.g. 1/2/3 for âswitch onâ) and status (e.g. 1/2/103 for âis switched onâ).
This can be configured in the todays .things configuration by specifying
switch light : [ ga="1/2/3+1/2/103" ]
or
switch light : [ ga="1/2/3+<1/2/103" ]
and an item
Switch Light {channel="...:light"}
For simple channels where command and status are more or less the same this works like a charm.
In the case of special situations one gets into trouble.
Think about a switch-on delay of 5 seconds of the light above, configured in the KNX actuator channel.
If one sends a
Light.sendCommand(ON)
the status of the Light is changed directly to ON in OH, even though the light switches on 5 seconds later, which then is sent by the actuator in 1/2/103.
In order to avoid this one must configure
Switch Light {channel="...:light", autoupdate="false"}
This is not nice, because you need to model the KNX behavior in two different places, things and items.
Additionally, it doesnât help if one switches the light on via the KNX bus using 1/2/3. Then the autoupdate=âfalseâ does not work, and the state of the light switches to ON in OH immediately, although it is not switched on due to the delay. Technically this is understandable, because OH cannot distinguish between 1/2/3 and 1/2/103.
Therefore, in case of e.g. a switch-on delay, one must configure two channels and two items to distinguish between command and status.
Therefore I would want to discuss the following proposal:
- The basis is that one can distinguish the ga types âcommandâ and âstatusâ in configuration. As a consequence one need not to set autoupdate.
- With a slight enhancement we could get rid of the -control channels.
New Configuration
Taking the example above one would configure
switch light : [ cmd="1/2/3" state="1/2/103" ]
and
Switch Light {channel="...:light"}
For sending a command (Light.sendCommand()) the cmd ga 1/2/3 is used, for maintaing the state the status ga 1/2/103.
autoupdate=âfalseâ is intrinsic, because the state is not changed by the command via 1/2/3. So the switch-on delay is visible to OH, because only the status ga is used for maintaining the OH states, as long as postUpdate() is not used.
If one wants that the state is maintained by the cmd ga also, it must be specified:
switch light : [ cmd="1/2/3" state="1/2/103+1/2/3" ]
Then it works like today by [ ga=â1/2/3+1/2/103â ]
With
switch light : [ cmd="1/2/3" state="<1/2/103" ]
one can configure that the state is read from KNX while starting, like today.
And, in order to get rid of the control items, one could configure
switch light : [ cmd="1/2/3" state=">1/2/103" ]
which shall mean that the KNX binding responds to a GroupValueRead on 1/2/103 and send the state to the bus in case that is changed using postUpdate(), like in the todays -control channel / item.
switch pure_status : [ state=">1/2/103" ]
is an non-command channel then. sendCommand() has no effect.
This enhancement an be used for other channel types as well. E.g. the
Type rollershutter : rs [ upDown="4/1/71", stopMove="4/1/72", position="4/1/73" , state="4/1/173" ]
gets its percentage state from 4/1/173. The other entries are used for commands only.
What do you think?