MQTT - Paper UI - Incoming Value Transformation

The following assumes that nothing has previously been setup via PaperUI - having duplicate things and items causes all sorts of confusion. I would recommend getting rid of all things and items created using PaperUI!

Enable attribute output from zigbee2mqtt

Configure zigbee2mqtt so that it outputs strings, rather than JSON: Zigbee2mqtt revisited: No more ugly transformations

In short, add the following to the end of your zigbee2mqtt configuration.yaml:

experimental:
  output: attribute

Create a bridge to your MQTT broker

Create a file in your things folder called bridge.things. Add the following (I’m assuming you’re using Mosquitto):

Bridge mqtt:broker:MosquittoMqttBroker "Mosquitto MQTT Broker" [
	host="192.168.86.10",
	secure=false,
	port=1883,
	clientID="OpenHAB2"
]

Create things and channels to the devices

Create a file in your things folder called zigbee.things. Add the following into it (there’s a bit of guessing involved on my part, but this should be close!):

Thing mqtt:topic:sw001 "WXKG01LM switch" (mqtt:broker:MosquittoMqttBroker) {
    Channels:
        Type string : click "Click" [
            stateTopic = "zigbee2mqtt/001/click"
        ]
        Type number : battery "Battery level" [
            stateTopic = "zigbee2mqtt/001/battery"
        ]
        Type number : linkquality "Link quality" [
            stateTopic = "zigbee2mqtt/001/linkquality"
        ]
}

Thing mqtt:topic:swLEDPanel "LEDPanel" (mqtt:broker:MosquittoMqttBroker) {
    Channels:
        Type switch:switch "Power Switch" [
			stateTopic="zigbee2mqtt/006/state", 
			commandTopic="zigbee2mqtt/006/set",
			on="ON",
			off="OFF"  
		]
	    Type dimmer:dimmer "Dimmer" [
			stateTopic="zigbee2mqtt/006/brightness",
			commandTopic="zigbee2mqtt/006/set/brightness", 
			min=0, 
			max=255, 
			step=1
		]
}

Create items

Create a file in your items folder called zigbee.items. Add the following into it:

String str001Click "Click" {channel="mqtt:topic:sw001:click"}
Number n001Battery "Battery" {channel="mqtt:topic:sw001:battery"}
Number n001LinkQuality "Link Quality" {channel="mqtt:topic:sw001:linkquality"}

Switch sLEDPanel "LEDPanel Light" { channel="mqtt:topic:swLEDPanel:switch" }
Dimmer dLEDPanel "LEDPanel dimmer" {channel="mqtt:topic:swLEDPanel:dimmer"}