fbacker / broadlink-mqtt-bridge

Bridge Broadlink RM Devices with MQTT and API for e.g. OpenHAB
41 stars 14 forks source link

Latest update broke lot of things #35

Closed combatistor closed 4 years ago

combatistor commented 4 years ago

Let me reopen the problem. In fact I could update to the latest version without issues, but it broke everything. Now I cannot control anymore from openhab I always get the error:

[info]:     Prepare topic: broadlink/light/nec, message: power_on_preset:780f774e7d2a 
[warn]:     Failed to find file: /srv/openhab2-conf/broadlink-mqtt-bridge/commands/light/nec/power_on_preset:780f774e7d2a.bin

when I ask to play the message on the particular device it actually binds the device to the filename, so it couldn't find it.

moreover now in the UI, the topic is always wrong. If I click to the message to send it creates the topic like this: Topic broadlink/srv/openhab2-conf/broadlink-mqtt-bridge/commands/light/nec Message power_on_preset Device **** (not shown but the id is correct)

If I play from the UI I get this error:

[info]:     Prepare topic: broadlink/srv/openhab2-conf/broadlink-mqtt-bridge/commands/light/nec, message: power_on_preset 
[warn]:     Failed to find file: /srv/openhab2-conf/broadlink-mqtt-bridge/commands/srv/openhab2-conf/broadlink-mqtt-bridge/commands/light/nec/power_on_preset.bin 

The topic should be: broadlink/light/nec

Please can you help fix this problem? Another thing, is it possible to rescan the devices automatically every time the raspberry pi reboots?

Originally posted by @combatistor in https://github.com/fbacker/broadlink-mqtt-bridge/issues/27#issuecomment-579100469

fbacker commented 4 years ago

So we have 3 things.

  1. Message thru MQTT doesn't work works This looks like a configuration issue when you are sending data. Read here: https://github.com/fbacker/broadlink-mqtt-bridge/wiki/Multiple-Broadlink-Devices

So for me sending with topic: broadlink/fans/livingroom:780f7717ea86 message: speed-3

2020-01-29 18:24:17 [info]:     Prepare topic: broadlink/fans/livingroom, message: speed-3 
2020-01-29 18:24:17 [info]:     Send command topic: broadlink/fans/livingroom, message: speed-3, file: fans/livingroom/speed-3, device: 780f7717ea86 
  1. Sending from GUI bug Writing the values in the input works. However navigating and clicking from the tree view sets the wrong path in topic. I've pushed a new version that should solve this. Version 2.0.2. Please upgrade and test

  2. Rescan at boot works When the service boots it will automatically start a scan. Tries for a while and if no device is found, it will continue to scan. However, if the service is working and the broadlink device is rebooted. It might get another IP on your network. This will not be solved. Please set a fixed IP on the broadlink

combatistor commented 4 years ago

Thank you for the reply,

  1. I solved the problem, to send MQTT messages I was using

      val actions = getActions("mqtt", "mqtt:broker:mosquitto")

      and then

      actions.publishMQTT(String topic, String value, Boolean retained)

      I was making a mistake about the topic, it needs to include the device, not in the message.       So it sould look like this

      actions.publishMQTT("broadlink/light/nec:xxxxxxxxxxxx", "power_off")

      Using this format it works!

  1. I tried to update to the latest version using curl command (with sudo privileges), but it crashed:
