Contact item / transformation not working

Tags: #<Tag:0x00007faed9d6b228> #<Tag:0x00007faed9d6af58> #<Tag:0x00007faed9d6adf0>

Hi,
I am currently trying to setup some Zigbee devices, namely Aqara Door/Window Sensors. Including them into the zigbee network and getting them to work as a switch type works. The problem now is: these sensors have the channel type switch, with window open => on and window closed => off. I would like to have them of the type contact, displaying open and closed.
What works is using a proxy item like here: ON/OFF vs OPEN/CLOSE & Contact item - Cannot get it to work, but I thought it should also be possible to use a Map Transformation. For this my item file reads

Switch WindowSensorSwitch "Switch [%s]" {channel="zigbee:device:26eadbec:00158d000312e668:00158D000312E668_1_switch"}
Contact WindowSensorContact "Contact [%s]" {channel="zigbee:device:26eadbec:00158d000312e668:00158D000312E668_1_switch"[profile="transform:MAP", function="contact_switch.map"]}

and contact_switch.map looks like

ON=OPEN
OFF=CLOSED

The Switch item works as expected, however the Contact does not do anything besides being present in the PaperUI. State changes for the switch are present in the log files

19:36:19.621 [INFO ] [smarthome.event.ItemStateChangedEvent] - WindowSensorSwitch changed from OFF to ON
19:36:20.464 [INFO ] [smarthome.event.ItemStateChangedEvent] - WindowSensorSwitch changed from ON to OFF

but nothing for the Contact item.

What am I doing wrong there, any ideas?

Regards
Matthias

If the Channel is type switch, the Item must be the same type. The type is set in the Zigbee binding process.

It’s a good idea to use the transform profile. But I think the problem is that all transforms output strings. The resulting “CLOSED” is not acceptable as state update for a Contact type Item wanting CLOSED (an OpenClosedType object)

Ok, thanks for the clarification!

Then I misunderstood the Map documentation, which reads

The functionality of this TransformationService can be used in a Profile on an ItemChannelLink too.

I think I will add this information of only producing strings to the documentation page.

The docs is true, the transform can be used in a profile. At the moment, it’s limited to outputting strings, so really it would only work with String type Items, in that usage.
First line in MAP docs -

Transforms the input by mapping it to another string.