Zigbee2mqtt revisited: No more ugly transformations

Finallly I found the time to upgrade to openHAB 2.5.5-1 (Release Build). And there we are, I also got your warning message. For me it is unbelivable, that they put so much change into a 0.0.1 Release update. But this is not the right place to discuss that topic.

I changed my whole configuration from:

Thing topic:mqtt:myMQTTThing "Description" @"room" {...}


Thing topic myMQTTThing "Description" @"room" {...}

and in the item file I changed from:

ItemType MyItemName  "My Item description/text" <icon> {channel="mqtt:topic:myMQTTThing:occupancy" }


ItemType MyItemName  "My Item description/text" <icon> {channel="mqtt:topic:NAME_MQTT_BROKER:myMQTTThing:occupancy" }

@tv-arnd Thanks for your hint. And now of course I will also change the nomenclature on the zigbee2mqqt.io website.

I already changed my documentation on MCCGQ01LM to the OpenHAB preferred nomenclature.

1 Like

Has someone a solution to dimm Tradfri Bulbs?

By using brightness? On openhab side either use a slider or a color item. Both must simply send the brightness to zigbee2mqtt

See here: Zigbee2mqtt revisited: No more ugly transformations

1 Like

Thank you, now its working, i missed this post :slight_smile:

Here is an example how to monitor presence of the Zigbee-bridge - similar to the network-binding (ping to detect presence).
What you get:
Find everything here (rename to zip): zigbee-bridge_monitoring.zip.pdf (3.3 KB)

If you take a look at the MQTT-Explorer, the bridge has a state (online / offline):
This requires some mappings and renamed icons.


