Zigbee2mqtt device(s) not appearing in hass

I’m a bit new to home assistant and all it’s magic. I’ve been working on and off on automating certain things at home. I recently bought a zigbee usb stick, flashed it with zigbee2mqtt firmware and installed the zigbee2mqtt addon. I’ve install mosquitto mqtt broker and all that works fine (atleast as far as I can tell).

I have had success pairing a device to the zigbee2mqtt usb stick, zigbee2mqtt is sending it’s sensor values according to the zigbee2mqtt log:

zigbee2mqtt:info 3/22/2019, 11:00:17 PM MQTT publish: topic ‘zigbee2mqtt/0x00158d0002d7781f’, payload ‘{“temperature”:23.48,“linkquality”:70,“humidity”:50.44,“pressure”:1024}’

But I cannot find the device in home assistant.

zigbee2mqtt configuration.yaml:

devices:
  '0x00158d0002d7781f':
    friendly_name: '0x00158d0002d7781f'
    retain: false
homeassistant: true
mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://homeassistant
permit_join: true
serial:
  disable_led: true
  port: /dev/ttyACM0

Am I missing something in a config?

Edit: I am running home assistant version 0.89

There are two ways for Home Assistant to consume the information produced by zigbee2mqtt.

Automatic discovery
There’s an option in zigbee2mqtt to have it publish the sensor data in a way that Home Assistant will detect and automatically add (to the entity registry) as new sensors.

Manual
You define each sensor manually in the configuration file. This is more work but gives you complete control over each sensor’s definition.

If you’re not currently using either method, the sensors will not appear in Home Assistant.

Someone else using zigbee2mqtt recently required fine-grained control over the sensor’s definition so I suggested they use the manual-configuration approach:

Thank you for your reply, I appreciate that.

I will look into doing it the manual way, sounds like a better option because of the control it offers.
As far as the automatic discovery, I have ‘discovery’ in hass’s configuration.yaml and ‘home assistant: true’ in zigbee2mqtt’s configuration.yaml, I assumed that would make home assistant discover the sensors/devices automatically. Is that assumption wrong?

Your assumption is correct.

If you are not seeing the sensors appear automatically in States page, then you should confirm zigbee2mqtt is successfully connecting to the MQTT broker.

For example, are you certain that server is set correctly here:

mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://homeassistant

Is the name of the machine hosting the MQTT broker simply called “homeassistant”?

Have you used an MQTT client to confirm the broker has topics beginning with zigbee2mqtt and homeassistant?

No I am not certain at all :frowning:
I installed the mosquitto addon and zigbee2mqtt connects to it. When I modify it to something that does not exist it returns ‘not connected’.

I installed a mqtt client (mqtt.fx for mac), as far as I can tell there’s no topics. However zigbee2mqtt addon is reporting it is posting to topic “MQTT publish: topic ‘zigbee2mqtt/0x00158d0002d7781f’, payload […]”

mosquitto addon log:
1553358994: New client connected from 172.30.32.1 as e79039fd-2b4b-4fa3-98f8-d971521a51db (c1, k60).
1553360263: New client connected from xxx.xxx.xxx.xxx as MQTT_FX_Client (c1, k60).

OK. I see from the logs that both Hass.io and MQTT.fx are connecting to the the MQTT broker (i.e. the mosquitto addon). The question is “Where’s the log entry for zigbee2mqtt’s connection to the broker?”

  • Use MQTT.fx to subscribe to all of zigbee2matt’s topics with zigbee2mqtt/#
  • Now do something to make your sensors change state so published fresh payloads.
  • Zigbee2mqtt should be posting log entries like “MQTT publish: topic ‘zigbee2mqtt/0x00158d0002d7781f’, payload […]”
  • At the same moment, you should be seeing those payloads appearing in MQTT.fx.

If you’re not seeing the payloads in MQTT.fx, then I can only conclude that zigbee2mqtt is not successfully connected to the MQTT broker.

Thank you so much for thinking with me. I managed to fix the issue.
I went back to the mosquitto broker addon documentation and noticed a warning:

Since version 4.1 of the addon, an explicit ACL definition is now required, see these instructions.

I followed the steps (I did not have the /share/mosquitto folder and files) and restarted the addon. Reconnected mqtt.fx and immediately got the topics.

1 Like

For some reason Home Assistant is not making a device. I checked all the steps

  • discovery: in configuration.yaml

  • “homeassistant”: true in Zigbee2mqtt Hass.io Add-on

  • a vibration sensor is paired to Zigbee2mqtt (I see log entries in the plugin)

  • Mosquitto is receiving the topics (I can see them with mqtt.fx)

  • a device is added to \share\zigbee2mqtt\device.yaml

 '0x00158d000313276b':
   friendly_name: '0x00158d000313276b'
   retain: false

BUT: the sensor is nowhere to find in Home Assistant. Nothing in the entity registry. Any tips? Should I do something to have Home Assistant hace access the mqtt?

Ok… fixed it. Saw this entry in the log:

2019-09-11 14:22:30 WARNING (MainThread) [homeassistant.components.mqtt] Data in your config entry is going to override your configuration.yaml: {'broker': 'core-mosquitto', 'discovery': False, 'password': 'cxxxxxxxxxxxxxx', 'port': 1883, 'protocol': '3.1.1', 'username': 'homeassistant'}

Something was wrong on the Home Assistant integrations page. So I deleted the mqtt integration there; removed the mqtt mosquitto addon, reinstalled it and then in integrations it detected my devices.