jvmahon / Homebridge-HomeSeer4

Homebridge Plugin for HomeSeer 3 and 4
28 stars 8 forks source link

ERROR LOADING PLUGIN homebridge-homeseer4: #151

Closed sesykes71 closed 3 years ago

sesykes71 commented 3 years ago

Here is the log file for the error. I have uninstalled and reinstalled the plugin with the same result. This problem may have started with the upgrade to HS4.2

[9/1/2021, 10:30:56 AM] [HB Supervisor] OS: Linux 4.15.0-136-generic x64 [9/1/2021, 10:30:56 AM] [HB Supervisor] Node.js v14.17.6 /usr/bin/node [9/1/2021, 10:30:56 AM] [HB Supervisor] Homebridge Path: /usr/lib/node_modules/homebridge/bin/homebridge [9/1/2021, 10:30:56 AM] [HB Supervisor] UI Path: /usr/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js [9/1/2021, 10:31:22 AM] [Homebridge UI] Homebridge Config UI X v4.41.2 is listening on :: port 8581 [9/1/2021, 10:31:25 AM] [HB Supervisor] Starting Homebridge with extra flags: -I [9/1/2021, 10:31:25 AM] [HB Supervisor] Started Homebridge v1.3.4 with PID: 1541 Initializing HAP-NodeJS v0.9.4... [9/1/2021, 10:31:35 AM] Loaded config.json with 0 accessories and 1 platforms. [9/1/2021, 10:31:36 AM] Loaded 0 cached accessories from cachedAccessories. [9/1/2021, 10:31:36 AM] --- [9/1/2021, 10:31:47 AM] Loaded plugin: homebridge-alexa@0.5.42 [9/1/2021, 10:31:47 AM] Registering platform 'homebridge-alexa.Alexa' [9/1/2021, 10:31:47 AM] --- [9/1/2021, 10:31:48 AM] Loaded plugin: homebridge-config-ui-x@4.41.2 [9/1/2021, 10:31:48 AM] Registering platform 'homebridge-config-ui-x.config' [9/1/2021, 10:31:48 AM] --- [9/1/2021, 10:31:48 AM] ==================== [9/1/2021, 10:31:48 AM] ERROR LOADING PLUGIN homebridge-homeseer4: [9/1/2021, 10:31:48 AM] Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/lib/node_modules/homebridge-homeseer4/node_modules/node-fetch/src/index.js require() of ES modules is not supported. require() of /usr/lib/node_modules/homebridge-homeseer4/node_modules/node-fetch/src/index.js from /usr/lib/node_modules/homebridge-homeseer4/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename /usr/lib/node_modules/homebridge-homeseer4/node_modules/node-fetch/src/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/lib/node_modules/homebridge-homeseer4/node_modules/node-fetch/package.json.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1089:13)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/usr/lib/node_modules/homebridge-homeseer4/index.js:4:14)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)

[9/1/2021, 10:31:48 AM] ==================== [9/1/2021, 10:31:48 AM] Loading 1 platforms... [9/1/2021, 10:31:48 AM] [Config] Initializing config platform... [9/1/2021, 10:31:48 AM] [Config] Running in Service Mode Preparing Advertiser for 'Homebridge 9E49 9E92' using bonjour-hap backend! Setup Payload: X-HM://0024FA5Y5E5M5 Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ 576-95-133 │     
└────────────┘     

Starting to advertise 'Homebridge 9E49 9E92' using bonjour-hap backend! [9/1/2021, 10:31:48 AM] Homebridge v1.3.4 (Homebridge 9E49) is running on port 51638.

kylemhall commented 3 years ago

I'm having the same issue.

vansy02 commented 3 years ago

Same issue here, just happened when I upgraded the homebridge UI X yesterday.

sesykes71 commented 3 years ago

That makes me feel better:) The log file makes a suggestion about using import and change the file extension but I am not sure how to correct it. I assume the source code needs to change. Hopefully the author will see this.

vansy02 commented 3 years ago

I believe so yes, I'm not a coder by any means but can usually google my way through everything. I found where to change the .js file but the rest of it using import or removing "type": "modules" I have no clue. I know the author is using Hubitat now but hopefully he takes a look and it's a quick fix.

jvmahon commented 3 years ago

