Hi,
I have a KNX device that reports its mode with a datapoint of type “byte”. Possible values are 0, 1, 2 and 3. I want to manage these values in the UI with a switch with a corresponding mapping.
If I use a channel and an item of type “Number”, I get values with a decimal fraction, like “0.0”, “1.0” …
This is my configuration and it does not work (no button is shown as “selected” because “0.0” != “0” ):
// channel in "things" file
Type number : ch3_mode [ ga="5.005:<3/1/152" ]
// item in "items" file
Number Some_Mode "Mode" { channel="knx:device:mdt:IB1:ch3_mode" }
// sitemap
Switch item=Some_Mode mappings=[0="Cool", 1="Heat", 2="Dry", 3="Vent", 4="Auto"]
I also tried using a string:
// channel in "things" file
Type string : ch3_mode [ ga="5.005:<3/1/152" ]
// item in "items" file
String Some_Mode "Mode" { channel="knx:device:mdt:IB1:ch3_mode" }
// sitemap
Switch item=Some_Mode mappings=[0="Cool", 1="Heat", 2="Dry", 3="Vent", 4="Auto"]
This doesn’t work either. The item has values like “1970-01-01T00:00:00.000+0000” and “1970-01-01T00:00:01.000+0000” for the actual values “0” and “1”.
What is the correct way to map a KNX byte (integer) channel to a switch with mappings?
Edit: I am using OpenHab 2.5.