Contact item, how to map from KNX

Hi,

I am using OH2 and KNX binding ,my question is:

From KNX I receive the status of a sensor as 1 or 0, how do I map the 1 to OPEN and 0 to CLOSED as contact item only has OPEN/CLOSED status.

As far as I saw, the map transformation is to translate or change names for the UI, but not to “translate” data between different services/bindings correct?

So, how can we map data received from a service/binding so it can be recognized by another?

Many bindings support transforms where you can use a MAP on the value, not just the UI. KNX is not one of these.

Therefore you will probably have to use a Proxy Contact Item, convert your Item bound to KNX to a Number Item, and create a rule that triggers when the Number Item changes to update the Proxy Contact with the appropriate value.

Thanks @rlkoshak for your help.

I can see that KNX binding for OH2 is under development and also a lot of discussion regarding the ontology. Will this feature to map values be included in this OH2 version? @kgoderis @Kai

@Jaghova MAP is currently not part of the KNX 2.0 binding.

@Kai I am just wondering if we should not generalise this MAPping possibility? on ItemChannelLink ? It is coming back time after time, and not all implementations are similar or complete with respect to this…

K

I can only add that such feature would make projects much easier when it comes to integrate different systems/bindings which as I understand is the goal of OH. Not only for KNX but for other bindings as well.

I know you can short it our with rules, but in my case, like I guess many other people, my KNX project has 1200 GA, and up to now 300 Items declared in OH and growing, so the rule thing is a nightmare to handle.

It makes very hard to make some KNX Data Points to map them with other bindings. For example, sonos player, thermostats, etc… basically everything that is not a string or number.

Not sure if I understand the issue here. Using MAP rather seems to be a workaround for a problem.

From KNX I receive the status of a sensor as 1 or 0

So how does the channel of your Thing look like for this? In your specific case, it should be a Contact channel and then there would be no need to do any kind of MAP transformation…

May be 1 and 0 is not the best example, lets use for example:

If I receive in KNX bus a value “5” and I want to “PLAY” in sonos how we map this 5 to PLAY? It can be the same with 0, 1, 2, 3 and OFF, COOL, HEAT, AUTO in thermostats. In this last case Homekit biding allows us to set a mapping for OFF, COOL, HEAT, AUTO in homekit.config but not all bindings have this functionality.

I know I can map values to text for UI purposes, but how to do it between bindings?