Installing helper tools ...
Check current Node installation ...
Node currently installed. Checking version number.
Minimum Node version: v8.12.0
Installed Node version: v10.13.0
No Node.js upgrade necessary.
Cloning ...
Cloning into 'broadlink-mqtt-bridge'...
remote: Enumerating objects: 37, done.
remote: Counting objects: 100% (37/37), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 37 (delta 1), reused 33 (delta 0), pack-reused 0
Unpacking objects: 100% (37/37), done.
Cloning Done!
Upgrade ...
HEAD is now at bfd6fd6 buggfix gui click on command item
rm: cannot remove './node_modules': No such file or directory
Already up-to-date.
Upgrade Done!
Install packages
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/mime-db-535d42ec/HISTORY.md'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/mime-db-535d42ec/index.js'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/mime-db-535d42ec/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/mime-db-535d42ec/README.md'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/uri-js-9df0c0cc/dist/es5/uri.all.min.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/ajv-e3cbe168/dist/ajv.min.js'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/uri-js-9df0c0cc/dist/es5/uri.all.min.js'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/uri-js-9df0c0cc/dist/es5/uri.all.min.js.map'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/frontail-8a0609d9/web/assets/styles/dark.css'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/socket.io-client-8a03d57a/dist/socket.io.slim.dev.js'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/frontail-8a0609d9/web/assets/styles/default.css'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/frontail-8a0609d9/web/assets/tinycon.min.js'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/call-credentials-filter.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/call-credentials.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/call-stream.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/call.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/channel-credentials.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/channel-options.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/channel.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/client-interceptors.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/client.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/compression-filter.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/constants.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/deadline-filter.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/events.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/filter-stack.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/filter.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/index.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/load-balancer-pick-first.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/load-balancer-round-robin.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@google-cloud/logging-482cbb1c/build/protos/protos.json'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/load-balancer.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/load-balancing-config.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/logging.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/make-client.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/metadata-status-filter.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/metadata.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/object-stream.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/picker.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/picker.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/resolver-dns.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/resolver-dns.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/resolver-uds.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/resolver-uds.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/resolver.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/resolver.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/resolving-load-balancer.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/resolving-load-balancer.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/server-call.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/server-call.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/server-credentials.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/server-credentials.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/server.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/server.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/service-config.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/service-config.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/status-builder.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/status-builder.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/stream-decoder.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/stream-decoder.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/subchannel-pool.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/subchannel-pool.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/subchannel.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/subchannel.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/build/src/tls-helpers.d.ts'
npm WARN tar ENOENT: no such file or directory, open '/srv/openhab2-conf/broadlink-mqtt-bridge/node_modules/.staging/@grpc/grpc-js-8dcef51b/src/tls-helpers.ts'
npm WARN broadlink-mqtt-bridge@1.0.0 No repository field.

npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-2018f46f/.git
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-2018f46f/.git'
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-30T08_07_17_645Z-debug.log
Unable to install dependencies!

      Even if I remove everything I always get trouble when installing dependencies...

       I also tried running      npm cache clean or npm cache verify from last issue but it didn't help.

  1. For rescanning the devices I thought it was not working (just noticed) after a reboot my commands doesn't anymore (maybe it was in a previous version) I'll check after updating all my commands in openhab
fbacker commented 4 years ago

Having issues why the installer/upgrade script doesn't always work. I've tried a fix, please run installer again and hopefully it works.

bash -c "$(curl -sL https://raw.githubusercontent.com/fbacker/broadlink-mqtt-bridge/master/installers/raspberry.sh)"

combatistor commented 4 years ago

This time I get this error:

Version 1.1.0

Installing helper tools ...
Check current Node installation ...
Node currently installed. Checking version number.
Minimum Node version: v8.12.0
Installed Node version: v10.13.0
No Node.js upgrade necessary.
Upgrade ...
HEAD is now at bfd6fd6 buggfix gui click on command item
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 2), reused 2 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/fbacker/broadlink-mqtt-bridge
   bfd6fd6..6bae942  master     -> origin/master
Updating bfd6fd6..6bae942
Fast-forward
 installers/raspberry.sh | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
Upgrade Done!
Install packages
npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-b9f5ff06/.git
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-b9f5ff06/.git'
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-30T23_28_50_624Z-debug.log
Unable to install dependencies!

I get the same error after deleting the folder. It seems there is always an error while getting your other GitHub repo

fbacker commented 4 years ago

What haspens of you put sudo before the installer script?

On Fri, 31 Jan 2020 at 00:31, combatistor notifications@github.com wrote:

This time I get this error'

Version 1.1.0

