MQTT Sensors not showing up

Hello everyone, I’ve been strugeling with HA for a couple of weeks now and finaly got zigbee2mqtt working. Well I thought I got it working but I didn’t. I’ve got my Aqara temperature sensor connected to zigbee2mqtt with a cc2531 and use cloudmqtt because I was’nt able to configure the mosquitto addon. zigbee2mqtt logs messages from the sensor so I treid to add them to the configuration.yaml.

Zigbee2mqtt log.

  zigbee2mqtt:info 6/26/2019, 9:18:06 PM Succesfully reenabled joining
  zigbee2mqtt:info 6/26/2019, 9:19:09 PM MQTT publish: topic 'zigbee2mqtt/0x00158d000346c385', payload '{"temperature":25.28,"linkquality":118,"humidity":56.53,"pressure":1027,"battery":100,"voltage":3075}'
  zigbee2mqtt:info 6/26/2019, 9:19:09 PM MQTT publish: topic 'zigbee2mqtt/0x00158d000346c385', payload '{"temperature":25.28,"linkquality":118,"humidity":57.66,"pressure":1027,"battery":100,"voltage":3075}'
  zigbee2mqtt:info 6/26/2019, 9:19:09 PM MQTT publish: topic 'zigbee2mqtt/0x00158d000346c385', payload '{"temperature":25.28,"linkquality":118,"humidity":57.66,"pressure":1027,"battery":100,"voltage":3075}'

Configuration.yaml.


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

script: !include scripts.yaml

mqtt:
 broker: m24.cloudmqtt.com
 port: 10508
 username: username
 password: password
 certificate: auto
 discovery: true
# 
  
sensor:
  - platform: "mqtt"
    name: "Temperature"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "°C"
    device_class: "temperature"
    value_template: "{{ value_json.temperature }}"

sensor 2:
  - platform: "mqtt"
    name: "Humidity"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "%"
    device_class: "humidity"
    value_template: "{{ value_json.humidity }}"

sensor 3:
  - platform: "mqtt"
    name: "Perssure"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "hPa"
    device_class: "pressure"
    value_template: "{{ value_json.pressure }}"

sensor 4:
  - platform: "mqtt"
    name: "Sensor Battery"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "%"
    device_class: "battery"
    value_template: "{{ value_json.battery }}"

sensor 5:
  - platform: "mqtt"
    name: "Signal"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "-"
    value_template: "{{ value_json.linkquality }}"

While trying to add the sensors repeatedly, I got new entries. The last 5 were suddenly there, without me being able to remove them.


hopefully I just made some stupid mistake that is easy to resolve.

use discovery

Thank you for the reply. Which discovery do you mean, MQTT Discovery or zigbee2mqtt?

Zigbee2mqtt discovery works via mqtt discover, as you can read in the clear documentation.
https://www.zigbee2mqtt.io/integration/home_assistant.html

1 Like

thank you very mutch!

For anyone with the same problem, this is what my coinfiguration.yaml ended up looking like.

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml

mqtt:
  broker: m24.cloudmqtt.com
  port: 10508
  username: USERNAME
  password: PASSWORD
  discovery: true
  birth_message:
   topic: 'hass/status'
   payload: 'online'
  will_message:
   topic: 'hass/status'
   payload: 'offline'
 #discovery_prefix: homeassistant

   
sensor:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    unit_of_measurement: "°C"
    device_class: "temperature"
    value_template: "{{ value_json.temperature }}"

sensor 2:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "%"
    device_class: "humidity"
    value_template: "{{ value_json.humidity }}"

sensor 3:
  - platform: "mqtt"
    state_topic: "zigbee2mqtt/0x00158d000346c385"
    availability_topic: "zigbee2mqtt/bridge/state"
    unit_of_measurement: "hPa"
    device_class: "pressure"
    value_template: "{{ value_json.pressure }}"

1 Like