SOLVED: Zigbee@mqtt on debian bookworm based core install?

UPDATE: FINAL RESOLUTION.

Corrected docker run and configuration.yaml at the end of this thread.

  1. the “device” line in the docker run is not needed when connecting to the zigbee interface by tcp/ip.

  2. use ip address(es) within the docker, specifically he data/configuration.yaml.

=====================================================

Good morning.

  • Core 2024.10.2
  • Frontend 20241002.3

Successfully installed Core on debian bookworm 2 days ago (this made me happy!) and moving my old configuration to the new debian install was relatively painless (great thanks to mathan416 [Guide: Home Assistant Core - Restoring a Backup] ) for this.

the one thing that didn’t come across was the zigbee2mqtt that I used with my SMLight SLZB-06. So as a first pass I went to reinstall it. I found these references:

the last referred to adding their repository to the add-in store. Except that this Core on bookworm install doesn’t have an add-in store.

fishing around I found this reference:

Which suggests that Core doesn’t do add-ins (because docker).

So, cutting to the chase, before I flail around much more, is zigbee2mqtt using SLZB-06 doable with a Core installed on debian bookworm? Relatively easily and straightforward?

Or is it a better use of time to set zigbee to the side and move on to lower hanging automation fruit?

Yes, it’s set out in the docs Docker | Zigbee2MQTT

Ah! “Swipe Right” so to speak. Got it! didn’t even think of looking at the ‘docker’ install.

Thanks! I’ll post a status soon as I get a chance.

You’ll need an mqtt broker too. Use a docker container too.

g’morning,

Set aside a little time to work on the docker stuff for zigbee2mqtt following:

summary: this zigbee2mqtt docker seems to insist that the zigbee interface device by physically connected to the docker host. after flailing around for a bit I’m at a loss and looking for the perfectly obvious fix that I’ve missed.

thanks!

Details below.

I’m suddenly and unpleasantly reminded why I abandoned learning docker back when. :unamused:

to the point, I’m stalled at the part of the zigbee2mqtt.sh that (I presume) is supposed to direct the zigbee2mqtt to the SLZB-06. In my case the hostname of the SLZB-06 is ‘zb’ on a static ip (physically located on the other side of the house).

this zigbee2mqtt docker seems to insist that it expects/demands that the zigbee interface (the SMZB-06 in this case) be physically or maybe virtually (e.g. ser2net) located on a serial port on the docker host. (aside: using the ‘by-id’ maybe a USB port also. but still physically located on the physical host).

–device=/dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018ED3DDF-if00:/dev/ttyACM0 \

if I change the --device line using the origin device that the SLZB-06 says to use:

serial:

Location of SLZB-06

port: tcp://zb:6638
baudrate: 115200

and use

–device=tcp://zb:6638:/dev/ttyACM0

generates a configuration error, as expected because too many ’ : ’

I also tried replacing the ‘serial:’ in zigbee2mqtt/data/configuration.yaml:

# Serial settings

serial:

# Location of CC2531 USB sniffer

# port: /dev/ttyACM0

port: tcp://zb:6638

This generated a ‘serial must be object. Read documentation’ error.

Not sure where to go from here. Looking for suggestions. Thanks!

made a bit more “progress”

found:


junosuarez
Mar 13, 2023
No need to put anything in devices in docker-compose.yaml - since you’re connecting over the network instead of a local USB device, the docker devices config doesn’t apply…

so now:

docker run
–name=zigbee2mqtt
–restart=unless-stopped
-p 8080:8080
-v $(pwd)/data:/app/data
-v /run/udev:/run/udev:ro
-e TZ=Europe/Amsterdam
–user 996:996
–group-add dialout
koenkk/zigbee2mqtt

and I get further until

$ /home/homeassistant/zigbee2mqtt$ ./zigbee2mqtt_docker_start.sh
Using ‘/app/data’ as data directory
Starting Zigbee2MQTT without watchdog.
[2024-10-17 04:00:10] info: z2m: Logging to console, file (filename: log.log)
[2024-10-17 04:00:10] info: z2m: Starting Zigbee2MQTT version 1.40.2 (commit #e06848d)
[2024-10-17 04:00:10] info: z2m: Starting zigbee-herdsman (2.1.3)
[2024-10-17 04:00:10] error: zh:zstack:znp: Failed to determine if path is valid: ‘Error: ENOENT: no such file or directory, lstat ‘/app/tcp:’’
[2024-10-17 04:00:10] info: zh:zstack:znp: Opening SerialPort with {“path”:“tcp:/zb:6638”,“baudRate”:115200,“rtscts”:false,“autoOpen”:false}
[2024-10-17 04:00:10] error: z2m: Error while starting zigbee-herdsman
[2024-10-17 04:00:10] error: z2m: Failed to start zigbee
[2024-10-17 04:00:10] error: z2m: Check Zigbee2MQTT fails to start | Zigbee2MQTT for possible solutions
[2024-10-17 04:00:10] error: z2m: Exiting…
[2024-10-17 04:00:10] error: z2m: Error: Error: No such file or directory, cannot open tcp:/zb:6638

So first problem is where is the hostside “/app/tcp” ? That’s for tomorrow.

update: apparently the issue is within the docker image, which won’t stay up long enough to sh into and explore further. other than that I don’t know how to examine the insides of a shutdown docker so that’s that.

I did look at the ‘linux install’ page on the zigbee2mqtt site…and see that that option wants to be node.js. Which…no. Hard no. nuff said about that.

an alternative might be using the docker as designed for a device on a USB- serial port lookalike using socat or similar. but that’s just annoying. If I was going to do that I could have bought a USB cheapie an used used one of the old rasperry pi’s I have laying around and usbip. But then would require yet-another long powerbrick run (why did I buy POE? oh. right. So I wouldn’t have to do that). But it is an option to explore if someone else needs to.

Thanks!

I noticed a typo in configuration.yaml

# Serial settings

serial:

# Location of CC2531 USB sniffer

port: ‘tcp:/zb:6638’ <---- single slash, should be two slashes

correcting that gives a different error dump

# Serial settings

serial:

# Location of CC2531 USB sniffer

port: ‘tcp://zb:6638’

Output:

$ /home/homeassistant/zigbee2mqtt-docker$ sudo ./zigbee2mqtt_docker_start.sh
Using ‘/app/data’ as data directory
Starting Zigbee2MQTT without watchdog.
[2024-10-17 08:27:31] info: z2m: Logging to console, file (filename: log.log)
[2024-10-17 08:27:31] info: z2m: Starting Zigbee2MQTT version 1.40.2 (commit #e06848d)
[2024-10-17 08:27:31] info: z2m: Starting zigbee-herdsman (2.1.3)
[2024-10-17 08:27:31] info: zh:zstack:znp: Opening TCP socket with zb:6638
[2024-10-17 08:27:31] info: zh:zstack:znp: Socket error
[2024-10-17 08:27:31] error: z2m: Error while starting zigbee-herdsman
[2024-10-17 08:27:31] error: z2m: Failed to start zigbee
[2024-10-17 08:27:31] error: z2m: Check Zigbee2MQTT fails to start | Zigbee2MQTT for possible solutions
[2024-10-17 08:27:31] error: z2m: Exiting…
[2024-10-17 08:27:31] error: z2m: Error: Error while opening socket
at Socket. (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:166:24)
at Socket.emit (node:events:529:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at processTicksAndRejections (node:internal/process/task_queues:82:21)

/app/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:264
var er = new ERR_STREAM_WRITE_AFTER_END();
^
Error: write after end
at writeAfterEnd (/app/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:264:12)
at DerivedLogger.Writable.write (/app/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:300:21)
at DerivedLogger.log (/app/node_modules/winston/lib/winston/logger.js:231:12)
at Logger.log (/app/lib/util/logger.ts:198:25)
at Logger.info (/app/lib/util/logger.ts:211:14)
at Znp.onPortClose (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:96:16)
at Object.onceWrapper (node:events:632:26)
at Socket.emit (node:events:517:28)
at TCP. (node:net:350:12)

Any thoughts?

Yes, post on the z2m GitHub issues page or forum page.

Also the docs say

serial:
    port: mdns://slzb-06
    # port: mdns://uzg-01
    # port: mdns://czc
    # Optional: disable LED of the adapter if supported (default: false)
    disable_led: false

well. on a longshot like ‘oh ok why not tried everything else’ I used the ip of the SLZB-06 instead of the hostname in configuration.yaml.

yeah. That seems to have done the trick.

$ /home/homeassistant/zigbee2mqtt-docker$ ./zigbee2mqtt_docker_start.sh
Using ‘/app/data’ as data directory
Starting Zigbee2MQTT without watchdog.
[2024-10-17 08:44:42] info: z2m: Logging to console, file (filename: log.log)
[2024-10-17 08:44:42] info: z2m: Starting Zigbee2MQTT version 1.40.2 (commit #e06848d)
[2024-10-17 08:44:42] info: z2m: Starting zigbee-herdsman (2.1.3)
[2024-10-17 08:44:43] info: zh:zstack:znp: Opening TCP socket with 192.168.22.27:6638
[2024-10-17 08:44:43] info: zh:zstack:znp: Socket connected
[2024-10-17 08:44:43] info: zh:zstack:znp: Socket ready
[2024-10-17 08:44:43] info: zh:zstack:znp: Writing CC2530/CC2531 skip bootloader payload
[2024-10-17 08:44:44] info: zh:zstack:znp: Skip bootloader for CC2652/CC1352
[2024-10-17 08:45:04] info: zh:controller: Wrote coordinator backup to ‘/app/data/coordinator_backup.json’
[2024-10-17 08:45:05] info: z2m: zigbee-herdsman started (reset)
[2024-10-17 08:45:05] info: z2m: Coordinator firmware version: ‘{“meta”:{“maintrel”:1,“majorrel”:2,“minorrel”:7,“product”:1,“revision”:20240710,“transportrev”:2},“type”:“zStack3x0”}’
[2024-10-17 08:45:05] info: z2m: Currently 0 devices are joined.
(etc)

Which…ok. problem solved. Much to my surprise. Seeing as I had grudgingly become reconciled to the “fact” that DNS was everywhere now whether you wanted it or not. OK. Different discussion.

Problem solved.

Thanks

and a frustrating one.

Glad you got it going.

these work for me as of 2024 OCT 16 at just before midnight :grin:

Well, works in the sense that the docker zigbee2mqtt connects and communicates with my SLZB-06. I haven’t gotten to the rest of the mqtt chain yet.

$ /home/homeassistant/zigbee2mqtt-docker$ cat zigbee2mqtt_docker_start.sh

docker run
–name=zigbee2mqtt
–restart=unless-stopped
-p 8080:8080
-v /run/udev:/run/udev:ro
-v $(pwd)/data:/app/data
-e TZ=Europe/Amsterdam
–user 996:996
–group-add dialout
koenkk/zigbee2mqtt

$ /home/homeassistant/zigbee2mqtt-docker$ cat data/configuration.yaml

homeassistant: false
permit_join: true
mqtt:
base_topic: zigbee2mqtt
server: mqtt://localhost
serial:
port: tcp://192.168.22.27:6638 ## your SLZB-06 ip here
advanced:
homeassistant_legacy_entity_attributes: false
legacy_api: false
legacy_availability_payload: false
device_options:
legacy: false