Installing helper tools ... Check current Node installation ... Node currently installed. Checking version number. Minimum Node version: v8.12.0 Installed Node version: v10.13.0 No Node.js upgrade necessary. Upgrade ... HEAD is now at bfd6fd6 buggfix gui click on command item remote: Enumerating objects: 7, done. remote: Counting objects: 100% (7/7), done. remote: Compressing objects: 100% (4/4), done. remote: Total 4 (delta 2), reused 2 (delta 0), pack-reused 0 Unpacking objects: 100% (4/4), done. From https://github.com/fbacker/broadlink-mqtt-bridge bfd6fd6..6bae942 master -> origin/master Updating bfd6fd6..6bae942 Fast-forward installers/raspberry.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) Upgrade Done! Install packages npm ERR! code 128 npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-b9f5ff06/.git npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-b9f5ff06/.git' npm ERR!

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-01-30T23_28_50_624Z-debug.log Unable to install dependencies!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fbacker/broadlink-mqtt-bridge/issues/35?email_source=notifications&email_token=ABCFLGLHWIPCHHYFUZZDMD3RANPL3A5CNFSM4KM5C7RKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKM6KRA#issuecomment-580511044, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCFLGLFOC6KZT5U4IPH35DRANPL3ANCNFSM4KM5C7RA .

-- Mvh, Fredrick Bäcker

combatistor commented 4 years ago

I forgot to precise, I always run the script as sudo. PS: I usually edit my answers a lot of times so you may have missed it

fbacker commented 4 years ago

Looks like mom permission issues. Maybe because running as root?

Can you run without sudo?

What happens if you enter broadlink folder and run package install? First normal. If not working try with sudo.

npm install

Same issue? Try

npm install --unsafe-perm

On Fri, 31 Jan 2020 at 06:42, combatistor notifications@github.com wrote:

I forgot to precise, I always run the script as sudo

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fbacker/broadlink-mqtt-bridge/issues/35?email_source=notifications&email_token=ABCFLGKKLRPR6LAGBQ5U7XLRAO24HA5CNFSM4KM5C7RKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKNR2VY#issuecomment-580590935, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCFLGPDTO4GCUCRLAZSIPLRAO24HANCNFSM4KM5C7RA .

-- Mvh, Fredrick Bäcker

combatistor commented 4 years ago

If I run without sudo, I get:

Version 1.1.0

Installing helper tools ...
Check current Node installation ...
Node currently installed. Checking version number.
Minimum Node version: v8.12.0
Installed Node version: v10.13.0
No Node.js upgrade necessary.
Cloning ...
fatal: could not create work tree dir 'broadlink-mqtt-bridge': Permission denied
Unable to clone.

If I manually create the folder /srv/openhab2-conf/broadlink-mqtt-bridge and re-run the script again I get:

Version 1.1.0

Installing helper tools ...
Check current Node installation ...
Node currently installed. Checking version number.
Minimum Node version: v8.12.0
Installed Node version: v10.13.0
No Node.js upgrade necessary.
Upgrade ...
fatal: Not a git repository (or any of the parent directories): .git
rm: cannot remove './node_modules': No such file or directory
rm: cannot remove 'package-lock.json': No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
Unable to upgrade.
Please run git pull manually.

The thing is I don't have user access to /srv/ path, anything there requires sudo to work (like sudo mkdir) to create the folder

If I run the bash script again, wait for the failure, go to the folder and run npm install I get this error

