Zigbee2mqtt installation error with openhabian

So I missed the use of the space-bar (oeps) just using the arrow and the selection did not stay. Checked again and indedd space bar is moving the selection!

Hi,

what was the solution for the problem?
I also installed openhabian on my sd-card but when i try to install Zigbee2MQTT than i got this Error
[openHABian] Downloading Zigbee2MQTT... FAILED (download)

npm ERR! code EUSAGE
npm ERR! 
npm ERR! The `npm ci` command can only install with an existing package-lock.json or
npm ERR! npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
npm ERR! later to generate a package-lock.json file, then try again.
npm ERR! 
npm ERR! Clean install a project
npm ERR! 
npm ERR! Usage:
npm ERR! npm ci
npm ERR! 
npm ERR! Options:
npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
npm ERR! [-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
npm ERR! [--legacy-bundling] [--global-style]
npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm ERR! [-ws|--workspaces] [--include-workspace-root] [--no-install-links]
npm ERR! 
npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
npm ERR! 
npm ERR! Run "npm help ci" for more info

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/openhabian/.npm/_logs/2025-01-05T18_08_46_299Z-debug-0.log
FAILED (npm ci)

Zigbee2mqtt has a major release change to v2 with breaking changes.
Some important changes are

  • use of pnpm instead npm
  • use of node v20
  • legacy settings are dropped

This results in

  • update via openhabian stops with error
  • new installation fails with error

I don’t have a solution at the moment except a manual installation or upgrade.
Installation is described here:
https://www.zigbee2mqtt.io/guide/installation/01_linux.html
The update here:
https://www.zigbee2mqtt.io/guide/installation/01_linux.html

I did the upgrade yesterday on my system and everything was back online in a few minutes.

I upgraded my Debian 12 to the version 2 and noticed that my Hue motion sensors were not working.
It turned out the motion sensors were working but the rule I was using had a condition for the lux value.
I noticed the lux value was not changing.
Further investigation revealed the mqtt name had changed with V2.
The illumination topic changed from illuminance_lux to illuminance
I changed my Incoming Value Transformations to: JSONPATH:$.illuminance
and then it worked.
I have not noticed if anything else has changed yet. It seems OK so far.
This is something others may want to check after upgrading.

P.S I had to add adapter: zstack to get it to work.

serial:
  disable_led: true
  port: tcp://192.168.1.9:6638
  adapter: zstack
  baudrate: 115200

I am using a SLZB-06 co-ordinator.

Do you plan openhabian update to support installation of Zigbee2mqtt v2+ ?

Today I tried to upgrade existing OH4.3.5 and install from scratch OH5 with openhabian 1.11 but there is 9months old 1.42 version of z2m( in openhabian-config menu [.2A]).

yes, yes, planed since quite some time but haven’t found the time yet. Currently I’m still on holiday but hopefully next week.

2 Likes

Just a quick update so you can see I haven’t been completely lazy. Here are the challenges I’ve encountered so far while creating the new setup routine for v2:

  • zigbee2mqtt now requires at least node v18. I’d like to upgrade to the current LTS v22 right away and simplify the setup considerably by installing via curl and apt-get, thus removing all the keyring stuff.
  • zigbee2mqtt now uses pnpm instead of npm as its package manager => Shouldn’t be a problem
  • zigbee2mqtt now has a web-based setup that starts automatically on first boot. I definitely want to use this in the new routine, as it would make selecting the right hardware even easier. Unfortunately, this setup always runs on port 8080, the same port as openHAB. I’ll ask Koen Kanters whether the port could be changed, for example, via an environment variable.

The first two points aren’t a problem, but I’d need help from the z2m developer for the last one.

3 Likes

Thank you so much, Larsen. You did a great job. I looked at the manual setup and decided it would be better to wait for your efforts.
Koen Kanters suggests running zigbee2mqtt in a Docker container. Would that be a way to run openHAB and zigbee2mqtt in parallel without any hassle?

The PR is started.
https://github.com/openhab/openhabian/pull/2065

But the build system is not satisfied yet


I think I got it:

  • Installation of latest zigbee2MQTT v2.x
  • upgrade to nodejs v22
  • uses new web-based onboarding feature

Here are two images if somebody would do some testing:

2 Likes

PR is merged. So next time you do a fresh install you’ll get zigbee2mqtt v2.

For your current installation: if you start openhab-config and are on branch “latest” you’ll get node v22 which makes the manual update a bit easier.

1 Like

What do you recommend for manually updating to v2?

  • stop zigbee2mqtt
  • /opt/zigbee2mqtt rename to /opt/zigbee2mqtt.bak
  • install with openhabian zigbee2mqtt
  • merge the new configuration.yaml with it’s backup
  • start zigbee2mqtt

I think the proper way would be

- backup z2m folder
- stop z2m
- check node version and pnpm
- git clone --depth 1 https://github.com/Koenkk/zigbee2mqtt.git /opt/zigbee2mqtt
- cd /opt/zigbee2mqtt
- pnpm install --frozen-lockfile
- pnpm start
- check messages for necessary actions

you can try with openhabian too but you would have to

- backup your z2m folder
- remove z2m with openhabian
- install z2m with openhabian
- stop z2m 
- replace data folder with your backup
- start z2m

Never tried this way so I’m not sure what’s being checked during migration. Tell me what you see if you wanna try.

I have used latest openhabian-config tool to update zigbee2mqtt. The tool stopped after installing prerequisites with the hint: Needs manual merge (or so)

Then I followed proper way, but:

pnpm start failed because port 8080 is in use.

I copied configuration.yaml, state.json, database.db from the data folder in the backup to the new data folder.

openhabian@openhabian:/opt/zigbee2mqtt $ pnpm start

zigbee2mqtt@2.6.2 start /opt/zigbee2mqtt
node index.js

Starting Zigbee2MQTT without watchdog.
Migration notes written in /opt/zigbee2mqtt/data/migration-1-to-2.log
Migration notes written in /opt/zigbee2mqtt/data/migration-2-to-3.log
Migration notes written in /opt/zigbee2mqtt/data/migration-3-to-4.log

and zigbee2mqtt 2.6.2 was up.
Then I stopped the job and started the service zigbee2mqtt :grinning_face:
Thank you for assistance

did you backup (=copy) the folder or did you rename it? I thought the git clone leaves the old config files untouched so that the migration starts automatically with your config during first start.

I wanted to start with a clean installation of zigbee2mqtt and so I renamed the existing folder.
After reinstalling, I immediately used the update offer and then copied the saved files from the data folder into the data folder of the new installation. When I started zigbee2mqtt my files were migrated.