Zigbee2mqtt revisited: No more ugly transformations

Tags: #<Tag:0x00007fc20e93f968> #<Tag:0x00007fc20e93f490> #<Tag:0x00007fc20e93f378>

Ahh, you were right. I’m on 2.4 and it works fine after restart.
Thanks, I didn’t know about that bug.

Thanks Joachim,
I followed your example on the Aqara water sensor( i have the same one), and my voltage reading is 3115 in Paper UI. Is there anything I may have misseD?

Why? It’s fine. 3115 mV = 3.1 V.

I see. Then no issue then. Thanks.

Hi guys,

I’ve managed to succesfully get Zigbee2mqtt working thanks to the information in the OP. Although, I have noticed since I’ve installed Zigbee2mqtt fronttail seems not to work. I can get it to work by going to settings and forcing it after reinstall.

I think this may be down to node.js? Anyone else experienced this or know why this may be?

many thanks,

Please, can you share your map file?

Nothing spectacular, nevertheless added to first post.

Hi Andrew i am sorry for the late reply.

  1. First you have to create an Generic MQTT Thing with the MQTT Binding. (you need to add it manually – openhab won´t find anything by itslef)
    The only configuration you have to do, is to choose the Bridge in section " Bride selection" there you choose your MQTT Broker.

  2. Secound step: create Channels for you created generic MQTT Thing.
    The configuration should be done like you can see in this Screenshot:

    in field MQTT state topic you choose the MQTT output from your jorunal, in my case “zigbee2mqtt/MS_IKEA_1”
    in field incoming value transformation you need to type in JSONPATH:$. and the value you want to transform, in my case: JSONPATH:$.occupancy, because i am using a motion sensor.

  3. After you create a channel you will be able to create an item, after this, everything works like you now it from openhab.

Hope this helps you, if you have further questions just ask :slight_smile:


1 Like

@chriswooo: This whole topic is about attribute output of zigbee2mqtt, in order to get rid of the transformations. :confused: It looks like you missed setting zigbee2mqtt to attribute output.

Please, @epicurean, Did you manage it with ikea bulb?
I’m stil looking for as I get tue same hw and different try produced no result
For ex. standing mybulb/brightness as a action topic

I configured the Ikea bulbs in things with transformation (the old fashion way). Based on one of the examples in this forum

1 Like

Nice one. Works like a charm. Thanks a lot :+1:

Hi everybody,

thanks to the instructions of @job I managed to get most of my zigbee devices working without any problems.

Now I’m stuck on the Xiaomi door contact sensors.

The contact are paired correctly and send “true” or “false” to the mqtt broker. I verfied this with the help of MQTT.fx.

Here is my item file:

Bridge mqtt:broker:myBroker [ host="localhost", secure=false, username="openhabian", password="openhabian" ]
    Thing topic Xiaomi_Switch "Xiaomi_Switch" @ "Wohnzimmer"
            Type string : click "click" [ stateTopic = "zigbee2mqtt/0x00158d00021366e0/click" ]
            Type number : voltage "voltage" [ stateTopic = "zigbee2mqtt/0x00158d00021366e0/voltage" ]     
            Type number : battery "battery" [ stateTopic = "zigbee2mqtt/0x00158d00021366e0/battery" ]     
            Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/0x00158d00021366e0/linkquality" ] 

Thing topic Xiaomi_Motion "Xiaomi Bewegungsmelder"  @ "Flur"
        Type switch : occupancy "occupancy" [ stateTopic = "zigbee2mqtt/0x00158d0002ec80c6/occupancy", on="true", off="false"  ]
        Type number : illuminance "illuminance" [ stateTopic = "zigbee2mqtt/0x00158d0002ec80c6/illuminance" ]            
        Type number : voltage "voltage" [ stateTopic = "zigbee2mqtt/0x00158d0002ec80c6/voltage" ]     
        Type number : battery "battery" [ stateTopic = "zigbee2mqtt/0x00158d0002ec80c6/battery" ]     
        Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/0x00158d0002ec80c6/linkquality" ]     

    Thing topic Contact_Terrasse_Rechts "Kontakt Terasse Rechts" @ "Wohnzimmer" 
            Type contact : Status "State" [ stateTopic = "zigbee2mqtt/0x00158d00026ede72/contact", open = "false", closed = "true" ]
            Type number : voltage "voltage" [ stateTopic = "zigbee2mqtt/0x00158d00026ede72/voltage" ]     
            Type number : battery "battery" [ stateTopic = "zigbee2mqtt/0x00158d00026ede72/battery" ]     
            Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/0x00158d00026ede72/linkquality" ]


When I open a windows the log show:

[WARN ] [ab.binding.mqtt.generic.ChannelState] - Command 'false' not supported by type 'OpenCloseValue': No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.false

I also tried to do the transformation from false to open and true to closed via a map file, but without success.

The transformation on the Xiaomi Motion Detector works without any problems.

Any ideas?

Show us

I removed that already completely. The map file looked like this:


The question is why the motion sensor is working and the window contact is not. The item definition is exaclty the same.

You need a Contact itemtype, not a Switch itemtype.

switch itemtype for the motion detector is correct and it works.

The contact itemtype for the windows sensor is not working.

The other way around…


Wrong quote, sorry:

Contact Xia3_WindowSwitch_Status (gRestore) { channel="mqtt:topic:aquaradw-01:aquaradw-01-contact" }

You need a Contact itemtype for your Xiaomi door contact sensor.


That’s what I did.

            Type contact : Status "State" [ stateTopic = "zigbee2mqtt/0x00158d00026ede72/contact", open = "false", closed = "true" ]