Zigbee2mqtt revisited: No more ugly transformations


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:


Thanks - works now perfectly.

1 Like

do you know how do i need to write it for textual configuragtion?
the last one that was working was: {“color”:{“hsb”: “%s”}}

i have set {“hsb”: “%s,%s,%s”}}, now i see 3 values:

but no mqtt message will be sent :frowning:

What device have you got?

Did you try adding the following to your channel?

formatBeforePublish="{\"color\":{\"hsb\": \"%s, %s, %s\"}}"

(just copied and updated from the linked post)

yes, this i smy thing konfiguration, but no mqtt message is send after i change the colour :confused:

Type string : color "Color" [ stateTopic="zigbee2mqtt/Osram_Livingroom/color-hsb", commandTopic="zigbee2mqtt/Osram_Livingroom/set/", formatBeforePublish="{\"color\":{\"hsb\": \"%s, %s, %s\"}}" ]

Just to check:

  • How are you changing the colour? If it’s a Sitemap, what’s your configuration?
  • How do you know an MQTT message isn’t sent? What are you using to monitor this?


I guess you need to change your Channel type to color, not string, and therefore your Item type to Color also. Here’s what just worked for me:

thing channel

Type color : color "Color" [
    formatBeforePublish="{\"color\":{\"hsb\": \"%s, %s, %s\"}}"


Color cColour "Colour" {channel="mqtt:topic:colourtest:color"}


Default item=cColour label="Colour"

When changing the colour on the sitemap widget, I see the following in MQTT Explorer:


So the MQTT message is sending!

1 Like

i use mqttfx to sniff the mqtt traffic, in one of the last oh2.5 updates the color was broken, so i have setup it like that and this was working in oh2.5 with a string, with color type and this formatbeforepublish it is now working in OH3 :slight_smile: Thank you

Thanks for fantastic instructions guys!
I was able to get all up and running and finally have my StelPro line voltage Zigbee thermostat fully integrated into Openhab (happy to share configuration if anybody is interested.)

At the same time I am having trouble controlling SmartThings outlet (model OTP04, should be similar to SmartThings IM6001-OTP05 control via MQTT | zigbee2mqtt.io ).
Device is configured in zigbee2mqtt, I can see and control it from mosquitto_pub (plus relevant log entries):

mosquitto_pub -h localhost -t "zigbee2mqtt/smartthings_plug/set/state" -m "ON"
Zigbee2MQTT:info  2020-12-30 11:25:52: MQTT publish: topic 'zigbee2mqtt/smartthings_plug/state', payload 'ON'
Zigbee2MQTT:info  2020-12-30 11:25:52: MQTT publish: topic 'zigbee2mqtt/smartthings_plug/linkquality', payload '108'
mosquitto_pub -h localhost -t "zigbee2mqtt/smartthings_plug/get/state" -m ""
Zigbee2MQTT:info  2020-12-30 11:24:10: MQTT publish: topic 'zigbee2mqtt/smartthings_plug/state', payload 'ON'

However trying to control or monitor it from openhab does not result in any activity. Here is what I have in .things:

Bridge mqtt:broker:MyMQTTBroker [host="localhost", secure=false] {
    Thing topic SmarthingsOutlet "SmartThings Outlet" @ "Family Room" {
            Type switch : state "state" [ stateTopic = "zigbee2mqtt/smartthings_plug/get/state", commandTopic = "zigbee2mqtt/smartthings_plug/set/state", on="ON", off="OFF" ]
            Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/smartthings_plug/linkquality" ] 
    // StelPro configuration is here...

And .items:

Switch Smarthings_Outlet_State "Smarthings Outlet State" {channel="mqtt:topic:MyMQTTBroker:SmarthingsOutlet:state"}
Number Smarthings_Outlet_Linkquality "Smarthings Outlet Linkquality" {channel="mqtt:topic:MyMQTTBroker:SmarthingsOutlet:linkquality"}

Any thoughts on what I am doing wrong?

Thanks all and Happy New Year, Vadim

change this to

`stateTopic = "zigbee2mqtt/smartthings_plug/state"`

The stateTopic is passive - won’t command anything in the get topic - so you need to subscribe to the main state topic to successfully receive the state.

But also: you may be hitting the bug where Things files aren’t properly loaded by openHAB after a save. Restart your openHAB for a quick fix, or do this.

1 Like

Thank you thank you thank you!
Combination of your suggested change and a restart did the trick, now all is working perfectly!

1 Like

Hey guys.
I’m desperate and need more eyes for this. I don’t understand what’s broken there.
I’m using zigbee2mqtt on my OH2.5 for some xiaomi devices and octoprint server. Everything works fine. Now I’m trying to set up OH3. So I did copy of my items and things files for new OH3 version. mosquitto works fine. I’m able co connect and I can see topics. But I don’t understand why I have everywhere NULL values in zigbee Items.

I’m using same bridge for zigbeemqtt and octoprint server, and octoprints channels works just fine. There are correct values in items. But zigbee devices not.
log from zigbee2mqtt looks also ok:

Any idea what I have wrong there?

Ok, it seems working after few hours :confused: