The device runs tasmota and uses Zigbee2Tasmotaconfiguration is done on web interface 10.10.120.30
Tasmota
These only apply reading sensors, commands are not covered.
Pair new devices via WebUI.
Tasmota commands are case sensitive.
Each device will get a 16-bit integer eg 0x127C, also known as it’s short address. It can be renamed, however the short-address will still be the same
ZBName 0xB743, Friendly-name
The name will be reflected, to get list of devices
ZBStatus
ZBInfo{"ZbStatus1":[{"Device":"0x127C"},{"Device":"0xB743","Name":" SNZB-02"},{"Device":"0x6841"},{"Device":"0x98B4"}]} //ZBStatus
{"ZbInfo":{"0x127C":{"Device":"0x127C" ,"Temperature":23.03 ,"Humidity":56.29 ,"Reachable":true ,"BatteryPercentage":47,}}} //ZBInfoZBInfosends the last sensor attributes and in the same topic asZBReceivednormal data but it has a key ofZbInfoinstead
TheZBReceivedmessage can be flipped via
SetOption 83 1 - 1, the friendly name become the key
- 0, the short addr become the key
{"ZbReceived":{"0xB743":{"Device":"0xB743","Name":" SNZB-02","MQTT
To send a message
Publish topic/endpoint payloadFor better organize the MQTT topics
SetOption 89 1
SetOption 112 1- option 89 changes the MQTT topic from
SENSORinto<dev_name>/SENSORmaking it easier to separate devices - option 112 uses friendly name rather than 16-bit integer in MQTT topic
- after
83,89,112, the MQTT topic now become<friendly_name>/SENSORwith json keys of['ZbReceived']['<friendly_name>']
The default MQTT topic is

- after
- by default the full topic is
/telewhich is the prefix and./bridge_tasmota_%06Xwhich is the device name of the bridge
Home Assistant MQTT configuration
When separating the topic by devices now, all devices won’t send everything all in SENSOR, each MQTT device only need to listen to it’s specific topic, reducing log spam when Home Assistant tries to query the MQTT topic for a device/attribute but instead receives another one.
The MQTT topics layout are as such with a ZbReceived json
tele/bridge/<friendly_name>/SENSORDefault MQTT Template
- sensor:
- name: "Tuya Temperature"
unique_id: zb_tuya_temperature
object_id: tuya_temperature
state_topic: &tuya_state_topic "tele/bridge_tasmota_2D251C/Tuya-Sensor/SENSOR"
value_template: "{{ value_json.ZbReceived['Tuya-Sensor'].Temperature if 'Temperature' in value_json.ZbReceived['Tuya-Sensor'] else states('sensor.tuya_temperature') }}" # assume last value
device_class: "temperature"
expire_after: 86400
unit_of_measurement: "°C"
device: &tuya_device_info
identifiers: [tuya_0x127C]
configuration_url: http://10.10.120.16:1883
manufacturer: Tuya
model: "0x127C"
name: "Tuya Temperature and Humidity Sensor"
icon: mdi:thermometerobject_idcorrespond toentity_idin UIstate_topicis the path to MQTT message- the & syntax makes it reusable if a device has multiple entities
state_topic: &tuya_state_topic "tele/bridge_tasmota_2D251C/Tuya-Sensor/SENSOR"
state_topic: *tuya_state_topicvalue_templatedetermine an entity’s value based on MQTT message (in zigbee tasmota, it’s JSON)- since ZB devices do not send the full payload with all attributes every time, the template check whether the key exists in JSON first otherwise assume last value (if that failed, it become unavailable and error in log)
value_template: "{{ value_json.ZbReceived['Tuya-Sensor'].Temperature if 'Temperature' in value_json.ZbReceived['Tuya-Sensor'] else states('sensor.tuya_temperature') }}" # assume last value- change
Tuya-Sensorwith name of devices inZBNameandtuya_temperaturewith the current entity
More configuration options https://www.home-assistant.io/integrations/sensor.mqtt/