[solved] Accessing zigbe2mqtt channel via openhab

Heya
I’d need a sanity check here. I migrated from the 1.x mqtt binding to the 2.x one and I can’t seem to get the thing configuration right. I am all file based.

My thing is configure in a mqtt.thing file. There are other mqtt topics I subscribe on the same broker (mostly temp) and they work fine - so the general connectivity is ok.

My button is a xiaomi Mijia WXKG01LM

mosquitto-sub shows:

zigbee2mqtt/bridge/logging {"level":"info","message":"MQTT publish: topic 'zigbee2mqtt/0x00158d000423b146/click', payload 'single'"}
zigbee2mqtt/0x00158d000423b146/click single

Bridge mqtt:broker:mosqitto "mosquitto"[ host="192.168.0.100", username="user", password="pw", secure=false ]
{
	Thing topic Garage_innen  "Garage_innen" {
    Channels:
        Type string : click    "Garage_innen" [stateTopic="zigbee2mqtt/0x00158d000423b146/click"]
      }
    }

The item then links to the channel:

String Garage_innen 			"Garage Innen" 												{channel="mqtt:topic:mosquitto:zigbee2mqtt:Garage_innen:click"}

but despite the fact that my events log says:

Link 'Garage_innen-mqtt:topic:mosquitto:zigbee2mqtt:Garage_innen:click' has been added.

I see nothing the OH log when I press the button.

Is there anything obviously wrong with that configuration?
[Edit: addet the bridge]

From my initial look, I don’t know if your thing is linking to an mqtt broker.
So here’s a zigbee2mqtt bridge I used to use:

Thing mqtt:topic:z2mbridge "Zigbee Bridge"  (mqtt:broker:mosquitto) @ "Cupboard"
{
    Channels:
        Type switch     : permit_join   "Permit Join"   [ stateTopic="sensors/zigbee2mqtt/bridge/state/config/permit_join",on="true", off="false" ,
                                                        commandTopic="sensors/zigbee2mqtt/bridge/config/permit_join", on="true", off="false"]
        Type contact    : online        "online"        [ stateTopic="sensors/zigbee2mqtt/bridge/state",on="online", off="offline"]
}

In the group brackets, I set the mqtt broker to mqtt:broker:mosquitto which is defined:

Bridge mqtt:broker:mosquitto "Mosquitto MQTT Broker" @ "Cupboard"
[
    host="mqtt.local",
    secure=false,
    port=1883,
    clientID="Mqtt-thing"
]

If you have a paperui mqtt broker, then you’ll need to get it’s definition name to put in the Garage_innen thing.
Then everything else of yours does look ok.

1 Like

Thank you - for simplicity I left out the bridge in my post (which probably did confuse instead of keeping things simple)
I have added the bridge to complete the statement in the original post.

I did configure the bridge in a slightly different way . All tings are directly under the Bridge. But this should make no difference

What did you change?

versus

You’ve got two different spellings of Mosquitto.

Also, your Item Link has zigbee2mqtt in it for some reason - take it out.

If you keep your Bridge and Topic Things the same, your Item Link should be

channel="mqtt:topic:mosqitto:Garage_innen:click"

Oh dear… this is embarrassing…

Thank you for spotting my typo - I will go an shoot myself now…

of course the :zigbee2mqtt: also needs to got - but this was just a fragment of me trying different things…

It works now again - and you are a star! Thank you again

for completeness: this is correct (and I have fixed the typo here):

Bridge mqtt:broker:mosquitto "mosquitto"[ host="192.168.0.100", username="user", password="pw", secure=false ]
{
	Thing topic Garage_innen  "Garage_innen" {
    Channels:
        Type string : click    "Garage_innen" [stateTopic="zigbee2mqtt/0x00158d000423b146/click"]
      }
    }
}

String Garage_innen "Garage Innen"  {channel="mqtt:topic:mosquitto:Garage_innen:click"}