I have no idea why you guys are having problems. I tested it on Windows and it still loads fine. I"m using node 14.17.1 -- try updating node if you're using an older version. Also, select Ciao as the mDNS Advertiser (selectable from the Config-UI-X settings for homebridge).

vansy02 commented 3 years ago

Thank you, I appreciate the response, I changed to Ciao, restarted HomeBridge but same error. Running node v14.17.6, I'll try to downgrade to 14.17.1 tonight. Could be that we're running on pi?

sesykes71 commented 3 years ago

My Ubuntu system is not on a pi. I also see no improvement changing to Ciao. Downgrading to v14.17.1 doesn’t help either

Steve

Sent from my iPhone.

On Sep 1, 2021, at 20:13, vansy02 @.***> wrote:

 Thank you, I appreciate the response, I changed to Ciao, restarted HomeBridge but same error. Running node v14.17.6, I'll try to downgrade to 14.17.1 tonight. Could be that we're running on pi?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

vansy02 commented 3 years ago

I just ran a fresh hyper-v install and received the same error message for the plug-in. I think it has something to do with the new hombridge-ui-x, I’m currently running node 14.17.5.

sesykes71 commented 3 years ago

Today’s update. I started with a fresh image for a Pi. It is using Node 14.17.4 and Npm 7.20.3 No errors until I added the Homeseer4 plugin, then the same error as before.

Steve

Sent from my iPhone.

On Sep 2, 2021, at 01:26, vansy02 @.***> wrote:

 I just ran a fresh hyper-v install and received the same error message for the plug-in. I think it has something to do with the new hombridge-ui-x, I’m currently running node 14.17.5.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

dibble9012 commented 3 years ago

Same issue after upgrading to HomeSeer 4.0.2.0.0. Currently updating node to see if that fixes anything.

dibble9012 commented 3 years ago

After updating HomeSeer to 4.0.2.0.0 and NodeJS to latest version 16.8.0. This is the error I get:

[02/09/2021, 18:12:43] [Homebridge Homeseer4] Launched child bridge with PID 2060

/usr/lib/node_modules/homebridge-homeseer4/index.js:4 var fetch = require("node-fetch"); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/lib/node_modules/homebridge-homeseer4/node_modules/node-fetch/src/index.js from /usr/lib/node_modules/homebridge-homeseer4/index.js not supported. Instead change the require of /usr/lib/node_modules/homebridge-homeseer4/node_modules/node-fetch/src/index.js in /usr/lib/node_modules/homebridge-homeseer4/index.js to a dynamic import() which is available in all CommonJS modules. at Object. (/usr/lib/node_modules/homebridge-homeseer4/index.js:4:14) at Plugin.load (/usr/lib/node_modules/homebridge/lib/plugin.js:129:31) at ChildBridgeFork.loadPlugin (/usr/lib/node_modules/homebridge/lib/childBridgeFork.js:64:21) at process. (/usr/lib/node_modules/homebridge/lib/childBridgeFork.js:170:29) at process.emit (node:events:394:28) at process.emit (/usr/lib/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:495:21) [02/09/2021, 18:12:43] [Homebridge Homeseer4] Child bridge process ended

jvmahon commented 3 years ago

I've prepared a patch to try, Can someone with git installed do ...

npm -g uninstall homebridge-homeseer4
npm -g install git://github.com/jvmahon/homebridge-homeseer4#patch

And let me know if that works. It works on Windows with Node 14.17.1

vansy02 commented 3 years ago

So it installs for me on both Windows and pi but when I try to input the url of my homeseer machine I receive an error message saying invalid url. It's the ip address of the machine on the same network that runs homeseer. Again, really appreciate the help, I know you're using Hubitat now.

jvmahon commented 3 years ago

@vansy02

Did you include the http part of the address, not just the IP #?

Did you confirm that the ASCII interface on HomeSeer was also turned on?

vansy02 commented 3 years ago

http is now in there, I receive the following.

[9/2/2021, 8:34:03 PM] [Config] Initializing config platform... [9/2/2021, 8:34:03 PM] [Config] Running in Service Mode [9/2/2021, 8:34:03 PM] [HomeSeer] Initializing HomeSeer platform... [9/2/2021, 8:34:03 PM] [HomeSeer] Start Failed to fetch HomeSeer device and control data, retrying in 15 seconds... Failed to fetch HomeSeer device and control data, retrying in 15 seconds..

vansy02 commented 3 years ago

