vojtamolda / homebridge-ecobee3-sensors

Homebridge plugin that exposes Ecobee 3 sensors as HomeKit accessories.
https://www.npmjs.com/package/homebridge-ecobee3-sensors
MIT License
26 stars 15 forks source link

Error on plugin Startup #37

Closed jmnovak50 closed 2 years ago

jmnovak50 commented 2 years ago

Hi,

I'm wondering if you can help with the follow issue?

[1/2/2022, 4:06:50 AM] ERROR INITIALIZING PLUGIN homebridge-ecobee3-sensors: [1/2/2022, 4:06:50 AM] Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/lib/node_modules/homebridge-ecobee3-sensors/node_modules/chalk/source/index.js from /usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js not supported. Instead change the require of index.js in /usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js to a dynamic import() which is available in all CommonJS modules. at Object. (/usr/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js:4:13) at Plugin.module.exports [as pluginInitializer] (/usr/lib/node_modules/homebridge-ecobee3-sensors/index.js:11:18) at Plugin.initialize (/usr/lib/node_modules/homebridge/lib/plugin.js:147:21) at PluginManager.initializePlugin (/usr/lib/node_modules/homebridge/lib/pluginManager.js:91:26) at PluginManager.initializeInstalledPlugins (/usr/lib/node_modules/homebridge/lib/pluginManager.js:83:24) at async Server.start (/usr/lib/node_modules/homebridge/lib/server.js:106:9) [1/2/2022, 4:06:50 AM] ====================

Thanks!

canerdianeh commented 2 years ago

Same here.

canerdianeh commented 2 years ago

When I change the require to an import, it loads up, but when discovering sensors, it throws the following error. This causes homebridge to restart, and the ecobee sensors plugin generates a new auth code.

TypeError: Chalk.blue is not a function at new EcobeeSensor (/usr/local/lib/node_modules/homebridge-ecobee3-sensors/source/sensor.js:18:23) at EcobeePlatform.sensors (/usr/local/lib/node_modules/homebridge-ecobee3-sensors/source/platform.js:259:18) at EcobeePlatform.<anonymous> (/usr/local/lib/node_modules/homebridge-ecobee3-sensors/source/platform.js:197:16) at IncomingMessage.emit (node:events:402:35) at endReadableNT (node:internal/streams/readable:1343:12) at processTicksAndRejections (node:internal/process/task_queues:83:21)

vojtamolda commented 2 years ago

Hello @canerdianeh and @jmnovak50,

Thanks for reporting the issue. Unfortunately, I don't have bandwidth to look into it right now. But I'll be happy to merge a pull request when you figure out what's causing the problem.

uoodsq commented 2 years ago

Publishing this commit should take care of this issue.

vojtamolda commented 2 years ago

Ooops... Yeah. Version 0.1.8 is out.

canerdianeh commented 2 years ago

It's working now, but requires reauthorization every time homebridge restarts, which is suboptimal.