Hi,
First of all thanks for incredibly helpful postings in this community, they really helped me getting started with OH3 when I decided to start from scratch after quite some years running FHEM.
I have a working dockerized system running OH3, Mosquitto and zigbee2mqtt. Zigbee2mqtt is setup in a “conservative” way, i.e. with the homeassistant feature for auto-discovery enabled and the output being json-format. I’m well aware of the Zigbee2mqtt revisited post from late 2019,
but decided to go with auto-discovery for now to avoid the pitfalls of a noob editing config files.
As a first test for Zigbee devices, I decided to integrate an Aquara Window/Door contact sensor (MCCGQ11LM) into the system and gave it a nicer name (aq_fenster_1) on the zigbee2mqtt side. It works flawlessly on the zigbee and mqtt side, I get both the regular mqtt messages when opening/closing the contact
aq_fenster_1 = {"battery":100,"contact":false,"linkquality":0,"voltage":3055}
aq_fenster_1 = {"battery":100,"contact":true,"linkquality":0,"voltage":3055}
as well as the homeassistant config message (example for the contact channel):
{
"availability": [
{
"topic": "zb2mqtt/bridge/state"
}
],
"device": {
"identifiers": [
"zigbee2mqtt_0x00158d0005225ede"
],
"manufacturer": "Xiaomi",
"model": "Aqara door & window contact sensor (MCCGQ11LM)",
"name": "aq_fenster_1",
"sw_version": "Zigbee2MQTT 1.17.0"
},
"device_class": "door",
"json_attributes_topic": "zb2mqtt/aq_fenster_1",
"name": "aq_fenster_1_contact",
"payload_off": true,
"payload_on": false,
"state_topic": "zb2mqtt/aq_fenster_1",
"unique_id": "0x00158d0005225ede_contact_zb2mqtt",
"value_template": "{{ value_json.contact }}"
}
The trouble starts when I save the automagically discovered thing and try to link the channel contact
to an item / add it as an equipement/point to my model. The least annoying issue is that the thing’s status is “Unknown”, despite the homeassistant config setting the “availability” channel correctly (see above: "topic": "zb2mqtt/bridge/state"
).
More importabtly, none of the channels show any data or changes in state. I tried JS and JSONPath transformations as suggested in some older posts, but that didn’t work. It seems like the auto-discovered thing doesn’t get the mqtt messages it should, given that the state_topic is set correctly in the config message (see above: "state_topic": "zb2mqtt/aq_fenster_1"
).
I verified that OH3 and the JSONPath transformation work for the messages sent for this device by creating a Generic MQTT thing that listens to the contact sensor’s messages:
UID: mqtt:topic:a0cfdd024e:8a543aff65
label: FL_WindowContact1
thingTypeUID: mqtt:topic
configuration:
availabilityTopic: zb2mqtt/bridge/state
payloadAvailable: online
bridgeUID: mqtt:broker:a0cfdd024e
channels:
- id: FL_Fenster1_Contact
channelTypeUID: mqtt:contact
label: Contact
description: ""
configuration:
stateTopic: zb2mqtt/aq_fenster_1
transformationPattern: JSONPATH:$.contact
off: "true"
on: "false"
I get a nice open/closed status reading that updates in real time. Loooong story short, is there anything or any steps I’m missing with regard to the homeassistant auto-discovered thing? Or does that binding just not (yet) work with this device, despite the configuration data looking OK?
Thank you in advance for your help or any hints you may be able to give me!