Bridge mqtt:broker:MyMQTTBroker [host="localhost", secure=false] {

// Texas Instruments ZigBee to MQTT board
Thing topic bridge "TI ZigBee Bridge " @ "Your Room" {
            Type contact : state "state"            [ stateTopic = "zigbee2mqtt/bridge/state", off="offline", on="online" ] // online=on=open, offline=off=closed       


    // TI ZigBee to MQTT board
        Contact ZigBeeBridge_state "ZigBee Bridge (TI CC1352P) [MAP(contact_online.map):%s]" <myswitch> {channel="mqtt:topic:MyMQTTBroker:bridge:state"} // use modified switch-icon for contact with open/closed

transformation-file (contact_online.map)



sitemap default label="Home" {
Frame label="Network Monitoring" {
        Text item=WiFi_AP                   icon=switch  // just as an example for a ping-device
        Text item=PhilipsHUE_ZigBeeBridge   // just as an example for a ping-device
        Default item=ZigBeeBridge_state // use myswitch icon

This nicely detects unplugging the bridge from USB-port (and its re-connect). Very fast.
Can be used in a section together with ping-devices (same icon / status-text appearance).


This is a long and useful topic! This may be more of a Zigbee2MQTT question but how do we find out all the available options that something like a Hue RGB bulb has?

I am used to my Xiaomi sensors and sockets which seem to broadcast their current status. Am I right in saying the HueBulbs don’t broadcast their current state and settings?

What I do with a new Zigbee device, after pairing with zigbee2mqtt, is use MQTT Explorer to ‘sniff’ what the new device parameters are.

Sometimes you’ll also have to command the device to see what the ‘extra’ parameters are, such as double or triple button presses, though I don’t know if that’s necessary for a bulb.

1 Like

Yeah that’s what I do with my sensors… But with the Hue Bulbs I don’t have a hue hub or remote so now way to control the bulbs except for using Zigbee2MQTT…

Look for your device in this table - it includes the modes (and therefore the commands) which are supported.

Either way, surely when you turn your bulb on (as in, supply it with power), it will initially communicate with zigbee2mqtt, and therefore you’ll be able to pick up most parameters?

Yeah that was what I thought, but all I see in the Zigbee2MQTT logs is the bulb “announcing” itself… It doesn’t send anything else about itself…

Ah, but I was on about using something like MQTT Explorer or mqtt.fx to do the sniffing, not looking in the zigbee2mqtt logs…

I’ve never used Hue bulbs, so they may be different, but I’ve used this method successfully for two different types of IKEA Tradfri bulbs.

I also have an Osram RGBW Bulb but unfortunately, your solution doesn’t work for me :frowning:

I have set the same “formatBeforePublish” pattern but only the first value of the color state is being published. For example the color state is 230,100,100 then only 230 is inserted as the %s inside the format.

I just found the solution:
When we have a comma separated string, the first %s in the format represents the first value, the second %s the second and so on.
Example (you can set the outgoing value format via PaperUI and it will do the necessary escapes for you):
color state: 230,100,100
outgoing value format: {"color": {"hsb": "%s"}}
result: {"color": {"hsb": "230"}}
… doesn’t work!

outgoing value format: {"color": {"hsb": "%s,%s,%s"}}
result: {"color": {"hsb": "230,100,100"}}
… exactly what we need :slight_smile:

I also made a pull request to update the readme of the mqtt-binding.



I have a problem can you help ? about

  • Osram SmartPlug thing:

    Thing topic SZLV “SZLV” @ “SZ”

can you tell me why when i remove this from the line it works " @ “SZ”` "

i dont know were to find any thing about it ,becourse i dont know what it do ?

I hope you can help Simon . :slight_smile: I know it`s a mqtt thing problem but ?

PS : can you show some of your zigbee sitemap ? i have it working i paperui and shows up in log fine ,but i can`t get anything to show up on sitemap ??


Does anybody know why in sitemap i have values but no values in the app on android ??

Normal sitemap :

Android phone :

What happens if you tap on one of the names in the app? What is your Sitemap configuration?

Nothing happens when i push the lines ,its like its just a txt line and whit no values ?
maybe its a rookie mistake but i cant find any thing about it ,and it dose work on computer only not in app , not even the switch is there ???

    Frame label="sensor_1" icon="button" {	
Switch item=mqtt_topic_sensor_1_sensor_1_Occupancy    icon=switch              label="sensor_1 : [%s]"  valuecolor=[==ON="#a9f7b8", ==OFF="#f8a9ad"]
Text   item=mqtt_topic_sensor_1_sensor_1_battery      icon="battery"           label="Battery [%.0f %%]"
Text   item=mqtt_topic_sensor_1_sensor_1_voltage      icon="battery"           label="Voltage [%.0f mV]" 
Text   item=mqtt_topic_sensor_1_sensor_1_linkQuality  icon="qualityofservice"  label="Link quality [%.0f]" 

	Frame label="sensor_2" icon="button" {	
Switch item=mqtt_topic_sensor_2_sensor_2_Occupancy    icon=switch              label="sensor_2 : [%s]"  valuecolor=[==ON="#a9f7b8", ==OFF="#f8a9ad"]
Text   item=mqtt_topic_sensor_2_sensor_2_battery      icon="battery"           label="Battery [%.0f %%]"
Text   item=mqtt_topic_sensor_2_sensor_2_voltage      icon="battery"           label="Voltage [%.0f mV]" 
Text   item=mqtt_topic_sensor_2_sensor_2_linkQuality  icon="qualityofservice"  label="Link quality [%.0f]" 

	Frame label="Bar skab" icon="button" {	
Switch item=mqtt_topic_door_contact_1_door_contact_1_contact       icon=switch               label="Bar skab : [%s]"  mappings=[ON="Lukket", OFF="AAben"] valuecolor=[==ON="#a9f7b8", ==OFF="#f8a9ad"]
Text   item=mqtt_topic_door_contact_1_door_contact_1_battery       icon="battery"            label="Battery [%.0f %%]"
Text   item=mqtt_topic_door_contact_1_door_contact_1_voltage       icon="battery"            label="Voltage [%.0f mV]"
Text   item=mqtt_topic_door_contact_1_door_contact_1_linkQuality   icon="qualityofservice"   label="Link quality [%.0f]" 

	Frame label="Slik skab" icon="button" {	
Switch item=mqtt_topic_door_contact_2_door_contact_2_contact       icon=switch               label="Slik skab : [%s]"  mappings=[ON="Lukket", OFF="AAben"] valuecolor=[==ON="#a9f7b8", ==OFF="#f8a9ad"]
Text   item=mqtt_topic_door_contact_2_door_contact_2_battery       icon="battery"            label="Battery [%.0f %%]"
Text   item=mqtt_topic_door_contact_2_door_contact_2_voltage       icon="battery"            label="Voltage [%.0f mV]"
Text   item=mqtt_topic_door_contact_2_door_contact_2_linkQuality   icon="qualityofservice"   label="Link quality [%.0f]" 

Frame label="termostat_1"                                   icon="temperature" {
Text item=mqtt_topic_termostat_1_termostat_1_temperature   
Text item=mqtt_topic_termostat_1_termostat_1_humidity
Text item=mqtt_topic_termostat_1_termostat_1_Voltage        icon="battery"           label="Voltage [%.0f mV]"
Text item=mqtt_topic_termostat_1_termostat_1_linkQuality    icon="qualityofservice"	 label="Link quality [%.0f]" 
Text item=mqtt_topic_termostat_1_termostat_1_Battery        icon="battery"           label="Battery [%.0f %%]" 
		Frame label="termostat_2" icon="temperature" {
Text item=mqtt_topic_termostat_2_termostat_2_temperature 
Text item=mqtt_topic_termostat_2_termostat_2_humidity
Text item=mqtt_topic_termostat_2_termostat_2_Voltage label="Voltage [%.0f mV]" icon="battery"
Text item=mqtt_topic_termostat_2_termostat_2_linkQuality label="Link quality [%.0f]" icon="qualityofservice"	
Text item=mqtt_topic_termostat_2_termostat_2_Battery label="Battery [%.0f %%]" icon="battery"
	Frame label="click_1" icon="button" {	
Switch item=mqtt_topic_click_1_click_1 icon=switch label="click 1 : [%s]"  valuecolor=[==ON="#a9f7b8", ==OFF="#f8a9ad"]
Text item=mqtt_topic_click_1_click_1_Reachable label="Button switch [MAP(switch2online.map):%s]" icon="wallswitch" valuecolor=["ON"="green", "OFF"="red", "NULL"="red", "-"="red"]
Text item=mqtt_topic_click_1_click_1_Battery label="Battery [%.0f %%]" icon="battery"
Text item=mqtt_topic_click_1_click_1_Voltage label="Voltage [%.0f mV]" icon="battery"
Text item=mqtt_topic_click_1_click_1_LinkQuality label="Link quality [%.0f]" icon="qualityofservice"
Text item=mqtt_topic_click_1_click_1_Click label="Last click action [%s]"
Text item=mqtt_topic_click_1_click_1_ClickDuration label="Last long click duration [%.0f]" icon="time"

Is that your whole sitemap? Can you post the whole thing, in-between code fences?


In here like this
And like this


Do your Item names really repeat like termostat_2_termostat_2.

This should really be a separate thread: @moderators could we split from post 143?

Has anybody a working config for the Aqara Vibration Sensor - for whatever reason I fail.

Sure, but it won’t help you much as mqtt channel names are individual:

Number Xia_Vibr_01_Battery "Vibration Sensor [%d %%]" <battery> { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-battery" }
Number Xia_Vibr_01_Linkquality "Vibration Link [%d]" <qualityofservice> { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-linkquality" }
DateTime Xia_Vibr_01_lastseen "Vibration Lastseen [%1$td.%1$tm.%1$tY %1$tH:%1$tM]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-last_seen" }
Number Xia_Vibr_01_Angle "Vibration Angle [%d]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-angle" }
Number Xia_Vibr_01_Angle_X "Vibration Angle X [%d]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-angle_x" }
Number Xia_Vibr_01_Angle_Y "Vibration Angle Y [%d]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-angle_y" }
Number Xia_Vibr_01_Angle_Z "Vibration Angle Z [%d]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-angle_z" }
Number Xia_Vibr_01_Angle_X_abs "Vibration Angle X abs [%d]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-angle_x_absolute" }
Number Xia_Vibr_01_Angle_Y_abs "Vibration Angle Y abs [%d]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-angle_y_absolute" }
Number Xia_Vibr_01_Strength "Vibration Stärke [%d]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-strength" }
String Xia_Vibr_01_Action "Vibration Aktion [%s]" { channel="mqtt:topic:xia-vibration-01:aquara-vib-01-action" }

Edit: Here is an example for the action channel: