WebThingsIO / zigbee-adapter

Zigbee adapter add-on for WebThings Gateway
Mozilla Public License 2.0
46 stars 29 forks source link

Conbee II: port is not open #270

Closed Djuseppe closed 3 years ago

Djuseppe commented 3 years ago

Hi! While trying to connect the zigbee devices via conbee II stick on Rpi4 stuck with following (running gateway-1.0.0.img / 2020-12-02-Raspbian.img):

zigbee-adapter: DeconzDriver: Using serial port /dev/ttyACM1 zigbee-adapter: Unhandled Rejection zigbee-adapter: Error: Port is not open zigbee-adapter: at unixWrite (/home/pi/.webthings/addons/zigbee-adapter/node_modules/@serialport/bindings/lib/unix-write.js:25:15)

Also: # lsusb Bus 001 Device 004: ID 1cf1:0030 Dresden Elektronik

Interesting, that checking #224 (where adding extra gpio helped) and running: # groups webthings groups: ‘webthings’: no such user

However: # groups pi pi adm dialout .. gpio

mrsteakhouse commented 3 years ago

This looks like a permission problem with the executing user of the gateway unable to access the serial port. Can you determine the executing user of the gateway?

chas-iot commented 3 years ago

Are you running any other software that might be interested in serial ports in general or ZigBee devices in particular? For example, the DECONZ software will lock the serial port so the gateway cannot access it.

Djuseppe commented 3 years ago

@mrsteakhouse seems that it's ran by pi user:

ps -axu | head -1 && ps -aux | grep webthing:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND pi 593 0.0 0.2 9920 5028 ? Ss 15:44 0:00 /bin/bash /home/pi/webthings/gateway/run-app.sh pi 886 0.0 0.0 1948 380 ? S 15:44 0:00 /bin/sh -c /home/pi/webthings/gateway/pagekite.py --clean --frontend=ek.webthings.io:443 --service_on=https:ek.webthings.io:localhost:4443:538ff018-c673-4b84-a498-8d3c7ff2b88a pi 887 0.1 0.7 68244 14744 ? Sl 15:44 0:01 /usr/bin/python /home/pi/webthings/gateway/pagekite.py --clean --frontend=ek.webthings.io:443 --service_on=https:ek.webthings.io:localhost:4443:538ff018-c673-4b84-a498-8d3c7ff2b88a pi 888 0.8 2.2 150376 42748 ? Sl 15:44 0:06 node /home/pi/webthings/gateway/src/addon-loader.js /home/pi/.webthings/addons/thing-url-adapter pi 948 0.9 2.2 150368 42520 ? Sl 15:47 0:05 node /home/pi/webthings/gateway/src/addon-loader.js /home/pi/.webthings/addons/zigbee-adapter pi 1212 0.0 0.0 7348 512 pts/0 S+ 15:57 0:00 grep --color=auto webthing

and when I run: ls -lah /dev/ | egrep 'ACM|AMA':

lrwxrwxrwx 1 root root 7 Jan 29 15:44 serial1 -> ttyAMA0 crw-rw---- 1 root dialout 166, 0 Jan 29 15:48 ttyACM0 crw-rw---- 1 root dialout 204, 64 Jan 29 15:44 ttyAMA0

and then checking the pi user: groups pi:

pi : pi adm dialout ... gpio

thus pi user has to have access to dialout/USB. But no idea why there's zigbee error afterwards.

@chas-iot what I did in terms of software is just to install webthings and then plug in ZigBee usb. Nothing more.

mrsteakhouse commented 3 years ago

Can you please plug your ConBee II stick out and in and look at the most recent kernel messages (dmesg). It should tell you on which port it was bound to. Most interesting that the add-on tries to communicate with /dev/ttyACM1, rather than /dev/ttyACM0.

Djuseppe commented 3 years ago

sorry, now there's little misunderstanding:

  1. at the very beginning of the issue there were another usb in the /dev/ttyACM0 - that's the reason add-on tried to call it from ttyACM1
  2. however, now it is the same case but with conbee usb only (no other usbs) plugged in the ttyACM0: dmesg | grep tty -i: [ 4.131381] cdc_acm 1-1.1:1.0: ttyACM0: USB ACM device

And log from the gateway: 2021-01-29 17:15:58.815 INFO : zigbee-adapter: DeconzDriver: Using serial port /dev/ttyACM0 2021-01-29 17:15:58.827 INFO : zigbee-adapter: Unhandled Rejection 2021-01-29 17:15:58.829 ERROR : zigbee-adapter: Error: Port is not open 2021-01-29 17:15:58.830 ERROR : zigbee-adapter: at unixWrite (/home/pi/.webthings/addons/zigbee-adapter/node_modules/@serialport/bindings/lib/unix-write.js:25:15)

Djuseppe commented 3 years ago

As no action for a long time -- closing.