Help needed - Zigbee2mqtt - strange things happen

Hi there …

After successfully playing with ZHA/Elelabs Zigbee Shield I wanted to try this popular CC2531/Zigbee2mqtt “Bridge”.

As with my working ZHA I have a new RPi/Hass.Io and latest HA 0.85.1. I think I successfully followed the instructions flashing the CC2531. I only allowed some system monitoring to new installation. I added Samba and SSH and then followed:

https://github.com/danielwelch/hassio-zigbee2mqtt

I thought everything was supposed to be straight forward. MQTT showed to the UI. ZigBee2mqtt log doesn’t look good (last line):

image

Missing “Bridge State”:
image

Not sure which port I should use /dev/ttyAMA0 or /dev/ttyACM0 (Tried both - no luck)

So nothing happens and I cannot pair anything. The worst part is memory usage which went immediately sky high.
And immediately after uninstall the Zigbee2mqtt memory usage is back to normal.

image

Any direction what to do now :wink:

That log entry from Zigbee2MQTT is the same one I get when the wrong USB serial device is chosen.

Assuming you’re using HassIO, go to the “Hass.IO” screen, then choose “System” at the top, then under “Host system” click “Hardware”.

You should see a list of all connected devices there. I would remove the C2531 from the system, restart, see what devices you have connected. Make a note of them. Then reconnect the CC2531 and do the same process and the new device that showed up will be the proper name to use within the plugin’s configuration page.

Thanks a lot!

That helped a bit forward; right port is /dev/ttyACM0

You can see MQTT at least exists:

image

But now the result is:
zigbee2mqtt:error 2019-1-21 21:37:21 Not connected to MQTT server!

image

What shall we do now?

Everything there except the MQTT error seems normal, so I would say that the addon is functioning properly, it just can’t see your MQTT broker.

So the question now is, how is your MQTT broker set up?
In your config for the Zigbee2MQTT addon, you should have " mqtt_server" set, at a minimum, and if do not have anonymous access enabled on your broker you’ll also have to have “mqtt_user” & “mqtt_pass” set.

For example, in my config for the Zigbee2MQTT addon config is:

{
  "data_path": "/share/zigbee2mqtt",
  "homeassistant": true,
  "permit_join": false,
  "mqtt_base_topic": "zigbee2mqtt",
  "mqtt_server": "mqtt://XXX.XXX.XXX.XXX:1883",
  "mqtt_user":"USER",
  "mqtt_pass":"PASS",
  "serial_port": "/dev/ttyACM1"
}

Thanks again!

My bad but couple stupid questions here:

As MQTT was discovered and just jumped there I really do not know too much about what is needed to config there.

I assume that I use my local RPi IP address here as:

“mqtt_server”: “mqtt://192.168.0.xxx:1883”,
I tried:
“mqtt_server”: “mqtt://homeassistant”,
I tried:
“mqtt_server”: “mqtt://homeassistant:1883”,

Did not work …

Than I added exactly:
“mqtt_user”:“USER”,
“mqtt_pass”:“PASS”,

I also tried my HA user/pass -> no luck

I do not know where to set the MQTT user/pass?

Sorry for my stupidity here

A bit more of this MQTT - I think it was discovered based on these three lines in my configuration.yaml?

That is all I have done for that - should I do something else to config that?

mqtt:
  broker: homeassistant
  discovery: true

So how did you add MQTT to your system? Do you already use MQTT for things and it works?

I know you said it was auto-discovered to add to HA, but an MQTT broker isn’t installed by default in HA unless that changed VERY recently.
Usually people install one of the two MQTT addons from the addon store. Either the “Mosquitto broker” or “MQTT Server & Web client”.

For the first one, the configuration (allow anonymous & configure user/pass) is set in the addon configuration. For the second one, I’m not sure as I don’t use it.

For example, I have the “mosquitto broker” addon installed for MQTT, with the following config:

{
  "logins": [
    {
      "username": "USER1",
      "password": "PASS1"
    },
    {
      "username": "USER2",
      "password": "PASS2"
    }
  ],
  "anonymous": false,
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

You were faster - my reply is in earlier message. I suppose as having this:

image

there is a MQTT provided by HA? But I am really not sure.

No, that’s just a page to manually send data over MQTT, it doesn’t necessarily mean it’s connected to a broker. You can try it and see if you get an error in the logs about a broker not being available or connected.

I would just go ahead and install the Mosquito broker and proceed from there.

I installed Mosquito and now it looks better. However as you see “permit join” is seen - I tried with my IKEA bulb and nothing happened.

I have to continue tomorrow. Here is night - I have to get some sleep before to start workday again …

Next time you give it a shot, read through theIKEA specific pairing section of the Zigbee2MQTT docs.

Thanks again!

That is basically exactly what I did - like I said I just started with this zigbee2mqtt with opening the box of brand new RPi. Before that I have Elelabs Zigbee Shield/ZHA working very well in another RPi taking care of lights, heating and security with 31 devices including around 10 different kind of IKEA Trådfri Bulbs. Pairing in ZHA with Ikea is exactly same from Ikea side. After resetting the bulb actually blinks shortly to inform reset is OK and it is ready for pairing.

Later today I will try again - also with other zigbee devices … I will report after that - and probably need help once again :wink:

About the question of mqtt broker in HA:

https://www.home-assistant.io/docs/mqtt/broker/

To be honest that looks like there is a MQTT link inside the HA. I am just not too expert to say anything here :wink:

Yep, that’s what it looks like. Huh, learn something new every day I guess… lol

It looks like there are some features missing from HBMQTT as well as a bug or two, so it still makes sense to use an external broker such as Mosquito IMHO, but it’s good to know there are other options.

Hi again!

OK - it is time to hassle again. Because of curiosity I first removed Mosquitto to test that Hassio easy integration:

image

Not easy for me - I did not find any instructions what to fill and try/error method did not work … back to Mosquitto then

devices:
  '0x7cb03eaa00a73cc7':
    friendly_name: '0x7cb03eaa00a73cc7'
    retain: false

So pairing was now successful - Osram Smart+ Plug joined the mesh …

image

Once again - many thanks! BTW anyone has a good solution as enclosure for CC2531?

Awesome! Progress!

So do you see that long ass payload it sent (in your screenshot) to the topic “homeassistant/” ? That’s the payload for autodiscovery that will create the entity automatically.

When you initially configure the MQTT integration in home assistant, if you did it through the UI there should have been a checkbox to enable discovery, or if you did it via YAML there’s a setting for that i believe.

If you have autodiscovery enabled for MQTT, HA should see that payload sent to the “homeassistant/” topic and automatically add an entity based on that.

Alternatively, you can read through that discovery payload yourself and manually create an entity based on what it’s telling you would have been configured by autodiscovery.

OK - many thanks!

I have to give one last update here. Just not to mislead anybody.

As being a bit stubborn I wanted to give that “native” HA mqtt another chance.

I got rid of Mosquitto and tried with embedded MQTT broker. It finally worked fine.

Missing part was password.

I still would like to get good solution for protection of CC2531. I am not so sure about those 3D printed enclosures. If nothing else, could just heat shrink tube work?

Hey guys, I managed to discover my Xiaomi Aqara temperature sensor and I can see it in zigbee2mqtt configuration.yaml file. I can’t however see it on the GUI, where do Zigbee devices show up? are they meant to show up on the dashboard?

1 Like