@daveLeiser wrote:
The Goal
Im in the process of setting up Homeassistant so I can manage all my zigbee devices through HA. I want to use zigbee2mqtt in combination of the mosquitto broker addon available in the addon store.What is done so far
After some research I ended up buying a cc2531 usb sniffer and flashed it with the right firmware. I also installed the mosquitto broker addon using anonymous mode with the following configuration:logins: [] anonymous: true customize: active: true folder: mosquitto certfile: fullchain.pem keyfile: privkey.pem require_certificate: false
I also did create the accesscontrolllist file with the following content:
topic readwrite #
I also installed the zigbee2mqtt addon from the addon store and configured it:
data_path: /share/zigbee2mqtt devices: devices.yaml groups: groups.yaml homeassistant: true permit_join: true mqtt: base_topic: zigbee2mqtt server: 'mqtt://192.168.1.145' 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
These are mostly standard values except for the setting of the mqtt server. I was able to pair a xiaomi contact sensor and i see the state reported in the zigbee2mqtt log:
zigbee2mqtt:info 2020-04-14 12:33:24: MQTT publish: topic 'zigbee2mqtt/Haustür', payload '{"contact":true,"linkquality":68,"battery":100,"voltage":3005}'
I then went in HA GUI to Settings -> Integrations and added the mqtt integration. it automatically detected mosquitto broker with the right settings (not much to set up there) and i ticked the box “enable autodiscovery” before saving. So far so good…
The problem
My problem is, even though I can see the state of the sensor reporting to zigbee2mqtt and zigbee2mqtt says its connected to the mosquitto server (I will show you the logs later in this post), the devices do not show up on the mqtt integration page in HA. I just feel like there is a small piece missing but i can’t figure out what it is…Let me show you the logs when i restart the both the addons “mosquitto broker” and then “zigbee2mqtt”:
Log of Mosquitto broker:
[12:49:13] INFO: Setup mosquitto configuration [12:49:13] WARNING: SSL not enabled - No valid certs found! [12:49:13] INFO: No local user available [12:49:14] INFO: Initialize Hass.io Add-on services [12:49:14] INFO: Initialize Home Assistant discovery [12:49:14] INFO: Start Mosquitto daemon 1586868554: Loading config file /share/mosquitto/acl.conf 1586868554: mosquitto version 1.6.3 starting 1586868554: Config loaded from /etc/mosquitto.conf. 1586868554: Loading plugin: /usr/share/mosquitto/auth-plug.so 1586868554: ├── Username/password checking enabled. 1586868554: ├── TLS-PSK checking enabled. 1586868554: └── Extended authentication not enabled. 1586868554: |-- *** auth-plug: startup 1586868554: Opening ipv4 listen socket on port 1883. 1586868554: Opening ipv6 listen socket on port 1883. 1586868554: Opening websockets listen socket on port 1884. 1586868554: Warning: Mosquitto should not be run as root/administrator. 1586868554: New connection from 172.30.32.1 on port 1883. 1586868554: New client connected from 172.30.32.1 as mqttjs_d4862366 (p2, c1, k60). 1586868557: New connection from 172.30.32.1 on port 1883. [INFO] found homeassistant on local database 1586868558: New client connected from 172.30.32.1 as auto-587D268B-DFF3-7213-BA3D-EEB3596202EF (p2, c1, k60, u'homeassistant').
The log of the zigbee2mqtt addon:
[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done. ./run.sh: line 17: [Info] Configuration backup found in /share/zigbee2mqtt/.configuration.yaml.bk. Skipping config backup.: No such file or directory [Info] Socat is DISABLED and not started 2020-04-14T13:02:36: PM2 log: Launching in no daemon mode 2020-04-14T13:02:36: PM2 log: App [npm:0] starting in -fork mode- 2020-04-14T13:02:36: PM2 log: App [npm:0] online > zigbee2mqtt@1.12.2 start /zigbee2mqtt-1.12.2 > node index.js zigbee2mqtt:info 2020-04-14 13:02:42: Logging to console and directory: '/share/zigbee2mqtt/log/2020-04-14.13-02-42' filename: log.txt zigbee2mqtt:info 2020-04-14 13:02:43: Starting zigbee2mqtt version 1.12.2 (commit #unknown) zigbee2mqtt:info 2020-04-14 13:02:43: Starting zigbee-herdsman... zigbee2mqtt:info 2020-04-14 13:02:45: zigbee-herdsman started zigbee2mqtt:info 2020-04-14 13:02:45: Coordinator firmware version: '{"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190109}}' zigbee2mqtt:info 2020-04-14 13:02:45: Currently 6 devices are joined: zigbee2mqtt:info 2020-04-14 13:02:45: Haustür (0x00158d0002e9d384): MCCGQ01LM - Xiaomi MiJia door & window contact sensor (EndDevice) zigbee2mqtt:info 2020-04-14 13:02:45: 0x00158d0002ea0a02 (0x00158d0002ea0a02): MCCGQ01LM - Xiaomi MiJia door & window contact sensor (EndDevice) zigbee2mqtt:info 2020-04-14 13:02:45: 0x00158d0002e2bcdf (0x00158d0002e2bcdf): WSDCGQ01LM - Xiaomi MiJia temperature & humidity sensor (EndDevice) zigbee2mqtt:info 2020-04-14 13:02:45: 0x00158d0002e6e87a (0x00158d0002e6e87a): WSDCGQ01LM - Xiaomi MiJia temperature & humidity sensor (EndDevice) zigbee2mqtt:info 2020-04-14 13:02:45: 0x00158d0002f38b2c (0x00158d0002f38b2c): WXKG02LM - Xiaomi Aqara double key wireless wall switch (EndDevice) zigbee2mqtt:info 2020-04-14 13:02:45: 0x00178801062cc88d (0x00178801062cc88d): 9290022169 - Philips Hue white ambiance E27 with Bluetooth (Router) zigbee2mqtt:warn 2020-04-14 13:02:45: `permit_join` set to `true` in configuration.yaml. zigbee2mqtt:warn 2020-04-14 13:02:45: Allowing new devices to join. zigbee2mqtt:warn 2020-04-14 13:02:45: Set `permit_join` to `false` once you joined all devices. zigbee2mqtt:info 2020-04-14 13:02:45: Zigbee: allowing new devices to join. zigbee2mqtt:info 2020-04-14 13:02:45: Connecting to MQTT server at mqtt://192.168.1.145 zigbee2mqtt:info 2020-04-14 13:02:45: Connected to MQTT server zigbee2mqtt:info 2020-04-14 13:02:45: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'online' zigbee2mqtt:info 2020-04-14 13:02:45: MQTT publish: topic 'zigbee2mqtt/Haustür', payload '{"contact":true,"linkquality":68,"battery":100,"voltage":3005}' zigbee2mqtt:info 2020-04-14 13:02:45: MQTT publish: topic 'zigbee2mqtt/0x00158d0002ea0a02', payload '{"contact":false,"linkquality":0,"battery":97,"voltage":2995}' zigbee2mqtt:info 2020-04-14 13:02:45: MQTT publish: topic 'zigbee2mqtt/0x00158d0002e2bcdf', payload '{"temperature":23.13,"linkquality":63,"humidity":36.84,"battery":100,"voltage":3005}' zigbee2mqtt:info 2020-04-14 13:02:45: MQTT publish: topic 'zigbee2mqtt/0x00158d0002e6e87a', payload '{"temperature":23.26,"linkquality":81,"humidity":36.51,"battery":100,"voltage":3005}' zigbee2mqtt:info 2020-04-14 13:02:45: MQTT publish: topic 'zigbee2mqtt/0x00158d0002f38b2c', payload '{"battery":100,"voltage":3035,"linkquality":68}' zigbee2mqtt:info 2020-04-14 13:02:45: MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"version":"1.12.2","commit":"unknown","coordinator":{"type":"zStack12","meta":{"transportrev":2,"product":0,"majorrel":2,"minorrel":6,"maintrel":3,"revision":20190109}},"log_level":"info","permit_join":true}'
After that there are a lot of messages for what I understand reporting the current state of the paired devices.
I just checked the mosquitto broker log again after restarting the zigbee2mqtt addon and i can see the following error:
1586869348: Socket error on client mqttjs_d4862366, disconnecting. 1586869365: New connection from 172.30.32.1 on port 1883. 1586869365: New client connected from 172.30.32.1 as mqttjs_36963777 (p2, c1, k60).
I don’t know if this is related to my problem. For me it’s not clear what this “client mqttjs_d4862366” is…
But so for me it seems like zigbee2mqtt is able to talk to the mosquitto broker and HA also was able to detect the mosquitto broker when I added the MQTT integration. I just don’t know what triggers HA to add the devices which are already paired… I hope someone can clear this up for me.
At this point: Thanks for reading through all of this and i wish you great day!
Posts: 2
Participants: 2