[SOLVED] OH 2.5.11 | Aqara Zigbee Contact Sensor


I’m a little bit confused … I’m using this things definition for an Open/Close sensor.

Thing mqtt:topic:mymqtt:sensor_contact_az "MQTT Open/Close" (mqtt:broker:mymqtt) @ "MQTT Contact" {
                Type contact : contact "Contact" [

Via MQTT this is sent. "contact":true means CLOSED.

zigbee2mqtt/sensors/contact/az {"battery":100,"contact":false,"linkquality":0,"voltage":3055}
zigbee2mqtt/sensors/contact/az {"battery":100,"contact":true,"linkquality":0,"voltage":3055}

Item is defined in this way …

Contact sensor_contact_az_contact   "AZ [%s]"  <door>  { channel="mqtt:topic:mymqtt:sensor_contact_az:contact" }

Unfortunately open/close can’t be shown.

During my tests, some-times I’ve got this messages…

[...] Tried to set invalid state OFF (OnOffType) on item sensor_contact_az_contact of type ContactItem, ignoring it

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

Any idea what can be wrong? Have already tried to find a solution using Google and this community, but didn’t found a good solution.

Thx, markus

I don’t know zigbee2 mqtt but I would say you’re missing a Thing:

Bridge mqtt:broker:mymqtt [ host=“”, secure=false, username=“openhabian”, password=“openhabian” ]


Thing topic mysensor “Sensor” {


Type string : Sensor [ stateTopic=“zigbee2mqtt/sensors/contact/az” , transformationPattern=“JSONPATH:$.contact” ]

The Item should be:

String Sensore_state “Sensor [%s]” {channel=“mqtt:broker:mymqtt:mysensor:Sensor”}

Sorry for this. Bridge is defined at another file and is working with some other Zigbee devices very well.

Only contact sensors won’t work as expected.

I’ve just tried with your exact configuration, and it’s all working fine for me!

openHAB has a bug, which it has had for a long time, where it doesn’t always properly load a Things file after it has been saved.

Restart your openHAB for a quick fix, or do this

WTF … :rofl: This was working!! Thx a lot.

I’m playing arounf with OH3 and the Things problem seems to exist there, too. Sometimes it just works after sudo systemctl restart openhab

Another question. Sitemap status updates won’t work. Neigter in App and WebUI the changed status will be displayed.

Update. Have fully restarted OH2 and now this is working, too.
sudo systemctl restart openhab2