Openhabian: zigbee2mqtt doesn't update

I noticed a problem when trying to update zigbee2mqtt via
openhabian-config. The problem is that the onboarding server port is changed locally during installation to avoid a conflict with openhab. Git notices this local change and then refuses to update.

The quick fix is to do a

cd /opt/zigbee2mqtt
git restore lib/util/onboarding.ts

After that you should be able to update normally with openhabian-config.

Of course this should be fixed in openhabian too.
@mstormi : Is it ok for you to restore the onboarding.js as stated above before updating? I don’t see a disadvantage.

I don’t understand what’s going on there so cannot really comment.

I’ll try to explain:

Starting with v2 zigbee2mqtt has a so called onboarding service which creates the config during the first installation. I changed the z2m-installation to use this service because it brings advantages e.g. with the detection of the zigbee-adaper compared to the old template-method. Unfortunately this service is started at port 8080 just like openhab.

As there was no possibility to change this initial port easily (like wit env-variables) I decided to stream-edit the port directly after pulling the repo. This is done in line 228 in nodejs-apps.bash

if ! cond_redirect sed -i -e "s|8080|8081|g" "/opt/zigbee2mqtt/lib/util/onboarding.ts"; then echo "FAILED (change z2m onboarding port)"; fi
}

This works fine for the installation. But when you do an update in openhabian-config (20 - 2A) the z2m-update-skript does a git pull which notices the difference in the file onboarding.js and doesn’t complete the pull.

So the easiest solution is to restore onboarding.js before the update. I think that’s cleaner anyway.

isn’t it safer to redo the port replacement on every update?
in the end, I don’t mind

I’ll do the PR.