Here's the config file:

"accessories": [], "platforms": [ { "name": "Config", "port": 8581, "platform": "config" }, { "name": "HomeSeer", "host": "http://xxx.xxx.x.xx", "ASCIIport": 11000, "login": "user", "password": "password", "Switches": [ 50 ], "platform": "HomeSeer" } ] }

vansy02 commented 3 years ago

Also receive this on install:

querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

Not sure if that has something to do with it.

dibble9012 commented 3 years ago

How do you install the patch and run with homebridge-config-ui?

kate66 commented 3 years ago

Your patch fixed the error, but now I'm getting:

[04/09/2021, 12:21:03] Plugin 'homebridge-homeseer4' tried to register with an incorrect plugin identifier: 'homebridge-HomeSeerPlatform'. Please report this to the developer! [04/09/2021, 12:21:03] Registering platform 'homebridge-homeseer4.HomeSeer' [04/09/2021, 12:21:03] --- [04/09/2021, 12:21:03] Loading 2 platforms... [04/09/2021, 12:21:03] [Config] Initializing config platform... [04/09/2021, 12:21:03] [Config] Running in Service Mode [04/09/2021, 12:21:03] [HomeSeer] Initializing HomeSeer platform... [04/09/2021, 12:21:03] [HomeSeer] Start Failed to fetch HomeSeer device and control data, retrying in 15 seconds... Failed to fetch HomeSeer device and control data, retrying in 15 seconds... [04/09/2021, 12:21:23] [homebridge-homeseer4] This plugin is taking long time to load and preventing Homebridge from starting. See https://git.io/JtMGR for more info. Failed to fetch HomeSeer device and control data, retrying in 15 seconds... [04/09/2021, 12:21:43] [homebridge-homeseer4] This plugin is taking long time to load and preventing Homebridge from starting. See https://git.io/JtMGR for more info. (Homebridge never fully loads, it just keeps spamming this) -- I have also run tcpdump and I do not see it attempting to reach out to HomeSeer.

sesykes71 commented 3 years ago

I am seeing the same thing.

Steve

Sent from my iPhone.

On Sep 4, 2021, at 15:27, Kate Gerry @.***> wrote:

 Your patch fixed the error, but now I'm getting:

[04/09/2021, 12:21:03] Plugin 'homebridge-homeseer4' tried to register with an incorrect plugin identifier: 'homebridge-HomeSeerPlatform'. Please report this to the developer! [04/09/2021, 12:21:03] Registering platform 'homebridge-homeseer4.HomeSeer' [04/09/2021, 12:21:03] --- [04/09/2021, 12:21:03] Loading 2 platforms... [04/09/2021, 12:21:03] [Config] Initializing config platform... [04/09/2021, 12:21:03] [Config] Running in Service Mode [04/09/2021, 12:21:03] [HomeSeer] Initializing HomeSeer platform... [04/09/2021, 12:21:03] [HomeSeer] Start Failed to fetch HomeSeer device and control data, retrying in 15 seconds... Failed to fetch HomeSeer device and control data, retrying in 15 seconds... [04/09/2021, 12:21:23] [homebridge-homeseer4] This plugin is taking long time to load and preventing Homebridge from starting. See https://git.io/JtMGR for more info. Failed to fetch HomeSeer device and control data, retrying in 15 seconds... [04/09/2021, 12:21:43] [homebridge-homeseer4] This plugin is taking long time to load and preventing Homebridge from starting. See https://git.io/JtMGR for more info. (Homebridge never fully loads, it just keeps spamming this) -- I have also run tcpdump and I do not see it attempting to reach out to HomeSeer.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

jvmahon commented 3 years ago

I might have found the problem. 6 days ago, a new version (3.0.0) of the "fetch" library was published which has several breaking changes. I've now published a new version of homebridge-homeseer4 (Version 1.0.20) which forces the use of the prior (2.6.1) library.

Re-install homebridge-homeseer4 by using . . .

npm -g uninstall homebridge-homeseer4
npm -g install homebridge-homeseer4

Let me know if that works. It seems to fix the problem on Windows.

dibble9012 commented 3 years ago

Got it working, thanks!!

vansy02 commented 3 years ago

Working here on pi! Thanks so much for your help with this!

jvmahon commented 3 years ago

Looks like this has been fixed, so closing this comment.