I’m a bit out of options, so I hope someone else can explain what I’m doing wrong.
Currently running openHabian 3.4.2. with Mosquitto MQTT broker and Zigbee2MQTT, everything is working fine expect for one thing.
It paired correctly with Zigbee2MQTT, so I gave it a friendly name and added it to my thing file like the documentation describes, the thing looks like this:
Thing topic socketPower1 "socketPower1" {
Channels:
Type switch : power "Power" [ stateTopic="zigbee2mqtt/socketPlug1/get", transformationPattern="JSONPATH:$.state", commandTopic="zigbee2mqtt/socketPlug1/set", on="ON", off="OFF" ]
}
The command part of the thing is working correctly, I can switch it to ON and OFF via openHab, but when I toggle the switch with the physical button or in the Zigbee2MQTT webgui, it doesn’t get updates in openHab. When I connect with a tool called MQTT Explorer to the MQTT broker, I can see the sates changing from OFF to ON.
Ok, really strange, I commented the thing lines out so the thing would get deleted. Then I added the thing as you said through the user interface and configured it exactly the same and everything was working (also the update from zigbee2mqtt to openHab).
Then I deleted everything again in the user interface, uncommented all the lines again, saved it and now everything is also working from the thing file
If anybody ever wonders, the thing now looks like this:
Thing topic socketPower1 "socketPower1" {
Channels:
Type switch : power "Power" [ stateTopic="zigbee2mqtt/socketPlug1", transformationPattern="JSONPATH:$.state", commandTopic="zigbee2mqtt/socketPlug1/set" ]
}
So, indeed you don’t need to place the get statement at the end of the topic.