Zigbee2mqtt: getting rid of your proprietary Zigbee bridges (Xiaomi, Hue, TRADFRI)

You define a user and password for zigbee2mqtt, but not for mosquitto ?

1 Like

thanks for the point. I did it for both.
I installed the mosquitto broker new. Now i got an login and i´m a step forward.

thanks…

If you still have the issue - this is what actually helped in my case:
https://www.zigbee2mqtt.io/integration/home_assistant.html

I basically needed to add following into my configuration.yaml

mqtt:
  discovery: true
  broker: [YOUR MQTT BROKER]  # Remove if you want to use builtin-in MQTT broker
  birth_message:
    topic: 'hass/status'
    payload: 'online'
  will_message:
    topic: 'hass/status'
    payload: 'offline'

And this is the quote from documentation

Zigbee2mqtt is expecting Home Assistant to send it’s birth/will messages to hass/status . Be sure to add this to your configuration.yaml if you want Zigbee2mqtt to resend the cached values when Home Assistant restarts

2 Likes

Hi,

I have a bunch of Xiaomi wireless switches (these: https://www.zigbee2mqtt.io/devices/WXKG03LM.html) working well with Zigbee2MQTT.

The only “issue” I have is that as these switches support double press events, and I use them for turning on lights, there is a noticable delay from when I do a single press to the light coming on, caused (in part) by the fact that the switch is waiting to see if I do a double press.

Assuming I don’t care about double press functionality, is there anything clever I can do to get around this, i.e. remove the double press functionality, i.e. some sort of firmware mod / hardware mod on the switch, or something I can configure in Zigbee2MQTT / Hassio?

I expect the answer is no but I thought I’d ask!

Thanks

Amazing work Koen, your rewritten code did wonders for some of my Aqara sensors, back to life and super stable.
Thank you so much!

Hi.
I’m looking for help.
I already tried to update few times, but i don’t understand what I have to do exactly.
I’m running Hassio 0.103, zigbee2mqtt is stil at 1.4.0
I would like to update it to 1.7.1, but I can’t understand the needed steps.
I know that 1.5.1 introduced breaking changes, and that’s were I got stuck.

By default, when upgrading to v1.5.1, the add-on will create a backup of your configuration.yml within your data path: $DATA_PATH/configuration.yaml.bk

no backup is created on my system, but ok, I can save the files manually before updating.
anyway, the configuration.yaml file stored in share/zigbee2mqtt does not change after update.
here is what it contains:

devices:
  '0x000d6ffffe688544':
    friendly_name: '0x000d6ffffe688544'
    retain: false
  '0x00124b001938cbb1':
    friendly_name: '0x00124b001938cbb1'
    retain: false
  '0x00158d00029aaf18':
    friendly_name: '0x00158d00029aaf18'
    retain: false
  '0x00158d0002ade3a2':
    friendly_name: '0x00158d0002ade3a2'
    retain: false
  '0x00158d0002e2e527':
    friendly_name: '0x00158d0002e2e527'
    retain: false
  '0x00158d0002ec01a2':
    friendly_name: '0x00158d0002ec01a2'
    retain: false
  '0x00158d00032d2ddc':
    friendly_name: '0x00158d00032d2ddc'
    retain: false
  '0x00158d0003a3f4a4':
    friendly_name: '0x00158d0003a3f4a4'
    retain: false
  '0x7cb03eaa0a049085':
    friendly_name: '0x7cb03eaa0a049085'
    retain: false
  '0x7cb03eaa0a059dc0':
    friendly_name: '0x7cb03eaa0a059dc0'
    retain: false
  '0x7cb03eaa0a05c41a':
    friendly_name: '0x7cb03eaa0a05c41a'
    retain: false
homeassistant: true
mqtt:
  base_topic: zigbee2mqtt
  password: mypassword
  server: mqtt://homeassistant
  user: DVES_USER
permit_join: false
serial:
  disable_led: true
  port: /dev/ttyACM0

what changes is the config shown in the add-on configuration.

before update:

{
  "data_path": "/share/zigbee2mqtt",
  "homeassistant": true,
  "permit_join": false,
  "mqtt_base_topic": "zigbee2mqtt",
  "mqtt_server": "mqtt://homeassistant",
  "serial_port": "/dev/ttyACM0",
  "devices": [],
  "network_key": [],
  "mqtt_user": "DVES_USER",
  "mqtt_pass": "mypassword",
  "disable_led": true
}

and after update:

{
  "data_path": "/share/zigbee2mqtt",
  "devices": [],
  "groups": "groups.yaml",
  "homeassistant": true,
  "permit_join": false,
  "mqtt": {
    "base_topic": "zigbee2mqtt",
    "server": "mqtt://core-mosquitto",
    "user": "DVES_USER",
    "password": "mypassword"
  },
  "serial": {
    "port": "/dev/ttyACM0"
  },
  "advanced": {
    "pan_id": 6754,
    "channel": 11,
    "network_key": [
      1,
      3,
      5,
      7,
      9,
      11,
      13,
      15,
      0,
      2,
      4,
      6,
      8,
      10,
      12,
      13
    ],
    "availability_blacklist": []
  },
  "ban": [],
  "whitelist": [],
  "queue": {},
  "socat": {
    "enabled": false,
    "master": "pty,raw,echo=0,link=/dev/ttyZ2M,mode=777",
    "slave": "tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5",
    "restartdelay": 1,
    "initialdelay": 1,
    "options": "-d -d",
    "log": false
  },
  "mqtt_base_topic": "zigbee2mqtt",
  "mqtt_server": "mqtt://homeassistant",
  "serial_port": "/dev/ttyACM0",
  "network_key": [],
  "mqtt_user": "DVES_USER",
  "mqtt_pass": "mypassword",
  "disable_led": true
}

Instructions say:

When upgrading, you should use this to fill in the relevant values into your new config, particularly the network key, to avoid breaking your network and having to repair all of your devices.

But I can’t understand what exactly I have to do.
Service does not start and I rolled back to the previous snapshot.
Can anybody please guide me?
Thanks.

I’m just guessing, but before you had

server: mqtt://homeassistant

and now you have

"server": "mqtt://core-mosquitto"

It seems a different mqtt server

Hi.
I already tried to change it, but service does not start anyway.
Then… it looks like the old config is appended to the new one.
More, I don’t know what to do with the network key.
Thank you for trying to help.

What you could try : save your configuration.yaml somewhere, delete all contents on your RbPi, and then try to start it. There seems to be information in it that has moved to the new JSON.

You mean that maybe it doesn’t get updated, so if I remove it, it will create a new one?

Just an empty configuration.yaml on your RbPi, so you are sure it is not something in there that cause the add-on not to start.

Uhm… I tried, but the service did not start anyway.
So I tried to delete the redundant part at the bottom of the config:
,
“mqtt_base_topic”: “zigbee2mqtt”,
“mqtt_server”: “mqtt://homeassistant”,
“serial_port”: “/dev/ttyACM0”,
“network_key”: ,
“mqtt_user”: “DVES_USER”,
“mqtt_pass”: “DomoticA69”,
“disable_led”: true

Then I filled user, password and server in the top part and pressed start.
This time the service started.
Now the empty configuration.yaml has been filled with the new config:

{
“data_path”: “/share/zigbee2mqtt”,
“devices”: “devices.yaml”,
“groups”: “groups.yaml”,
“homeassistant”: true,
“permit_join”: false,
“mqtt”: {
“base_topic”: “zigbee2mqtt”,
“server”: “mqtt://homeassistant”,
“user”: “DVES_USER”,
“password”: “mypassword”
},
“serial”: {
“port”: “/dev/ttyACM0”
},
“advanced”: {
“pan_id”: 6754,
“channel”: 11,
“network_key”: [
1,
3,
5,
7,
9,
11,
13,
15,
0,
2,
4,
6,
8,
10,
12,
13
],
“availability_blacklist”:
},
“ban”: ,
“whitelist”: ,
“queue”: {},
“socat”: {
“enabled”: false,
“master”: “pty,raw,echo=0,link=/dev/ttyZ2M,mode=777”,
“slave”: “tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5”,
“restartdelay”: 1,
“initialdelay”: 1,
“options”: “-d -d”,
“log”: false
}
}

My zigbee entities are there, but they look not responding.
In the log I can see that only 2 of them (cc2531 router and an Aqara button) are working. The others are marked as not existing:

zigbee2mqtt:info 2019-12-12T15:16:18: Logging to directory: ‘/share/zigbee2mqtt/log/2019-12-12.16-16-17’
zigbee2mqtt:info 2019-12-12T15:16:18: Starting zigbee2mqtt version 1.7.1 (commit #unknown)
zigbee2mqtt:info 2019-12-12T15:16:18: Starting zigbee-herdsman…
zigbee2mqtt:info 2019-12-12T15:16:20: zigbee-herdsman started
zigbee2mqtt:info 2019-12-12T15:16:20: Coordinator firmware version: ‘{“type”:“zStack12”,“meta”:{“transportrev”:2,“product”:0,“majorrel”:2,“minorrel”:6,“maintrel”:3,“revision”:20190608}}’
zigbee2mqtt:info 2019-12-12T15:16:20: Currently 11 devices are joined:
zigbee2mqtt:info 2019-12-12T15:16:20: 0x000d6ffffe688544 (0x000d6ffffe688544): LED1624G9 - IKEA TRADFRI LED bulb E14/E26/E27 600 lumen, dimmable, color, opal white (Router)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x00158d00032d2ddc (0x00158d00032d2ddc): ZNLDP12LM - Xiaomi Aqara smart LED bulb (Router)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x00158d0002ade3a2 (0x00158d0002ade3a2): WXKG12LM - Xiaomi Aqara wireless switch (with gyroscope) (EndDevice)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x7cb03eaa0a049085 (0x7cb03eaa0a049085): AC03641 - OSRAM LIGHTIFY LED Classic A60 clear (Router)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x00124b001938cbb1 (0x00124b001938cbb1): CC2530.ROUTER - Custom devices (DiY) CC2530 router (Router)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x00158d0002e2e527 (0x00158d0002e2e527): RTCGQ11LM - Xiaomi Aqara human body movement and illuminance sensor (EndDevice)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x00158d0002ec01a2 (0x00158d0002ec01a2): RTCGQ11LM - Xiaomi Aqara human body movement and illuminance sensor (EndDevice)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x00158d00029aaf18 (0x00158d00029aaf18): MFKZQ01LM - Xiaomi Mi/Aqara smart home cube (EndDevice)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x7cb03eaa0a05c41a (0x7cb03eaa0a05c41a): AC03641 - OSRAM LIGHTIFY LED Classic A60 clear (Router)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x7cb03eaa0a059dc0 (0x7cb03eaa0a059dc0): AC03641 - OSRAM LIGHTIFY LED Classic A60 clear (Router)
zigbee2mqtt:info 2019-12-12T15:16:20: 0x00158d0003a3f4a4 (0x00158d0003a3f4a4): WSDCGQ01LM - Xiaomi MiJia temperature & humidity sensor (EndDevice)
zigbee2mqtt:info 2019-12-12T15:16:20: Zigbee: disabling joining new devices.
zigbee2mqtt:info 2019-12-12T15:16:20: Connecting to MQTT server at mqtt://homeassistant
zigbee2mqtt:info 2019-12-12T15:16:21: Connected to MQTT server
zigbee2mqtt:info 2019-12-12T15:16:21: MQTT publish: topic ‘zigbee2mqtt/bridge/state’, payload ‘online’
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x000d6ffffe688544’ does not exist, skipping publish
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x00158d00032d2ddc’ does not exist, skipping publish
zigbee2mqtt:info 2019-12-12T15:16:21: MQTT publish: topic ‘zigbee2mqtt/0x00158d0002ade3a2’, payload ‘{“linkquality”:99,“battery”:97,“voltage”:2995}’
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x7cb03eaa0a049085’ does not exist, skipping publish
zigbee2mqtt:info 2019-12-12T15:16:21: MQTT publish: topic ‘zigbee2mqtt/0x00124b001938cbb1’, payload ‘{“state”:true,“linkquality”:0,“led_state”:false}’
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x00158d0002e2e527’ does not exist, skipping publish
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x00158d0002ec01a2’ does not exist, skipping publish
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x00158d00029aaf18’ does not exist, skipping publish
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x7cb03eaa0a05c41a’ does not exist, skipping publish
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x7cb03eaa0a059dc0’ does not exist, skipping publish
zigbee2mqtt:error 2019-12-12T15:16:21: ‘0x00158d0003a3f4a4’ does not exist, skipping publish

Probably it’s here that the network key must be fixed, but I don’t know how.

If 2 of them are working, the key is fine. Just set permit_join to true and normally the others should reconnect themselves.

I did something different, I noticed that devices.yaml and groups.yaml files have been created in zigbee2mqtt folder.
I opened devices.yaml and i saw that the 2 working devices were in there!
So I just copied the others from the old configuration.yaml and now they are ok.
I hope that no more suprises are waiting :stuck_out_tongue:
Thank you very much.

Excellent will give this a go.Thank you.

Does anyone know what the default channel the co-ordinator runs on?

It’s channel 11, per the official docs here.

2 Likes

Thanks. Same channel at my Wi-Fi but I learned that it’s actually not the same and if they are both in 11 that means I’m getting the least amount of interference… I think I need a repeater :thinking:

Mmmm… after upgrading to 1.7.1, led on coordinator stays on.
I checked the config and noticed that the line “disable_led: true” was missing in serial: section.
I added it, but it aumatically deletes it again. I put it in configuration.yaml: deleted.
I stopped service, added the line, started the service and… it was removed from the config again.
Is there a way to turn off again that led?

My z2m add-on (version 1.7.0) has now a config with

  "serial": {
    "disable_led": "true",
    "port": "/dev/ttyACM0"
  }

… and the light is off. So perhaps you could try this.