milo526 / homebridge-tuya-web

Hoobs and Homebridge plugin for Tuya devices using Home Assistant Tuya Web Api
MIT License
223 stars 97 forks source link

Since upgrading HOOBS to 3.2.7 I get an error #96

Closed smidley closed 4 years ago

smidley commented 4 years ago

Updated HOOBS to version 3.2.7 and now I'm getting the following error message in my log:

Error loading platform requested in your config.json at position 3 10/20/2020, 4:37:41 PM Error: The requested platform 'TuyaWebPlatform' was not registered by any plugin. at PluginManager.getPluginForPlatform (/usr/local/lib/node_modules/@hoobs/hoobs/node_modules/homebridge/lib/pluginManager.js:152:23) at /usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:342:45 at Array.forEach () at Server.loadPlatforms (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:328:31) at Server.start (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/server.js:92:35) at module.exports (/usr/local/lib/node_modules/@hoobs/hoobs/bridge/cli.js:87:12) at Object. (/usr/local/lib/node_modules/@hoobs/hoobs/bin/hoobs:95:81) at Module._compile (internal/modules/cjs/loader.js:1133:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10) at Module.load (internal/modules/cjs/loader.js:977:32)

This is blocking any accessories from working in HOOBS.

deejaywoody commented 4 years ago

I can confirm I'm seeing the same in 3.2.7

milo526 commented 4 years ago

I've contacted the hoobs maintainers about this issue. Could you two please include your full configuration files here. (redact any passwords or other personally identifiable information)

deejaywoody commented 4 years ago

Here ya go. Comparing vs previous configs. Is the "plugin_map" stuff new?

{
   "platform":"TuyaWebPlatform",
   "plugin_map":{
      "plugin_name":"homebridge-tuya-web"
   },
   "name":"TuyaWebPlatform",
   "scenes":false,
   "options":{
      "platform":"smart_life",
      "username":"email@domain.com",
      "password":"xxxxxxxxxxxxxxxxxxxxxxx",
      "countryCode":"1",
      "pollingInterval":610
   }
}
milo526 commented 4 years ago

plugin_map is nothing new, just a hoobs things.

Could you try uninstalling and then re-installing the plugin through the hoobs ui and see if that fixes it?

deejaywoody commented 4 years ago

I tried removing/re-installing via the UI before posting. Did it once more just for the sake of diligence. No change.

mkellsy commented 4 years ago

I found the issue. HOOBS overrides the plugin location to remove it from the global scope. We do this for security reasons, especially now with all the malicious packages found on NPM lately.

The issue is HB doesn't fully test manually setting the plugin path, as it is used for development (I don't blame them either). I had to override the plugin scan and load, with a function that just loads the package.json file for the plugin directory. This is a much more elegant solution.

I did initial testing and was able to load this plugin along with a handful of others. I am submitting this for testing and we should see an update shortly.

smidley commented 4 years ago

Here's my config:

{ "platform": "TuyaWebPlatform", "plugin_map": { "plugin_name": "homebridge-tuya-web" }, "name": "TuyaWebPlatform", "scenes": false, "options": { "username": "user@mail.com", "password": "xxxxxxxxxxxxxxxxxxx", "countryCode": "1", "platform": "tuya" } },

deejaywoody commented 4 years ago

I found the issue. HOOBS overrides the plugin location to remove it from the global scope. We do this for security reasons, especially now with all the malicious packages found on NPM lately.

The issue is HB doesn't fully test manually setting the plugin path, as it is used for development (I don't blame them either). I had to override the plugin scan and load, with a function that just loads the package.json file for the plugin directory. This is a much more elegant solution.

I did initial testing and was able to load this plugin along with a handful of others. I am submitting this for testing and we should see an update shortly.

That makes sense. Thanks for the quickness. Looking forward to testing the update once It goes live.

mkellsy commented 4 years ago

Version 3.2.8 is live on NPM. May take some time for NPM to propagate the version to its mirrors.

deejaywoody commented 4 years ago

Version 3.2.8 is live on NPM. May take some time for NPM to propagate the version to its mirrors.

So I think we fixed this plug-in, and broke the one for chamberlain garage doors. It’s doing the same thing on 3.2.8 😆

milo526 commented 4 years ago

I'm closing this issue here since the problems for this plugin are solved. @mkellsy thank you for the swift resolution!