npm WARN checkPermissions Missing write access to /srv/openhab2-conf/broadlink-mqtt-bridge
npm WARN broadlink-mqtt-bridge@1.0.0 No repository field.

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /srv/openhab2-conf/broadlink-mqtt-bridge
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge'
npm ERR!  { [Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/srv/openhab2-conf/broadlink-mqtt-bridge\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/srv/openhab2-conf/broadlink-mqtt-bridge' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-01-31T06_03_33_453Z-debug.log

with sudo npm install I get this:

npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-2031687c/.git
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-2031687c/.git'
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-31T06_05_53_831Z-debug.log

with npm install --unsafe-perm:

npm WARN checkPermissions Missing write access to /srv/openhab2-conf/broadlink-mqtt-bridge
npm WARN broadlink-mqtt-bridge@1.0.0 No repository field.

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /srv/openhab2-conf/broadlink-mqtt-bridge
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge'
npm ERR!  { [Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge']
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, access \'/srv/openhab2-conf/broadlink-mqtt-bridge\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/srv/openhab2-conf/broadlink-mqtt-bridge' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-01-31T06_07_49_249Z-debug.log

and with sudo npm install --unsafe-perm:

npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-4f38b6fc/.git
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-4f38b6fc/.git'
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-01-31T06_09_17_576Z-debug.log
fbacker commented 4 years ago

Thank you for trying all the cases. So sadly none worked. Next opportunity I have I will clear my install and caches and try to get same errors like you.

If you have bash and npm skills I would appreciate the help :)

On Fri, 31 Jan 2020 at 07:09, combatistor notifications@github.com wrote:

If I run without sudo, I get:

Version 1.1.0

Installing helper tools ... Check current Node installation ... Node currently installed. Checking version number. Minimum Node version: v8.12.0 Installed Node version: v10.13.0 No Node.js upgrade necessary. Cloning ... fatal: could not create work tree dir 'broadlink-mqtt-bridge': Permission denied Unable to clone.

If I manually create the folder /srv/openhab2-conf/broadlink-mqtt-bridge and re-run the script again I get:

Version 1.1.0

Installing helper tools ... Check current Node installation ... Node currently installed. Checking version number. Minimum Node version: v8.12.0 Installed Node version: v10.13.0 No Node.js upgrade necessary. Upgrade ... fatal: Not a git repository (or any of the parent directories): .git rm: cannot remove './node_modules': No such file or directory rm: cannot remove 'package-lock.json': No such file or directory fatal: Not a git repository (or any of the parent directories): .git Unable to upgrade. Please run git pull manually.

The thing is I don't have user access to /srv/ path, anything there requires sudo to work (like sudo mkdir) to create the folder

If I run the bash script again, wait for the failure, go to the folder and run npm install I get this error

npm WARN checkPermissions Missing write access to /srv/openhab2-conf/broadlink-mqtt-bridge npm WARN broadlink-mqtt-bridge@1.0.0 No repository field.

npm ERR! code EACCES npm ERR! syscall access npm ERR! path /srv/openhab2-conf/broadlink-mqtt-bridge npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge' npm ERR! { [Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge'] npm ERR! stack: npm ERR! 'Error: EACCES: permission denied, access \'/srv/openhab2-conf/broadlink-mqtt-bridge\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/srv/openhab2-conf/broadlink-mqtt-bridge' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2020-01-31T06_03_33_453Z-debug.log

with sudo npm install I get this:

npm ERR! code 128 npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-2031687c/.git npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-2031687c/.git' npm ERR!

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-01-31T06_05_53_831Z-debug.log

with npm install --unsafe-perm:

npm WARN checkPermissions Missing write access to /srv/openhab2-conf/broadlink-mqtt-bridge npm WARN broadlink-mqtt-bridge@1.0.0 No repository field.

npm ERR! code EACCES npm ERR! syscall access npm ERR! path /srv/openhab2-conf/broadlink-mqtt-bridge npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge' npm ERR! { [Error: EACCES: permission denied, access '/srv/openhab2-conf/broadlink-mqtt-bridge'] npm ERR! stack: npm ERR! 'Error: EACCES: permission denied, access \'/srv/openhab2-conf/broadlink-mqtt-bridge\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/srv/openhab2-conf/broadlink-mqtt-bridge' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /home/pi/.npm/_logs/2020-01-31T06_07_49_249Z-debug.log

and with sudo npm install --unsafe-perm:

npm ERR! code 128 npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-4f38b6fc/.git npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-4f38b6fc/.git' npm ERR!

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-01-31T06_09_17_576Z-debug.log

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fbacker/broadlink-mqtt-bridge/issues/35?email_source=notifications&email_token=ABCFLGOVUV4NJVIITHH5PITRAO6B7A5CNFSM4KM5C7RKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKNTJZA#issuecomment-580596964, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCFLGM7VM2OYBGK5XJRJJTRAO6B7ANCNFSM4KM5C7RA .

-- Mvh, Fredrick Bäcker

combatistor commented 4 years ago

Well I don't have npm skills, but what I noticed the first time is: I could somehow fix the problem by executing the bash script manually and modify the package.json file and changing the line "broadlinkjs-rm": "git+https://github.com/fbacker/broadlinkjs-rm" by "broadlinkjs-rm": **"file:insert_broadlinkjs-rm_path_here"**

and run npm install --production

I think downloading your other GitHub via bash, git clone, and also linking to the file directly in the package.json might work.

Other thing I noticed in the boot folder is that the service is not using the proper npm, I mean I noticed in my raspberry pi, the npm package is located in /usr/local/npm, and not in /usr/bin/npm I mean it seems I still have npm located in bin, but this one doesn't work. I could verify that by running npm get prefix I hope my comment can help

PS: I totally removed node from the pi and reinstalled it properly, but the script was still failing: err 128

Please forget about the npm location, it was corrected after reinstalling everything.

I can also confirm it works by downloading your broadlinkjs repository, and adding: "broadlinkjs-rm": "file:../broadlinkjs-rm" instead of "broadlinkjs-rm": "git+https://git@github.com/fbacker/broadlinkjs-rm" Download the script and comment the git pull to avoid erasing the modifications to package.json And just run sudo bash the new script

fbacker commented 4 years ago

So maybe I need to make npm package for broadlinkjs-rm (its a clone from stale repo, so would more like that one to start working). Or download git repo and file link...

Looks like that npm 5.x having issues but nothing with npm 6.x. maybe an upgrade there would help? what npm version are you running. Installer script version 1.2.0 now does an NPM version check.

combatistor commented 4 years ago

Im using npm 5.13.7, upgraded to 6.13.7, I'll try install with your script again

Still getting the same errors...

Version 1.2.0

Installing helper tools ...
Check current Node installation ...
Node currently installed. Checking version number.
Minimum Node version: v10.13.0
Installed Node version: v13.7.0
No Node.js upgrade necessary.
Check current NPM installation ...
NPM currently installed. Checking version number.
Minimum NPM version: 6.4.1
Installed NPM version: 6.13.7
No NPM upgrade necessary.
Upgrade ...
HEAD is now at 6bae942 try to fix installer
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 9 (delta 5), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (9/9), done.
From https://github.com/fbacker/broadlink-mqtt-bridge
   6bae942..862d747  master     -> origin/master
Updating 6bae942..862d747
Fast-forward
 installers/raspberry.sh | 39 ++++++++++++++++++++++++---------------
 package.json            |  2 +-
 2 files changed, 25 insertions(+), 16 deletions(-)
Upgrade Done!
Install packages
npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q https://git@github.com/fbacker/broadlinkjs-rm.git /root/.npm/_cacache/tmp/git-clone-bb36c79f/.git
npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-bb36c79f/.git'
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-02-02T13_33_42_494Z-debug.log
Unable to install dependencies!
fbacker commented 4 years ago

That might be the issue. Possible to upgrade and try?

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt install nodejs

You have node 10.13 and that should use npm 6.4.1

fbacker commented 4 years ago

that was quick. trying out a new thing.

fbacker commented 4 years ago

Changed to use github tarball. Install script version 1.2.1

combatistor commented 4 years ago

It worked! No errors whatsoever, just got a

npm notice created a lockfile as package-lock.json. You should commit this file.
npm warn broadlink-mqtt-bridge@1.0.0 No repository field.

The topic was also correct from the gui

Thanks for your time! I hope it will also solve other users errors

fbacker commented 4 years ago

Glad it worked. Maybe I will put back the package-lock. I'll leave it for now.