ebaauw / homebridge-deconz

Homebridge plugin for deCONZ
Apache License 2.0
134 stars 7 forks source link

[deCONZ] Phoscon-GW: warning: unlock gateway and set Expose to obtain an API key #158

Closed fluxbeard closed 1 year ago

fluxbeard commented 1 year ago

I have problems getting an API key from the Conbee II Stick. I have Software version 2.23.00 and I always get<.

[deCONZ] Phoscon-GW: warning: unlock gateway and set Expose to obtain an API key

I unlocked the Stick in the Phoscon menu but in Homebridge it always throws the above message.

What can I do?

ebaauw commented 1 year ago

You need to set expose through ui, see README, https://github.com/ebaauw/homebridge-deconz#configuration, third paragraph.

fluxbeard commented 1 year ago

when I type "ui" commands on the raspberry's command line I get :

-bash: ui: command not found.

Can someone please walk me through enabling "expose" step by step? I installed Deconz/phoscon within hb-config

jan666 commented 1 year ago

I recently did a fresh homebridge installation. I did the the recommended way (https://github.com/homebridge/homebridge/wiki/Install-Homebridge-on-Raspbian) and installed homebridge-deconz via homebridge-config-ui-x. After that I noticed the commandline utils did not work. My old installation was done via npm install.

When you install homebridge like described in the wiki you end up without a node package installed. Homebridge installs node to /opt - so the binary is /opt/homebridge/bin/node. The deconz commandline utils are stored in /var/lib/homebridge/node_modules/.bin/.

If you did the installation like I did you should be able to run ui via /opt/homebridge/bin/node /var/lib/homebridge/node_modules/.bin/ui.

I added /opt/homebridge/bin/ to my PATH (added PATH=$PATH:/opt/homebridge/bin/ to ~/.profile) and added a symlink for ui: sudo ln -s /var/lib/homebridge/node_modules/.bin/ui /usr/bin/ui.

After that take a look here: https://github.com/ebaauw/homebridge-deconz/wiki/Dynamic-Configuration#configuration-api

ebaauw commented 1 year ago

The Homebridge deCONZ distribution delivers the executable in …/node_modules/homebridge-deconz/bin/ui.js. npm install creates a symlink to this in the bin directory associated with the install. When using npm -g install, that would be /usr/local/bin or /usr/bin (depending on where NodeJS is installed); when doing a local install, that’s the .bin directory under node_modules in the directory where npm is run. The way Homebridge is installed on your system, with local installations on /var/lib/Homebridge , you should include that .bin directory in your $PATH. I would actually expect it to be there when running the terminal from the UI, but it wouldn’t be when you just ssh into the host.

Alternatively try npx ui … to have npm locate the binary outside your $PATH.