I have a problem with JSONPATH transformation.
I have the following setup:
Openhabian 3.4.4 on a Rpi 4
MQTT Broker from Openhabian running on the Pi
Shelly Plus 2PM with a Shelly Plus Addon where a contact sensor
The contact sensor is on a window and is supposed to track if the window is opened or closed.
The Shelly Plus 2PM is connected to my MQTT broker. When the window is opened/closed a event is triggered there and appears to be correct:
The transform is working correctly. Your error message tells you that after the transform has returned “false” the channel doesn’t know what to do with that because "false" is not a viable option for a contact channel.
If you look in your channel definition you used Open and Closed to try to define custom values, but those are not valid configurations. Contact channels are configured just like switch channels if I recall, so you need to use on and off to define custom values even for the contact type channel.
I thought that on and off where bi-directional, but maybe they are only outgoing transformations (I don’t use them on my few MQTT items). In that case, you will need to chain the JSONPath transform to another transform (e.g. map transform) to convert the true/false strings to open/closed commands.
Please be aware that there is absolutely no need to use such long names for the Channels, as the Channels are always addressed with the complete
UID: mqtt:topic:brokername:Shelly2PM_DG_Kueche:Shelly2PM_DG_Kueche_Window
Thank you very much! That finally worked.
Also thanks to the hint regarding the channel names. I had in mind that they also need to be unique. But the uniqueness is created through the thing name.