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

up to now I have always used a CC2531 coordinator with zStack12 (revision ': 20190608) I have several Hue / ikea lights and xiami and mija sensors everything works discreetly, only occasionally some sensor loses the connection and I have to reset it. I wanted to try a new key with cc2530, programmed as coordinator and with the same firmware, I only change the configuration inherent to the new hardware and leaving unchanged network key and channel, but unfortunately the various peripherals do not connect to the new coordinator, I had to restore the old one cc2531. Is there a way to reset all peripherals from zigbee2mqtt before using new hardware? I read that the Hue are problematic to reset. Or if you have any advice on how to use the new cc2530 usb without having to reset anything I would be grateful.
this is the old config:

data_path: /share/zigbee2mqtt
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://homeassistant'
  user: user
  password: password
serial:
  port: /dev/ttyACM0
  disable_led: true
advanced:
  availability_timeout: 60
  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:
    - '0x00158d0002xxxxx'
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

and this should be the new one

data_path: /share/zigbee2mqtt
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://homeassistant'
  user: user
  password: password
serial:
  port: /dev/ttyUSB0
advanced:
  availability_timeout: 60
  rtscts: false
  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:
    - '0x00158d0002d6xxxx'
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```

I read on another post that itā€™s not advisable to mix ZLL and ZHA devices on the same mesh, yet there are a lot of posts here that suggest people are doing just that. What is the current recommendation? I struggle with poor signal between my mainly Xiaomi sensors so it would be great to add my 5 hue bulbs to the mesh to improve coverage.

Hi all,
Is the conbee2 stick support already in the stable channel or only on the dev channel? Thanks

Hi !

If you are using @danielwelchā€™s Zigbee2mqtt Hassio addon, which is tracking the latest version of @Koenkkā€™s Zigbee2mqtt (today at 1.14.1), experimental ConBee support has been added and is worked on since release 1.12.0. If you want to track progress, follow this GitHub issue on Koenā€™s zigbee-herdsman library.

So I would answer : ā€œyesā€ to your question. However, I was not able to make it work in my config as it looks like the Hassio addon does not want to see my adapter. I might give it another shot if I have time this week to dig further. In the meantime Iā€™m using the ā€œnativeā€ ZHA integration.

Edit: I might have found why I was not able to make it work, see this GitHub issue.

Hope this helps :slight_smile:

Thanks for the info. I am using the HassIO addon. I was asking because I was not able to start z2m too using the conbee2 stick. Using a CC2531 works with no problem.
I am guessing same issue with the github issue you linked to.

After the update zigbee2mqtt from 1.14 to 1.14.1 https://www.zigbee2mqtt.io/devices/ptvo.switch.html
I observe the following two errors:

  1. The zigbee2mqtt add on https://github.com/danielwelch/hassio-zigbee2mqtt needs to be restarted in order to get the PTVO devices connected. Only after this restart you see the linkquality signal.

  2. The PTVO switch does not respond to commands from Hassio.
    I get the following error

zigbee2mqtt:error 2020-07-19 09:28:02: Failed to call 'EntityPublish' 'onMQTTMessage' (AssertionError [ERR_ASSERTION]: Endpoint name 'bottom_left' is given but device has no such endpoint
    at Zigbee.resolveEntity (/zigbee2mqtt-1.14.1/lib/zigbee.js:202:25)
    at EntityPublish.onMQTTMessage (/zigbee2mqtt-1.14.1/lib/extension/publish.js:59:44)
    at Controller.callExtensionMethod (/zigbee2mqtt-1.14.1/lib/controller.js:360:44)
    at Controller.onMQTTMessage (/zigbee2mqtt-1.14.1/lib/controller.js:254:14)
    at MQTT.emit (events.js:315:20)
    at MQTT.onMessage (/zigbee2mqtt-1.14.1/lib/mqtt.js:95:14)
    at MqttClient.emit (events.js:315:20)
    at MqttClient._handlePublish (/zigbee2mqtt-1.14.1/node_modules/mqtt/lib/client.js:1269:12)
    at MqttClient._handlePacket (/zigbee2mqtt-1.14.1/node_modules/mqtt/lib/client.js:409:12)
    at work (/zigbee2mqtt-1.14.1/node_modules/mqtt/lib/client.js:320:12))

Looking at the MQTT explorer I see no abnormalities

Screenshot 2020-07-19 at 09.32.09

By the way my other IKEA Zigbee devices all function normally

What I have tried so far:
-switch to zigbee2mqtt edge
-remove/reinstall device
-various restarts

and then I found this help:
https://github.com/Koenkk/zigbee2mqtt/issues/3877

but how to change the configuration manually in Hassio?

I have zigbee2mqtt, HA and mosquitto all running on one computer now but the location isnā€™t great for the ZigBee network, so I am considering moving zigbee2mqtt to another computer located closer to the battery-powered sensors, or alternatively adding another router.

Two general questions;

  1. Can I migrate zigbee2mqtt to another computer just by moving the CC2531 and copying the config, state and database files over?
  2. Is a RPi 2 good enough to run zigbee2mqtt? The broker will not move. Will I notice the extra latency when controlling from a zigbee button to HA?

I run my zigbee2mqtt on a RbPi 1 :slight_smile:

Good, because my spare pi is actually a rev 1 model B also! I forgot it doesnā€™t have WiFi though. So is the performance ok?

Performance is OK.

Yes, that should work fine.

You can also use an ESP8266 as a remote device.

Yup. That is what Iā€™m using. A CC2530 connected to an esp01.

I have two automations to: a) change zigbee network joining state on zigbee2mqtt. and; b) change log level. They rely on input_boolean and a input_select helper.

The automations are:

- id: '1595186210127'
  alias: ZigBee -- permitir ingresso na rede
  description: ''
  trigger:
  - entity_id: input_boolean.permitir_o_ingresso_na_rede_zigbee # permit join helper on UI
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data: {}
    entity_id: timer.zigbee_permit_join
    service: timer.start
  - data:
      payload: 'true'
      topic: zigbee2mqtt/bridge/config/permit_join
    service: mqtt.publish

- id: '1595188993632'
  alias: ZigBee -- mudar o nĆ­vel de log no gateway
  description: ''
  trigger:
  - entity_id: input_select.nivel_de_log_do_gateway_zigbee2mqtt # log level helper on UI
    platform: state
  condition: []
  action:
  - data:
      payload_template: '{{ states(''input_select.nivel_de_log_do_gateway_zigbee2mqtt'')
        }}'
      topic: zigbee2mqtt/bridge/config/log_level
    service: mqtt.publish

If I permit new devices to join using other way (e.g. Zigbee2MqttAssistant), the UI get out of sync. The same happens on changing log level either on zigbee2mqtt configuration or on Zigbee2MqttAssistant.

Iā€™d like to sync HA internal state (and the UI) to the zigbee2mqtt real state. First, I thought about writing an automation that listen to zigbee2mqtt/bridge/config topic and change the UI accordingly, BUTā€¦ changing the UI will trigger the automation, publishing the configuration on the zigbee2mqtt/bridge/config/permit_join or zigbee2mqtt/bridge/config/log_level, that will make zigbee2mqtt publish the new state on zigbee2mqtt/bridge/config, that will trigger the automation to update the UI, that will change the state and a loop is bornā€¦

Any idea on how can I accomplish this synchronization?

1 Like

How is your UI defined ? I donā€™t see this kind of looping behavior.

The lovelace card I use to monitor is

entities:
  - entity: sensor.coordenador_zigbee
  - entity: sensor.versao_do_zigbee2mqtt
  - entity: sensor.versao_do_coordenador_zigbee
  - type: divider
  - entity: input_boolean.permitir_o_ingresso_na_rede_zigbee
  - entity: timer.zigbee_permit_join
  - type: divider
  - entity: input_select.nivel_de_log_do_gateway_zigbee2mqtt
  - type: divider
  - entity: sensor.nivel_de_log_do_coordenador_zigbee # this is the latest value received on zigbee2mqtt/bridge/config 
  - entity: sensor.permissao_de_ingresso_na_rede_zigbee # this is the latest value received on zigbee2mqtt/bridge/config
show_header_toggle: false
title: Controle do coordenador ZigBee
type: entities

The sensors are defined as

- platform: mqtt
  name: NĆ­vel de log do coordenador ZigBee
  state_topic: "zigbee2mqtt/bridge/config"
  value_template: "{{  value_json.log_level }}"

- platform: mqtt
  name: PermissĆ£o de ingresso na rede ZigBee
  state_topic: "zigbee2mqtt/bridge/config"
  value_template: "{{  value_json.permit_join }}"
  icon: mdi:location-enter

If I change the loglevel using zigbee2mqttassistant from warn to error, I have the following render for the lovelace card >> https://imgur.com/a/yaHQOt0

I created your log_level and permit join sensors, but I donā€™t see this behavior.

I used the HA package from zigbee2mqtt.io to create most of this page.

If you publish true on the zigbee2mqtt/bridge/config/permit_join topic from other place (e.g. mosquito_pub), the input select changes to the new value, the timer starts, and there is no new message to change join status on the MQTT bus?

As I told first, this is my first idea, but I was afraid of extra messages and a loop on state change. If you tested and there is no loop, Iā€™ll test here :slight_smile:

If you publish from outside HA, the input select does not change and the timer does not start. These are HA automations, and unaware of outside manipulations. The only thing that will change is your sensor.

Maybe I was not clear enough at the beginning.

I can understand that the events are decoupled from each other, and that is the problem.

I would like an external event (the sensor state change caused by the message received by MQTT) to change the state of an input_boolean or an input_select in the Home Assistant UI, but this change in the interface (i. e., HA internal state) should not trigger the automation that is associated with changing it. The automation should only be triggered when the input_boolean is manually changed by the user, or by some internal event, but not by an external event.

Maybe now it has become clearer.

For your permit_join, to have the UI synchronized with the real state, donā€™t use an input boolean but a template switch.
For your your input select, I have to think about that.