materik / homebridge-harmonyhub-plugin

Logitech HarmonyHub plugin for Homebridge
39 stars 2 forks source link

This plugin crashes Homebridge #26

Closed zork17 closed 5 years ago

zork17 commented 5 years ago

I get the following:

Mar  7 12:41:15 RSBPI homebridge[7841]: throw new Error("The requested platform '" + name + "' was not registered by any plugin.");
Mar  7 12:41:15 RSBPI homebridge[7841]: ^
Mar  7 12:41:15 RSBPI homebridge[7841]: Error: The requested platform 'HarmonyHub' was not registered by any plugin.
Mar  7 12:41:15 RSBPI homebridge[7841]: at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:122:13)
Mar  7 12:41:15 RSBPI homebridge[7841]: at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:316:45)
Mar  7 12:41:15 RSBPI homebridge[7841]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:86:36)
Mar  7 12:41:15 RSBPI homebridge[7841]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:45:10)
Mar  7 12:41:15 RSBPI homebridge[7841]: at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
Mar  7 12:41:15 RSBPI homebridge[7841]: at Module._compile (module.js:556:32)
Mar  7 12:41:15 RSBPI homebridge[7841]: at Object.Module._extensions..js (module.js:565:10)
Mar  7 12:41:15 RSBPI homebridge[7841]: at Module.load (module.js:473:32)
Mar  7 12:41:15 RSBPI homebridge[7841]: at tryModuleLoad (module.js:432:12)
Mar  7 12:41:15 RSBPI homebridge[7841]: at Function.Module._load (module.js:424:3)
Mar  7 12:41:15 RSBPI systemd[1]: homebridge-nknx.service: main process exited, code=exited, status=1/FAILURE

I have installed the plugin. I have two Homebridge services - one that handles the KNX devices and one with all the rest. Maybe I need to install the plugin in a different way than other plugins? Does this plugin support multiple Harmony hubs?

materik commented 5 years ago

It should. Are you sure you have setup your config.json file correctly?

zork17 commented 5 years ago

in the config.json I've just added:

{
        "platform": "HarmonyHub",
        "name": "homebridge-harmonyhub-plugin"
}

I installed it like every other plugin: sudo npm install -g homebridge-harmonyhub-plugin

materik commented 5 years ago

should work :/

zork17 commented 5 years ago

but it doesn't. anything I can do?

materik commented 5 years ago

your setup seem fine by me. so the only thing that I'm not sure about is the two homebridges so should be related to that.

zork17 commented 5 years ago

As I said I have 2 Homebridge services: Homebridge which has all the KNX devices. and Homebridge-NKNX which has all the non KNX devices, including this plugin in its config.json.

The service definition file for both of them is the same, except for the command line parameters for Homebridge.

The command line parameters are:

HOMEBRIDGE_OPTS=-U /var/homebridge
HOMEBRIDGE_OPTS_NKNX=-U /var/homebridge-nknx -P /home/pi/node_modules

I saw this setup somewhere in the Homebridge or KNX forum. They worked for me until now for all plugins.

This is the documentation for the parameters:

-P, --plugin-path [path]        look for plugins installed at [path] as well as the default locations ([path] can also point to a single plugin)
-U, --user-storage-path [path]  look for homebridge user files at [path] instead of the default location (~/.homebridge)

I installed the plugin like this sudo npm install -g homebridge-harmonyhub-plugin from /home/pi

Is there anything I can do to make this plugin work?

materik commented 5 years ago

could it be something to do with you running it as sudo.

johanhansen commented 5 years ago

Are you sure that the plugin actually is located in /home/pi/node_modules? My experience is that the node_modules can end up in unexpected locations. Try to omit "-P /home/pi/node_modules" and let Node find the plugin by checking it's known node_modules locations.

zork17 commented 5 years ago

@materik

could it be something to do with you running it as sudo.

I tried to install without sudo but it doesn't work

@johanhansen

Are you sure that the plugin actually is located in /home/pi/node_modules? My experience is that the node_modules can end up in unexpected locations. Try to omit "-P /home/pi/node_modules" and let Node find the plugin by checking it's known node_modules locations.

I also tried without -P /home/pi/node_modules but homebridge crashed because it didn't find other plugins.

Since this configuration worked for me with many plugins, I think there must be a differece in the install of this plugin that causes it to crash in my setup. I noticed that during the install there was some kind of compilation...

materik commented 5 years ago

can you see if the package is located in the folder home/pi/node_modules/

zork17 commented 5 years ago

no, it is not in: home/pi/node_modules/ it is in: /usr/lib/node_modules/ with many other plugins that work fine.

materik commented 5 years ago

try to install it at both locations...

zork17 commented 5 years ago

how do I do that?

Also, I think my problems are because I have 2 places with modules: /usr/local/lib/node_modules and /usr/lib/node_modules is there a way to tell the system to work from now on with /usr/local/lib/node_modules since when I install a new platform it is installed there, but it is run from /usr/lib/node_modules

materik commented 5 years ago

either you can copy paste the folder to this location or do a symbol link or can't you supply install location to npm install?

zork17 commented 5 years ago

It now finally works after removing all plugins and installing again in the same place.