rule "Garten Temperatur"
when
Item OW_Item_Garten_Temperatur received update
then
logInfo("Garten Temperatur", "OW_Item_Garten_Temperatur = " + OW_Item_Garten_Temperatur.state)
KNX_Item_Garten_Temperatur.sendCommand((OW_Item_Garten_Temperatur.state as Number).floatValue)
end
No. In fact, you did it the right way (i.e. to remove the unit with (state as Number).floatValue)
But:
Why setting up the same GA twice? NEVER do this!
Why setting up the GA as readable? (i.e. <)
Whatâs the DPT of the corresponding CO?
Please be aware that itâs more common to setup a control channel (that is, openHAB is proxy of the sensor. Usually openHAB receives states from knx and sends commands. When using a control channel, itâs the other way around, openHAB sends the status (e.g. temperature measurement) to knx and receives commands (you can use this to control another actuator like a HUE lamp directly from a knx wall switch)
Thanks a lot for the reply but your answers cause some questions regarding the cooperation of OH3 and KNX. Please refer to the inline comments / questions.
My feeling is there is a (big) difference between OH2.5 and OH3.x
No. In fact, you did it the right way (i.e. to remove the unit with (state as Number).floatValue)
I got it working now by changing the Item type from âNumber:Temperatureâ to âNumberâ.
But this is not really straight forward from my point of view especially when it causes to avoid actions like sending commands without any hint in the logs.
I think it is reasonable to define an Item as precise as possible.
But:
Why setting up the same GA twice? NEVER do this!
OK, in this case it is wrong and should be â<7/0/220â. I will change it.
Why setting up the GA as readable? (i.e. <)
In this case it is a conversion via rule of an 1-wire temperature value to a KNX state which is only updated when the 1-wire item changes.
KNX devices sometime request the status of a device (e.g. startup of a new device) and can be programmed to fetch the current state. Same for ETS or other KNX scripts to retrieve a value on demand and not waiting for an active update.
I have other Things (e.g. a KNX switch defined with 1.001:1/0/100+<1/2/100) which show the correct switch state only after toggling the switch instead of checking the provided status GA (1/2/100).
Same for the configuration via Main UI. For some of the Items the current state is shown, for other - defined in the same way but maybe another room - show NULL. Checking the state via KNX bus requests the correct state is replied. I expect that the current state is retrieved whenever an element is used in the UI, because of the given readable GA <X/Y/Z.
I have still an OH2.5 system which behaves here different - better âŠ
Whatâs the DPT of the corresponding CO?
It is a temperature - DPT 9.001.
For me it was complete unclear whether it makes sense to provide the DPT. The documentation says it is optional. Sometime I had the feeling that removing the DPT helped to get the current state in the UI.
BTW, is still correct that when changing / adding / removing the DPT OH3 has to be completely restarted?!?
Excerpt from KNX Binding documentation:
âNote: After changing the DPT of already existing Channels, openHAB needs to be restarted for the changes to become effective."
knx canât use UoM (yet) so you canât link UoM Items to knx Channels.
So you must not read the state from knx at all.
Please only request GA which are marked readable in ETS - and please keep in mind, that a readable GA must be readable exactly in one CO linked to that GA. And it has to be the main GA (i.e. the first GA on that particular CO)
Well, maybe some read requests are messed up. Check openhab.log
So thatâs default DPT for number channel. Thatâs the pointâŠ
Iâm not sure about the need of restart. Itâs possible to pause (and so restart) Things.
And when it comes to OH2, itâs possible to restart only the binding in question, no need for a complete restart.
Thanks again, but on one point I canât agree because of the KNX logic with itâs status COâs.
You wrote:
âSo you must not read the state from knx at all.
That means a KNX device canât update e.g. a temperature display on demand but has to wait for an update by the sourcing (e.g. 1-wire) system - correct? Iâm not sure whether this is acceptable for all cases especially for KNX sources with sporadic data updates.
Please only request GA which are marked readable in ETS - and please keep in mind, that a readable GA must be readable exactly in one CO linked to that GA. And it has to be the main GA (i.e. the first GA on that particular CO)"
I canât agree to the last sentence. KNX switches for example have 2 channels, the actor channel to toggle the switch and the correspondent status channel which give the real state of the switch. That means the second GA has to be the readable status GA - correct?
If it is so as you wrote I see no sense to have several GAâs for a channel at all.
No. The whole point is, you have to use number-control as Channel Type. That way openHAB is the sensor (from perspective of a knx device). The knx device can send a read request and openHAB will answer.
Please be aware that < is only to mark a GA as readable for openHAB, not for other knx devices. Itâs not the R-Flag, readable (L in german for lesbar) The meaning of < is âThis GA has a CO with the R-flag set.â
Yes, but the switch isnât the device which will answer the read request, but itâs the actuator. And the actuator has a CO for the status.
A knx device does only send on the first GA set to the CO.
from my understanding it is compliant to the documentation (which only shows a text based example) and I expect that when saving that Thing and linking an Item to it, the binding will read the current status on KNX bus using the GA <1/2/40 and updating the status in the MainUI when the corresponding GroupValueWrite is received. But this doesnât happen. The status is remains âNULLâ until I toggle the actor via HW KNX switch or via the UI (eg. openHab App on my mobile) or the KNX device sends it periodically by itself.
In OH2.x Iâm pretty sure, the states have been updated whenever the KNX thing or item file has been rewritten.
Is my understanding totally wrong here?
As I see it via the KNX Group Monitor on the bus, OH3 isnât retrieving the states from the Items.
Yes the GA 1/2/40 is definitely linked to a single CO with the R-Flag set.
I made another experience. For me it seems that only the Standard DPT shown in the OH KNX documentation are supported. Using non-supported once cause OH3 to ignore all bus events.
I have a presence detector (with additional Alarm channel) which I programmed with âDPT 1.011 and GA 2/0/5â and a periodic firing of 20s. In OH3 I defined a channel with â1.011:<2/0/5â.
The sensor fired periodically âInactiveâ but the OH3.1 UI showed constantly âActiveâ. After changing the OH3 channel to â<2/0/5â and disabling / re-enabling the Thing the Items state changed to âInactive".
Re-enabling does not trigger a GroupValueRead on the KNX bus to get the current state, the item is waiting for a corresponding message on the bus.
Wouldnât it be reasonable to make a GroupValueRead for each Main-UI newly defined or changed Things channel?
Comparing OH2.5 and OH3 there is a (big) difference of the KNX behavior.
Adding a new sensor in OH2.5 with âType switch : alarm_KGAR âAlarmâ [ ga="1.011:<2/3/5â]â seem to have no problem with non-standard DPTâs.