Openhab ignores Transformation

  • Platform information:
    • Hardware: Rasperry Pi 3B+
    • OS: Openhabian
    • openHAB version: 2.5.0

Hello and sorry for my bad english

I have following MQTT Thing and it receives Messages (false and true) from Zigbee2MQTT

Thing topic Fenster_Bad "Fensterkontakt Bad" {
    Channels:
        Type contact : Kontakt                   [ stateTopic="zigbee2mqtt/Sensor_Fenster_Bad/contact", CLOSED="true", OPEN="false" ]
        Type number : battery                   [ stateTopic="zigbee2mqtt/Sensor_Fenster_Bad/battery" ]

But when the message true or false comes in then i have this error

Command 'true' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.true

But why? Another Thing with on=“ON” works great

Can somebody help me please?

Hi,

the error message is quite clear on this: “true” and “false” are not supported by your item. I only see your thing definition, but I assume the item is a simple switch? If so, it only knows the OPEN and CLOSED values.

Is the mapping for CLOSED and OPEN correct?

Type contact : Kontakt [ stateTopic="zigbee2mqtt/Sensor_Fenster_Bad/contact", CLOSED="true", OPEN="false" ]

My item is also a contact

Contact Badfenster                                                   { channel="mqtt:topic:mosquitto:Fenster_Bad:Kontakt" }

But the contact switch only accepts OPEN and CLOSED and with the "Transformation OPEN=“true” it should become the message OPEN or Closed or not?

That’s not how transformations work and there is no OPEN=“true” parameter when defining a Channel in a .things file. I just read a similar thread not to long ago who had the same issue. The docs are pretty clear though, you use on=true even with a Contact.

Beyond that I can’t help. I don’t use .things files. I don’t recommend the use of .things files. And honestly I feel like I spend too much time helping people who insist on using them already.

You cannot just make syntax up. That isn’t how you would define a transformation. There is no OPEN= parameter for MQTT bindings.

Recent thread as mentioned by Rich

@Christoph_Max so close the

Change

CLOSED="true", OPEN="false"

To

on="true", off="false"

Item will look like

Contact Kontakt "Open/close contact" {channel="BLAH:Fenster_Bad:Kontakt"}

Sitemap

Default item=Kontakt

Rich is totaly correct the docs are clear however thankyou for posting the question as not everyone has english as first language. I use thing files others don’t their is no wrong way just working or not.