asednev / homebridge-plugin-govee

Govee H-series Thermometer Hygrometer plugin for Homebrige.
Apache License 2.0
53 stars 9 forks source link

Fixing the code in SRC for Ignore #53

Closed MrFly72 closed 2 years ago

MrFly72 commented 2 years ago

Fixed the code in the wrong place (dist) so this should now have this code in the src/platform.ts: //Now check if the device is in the ignore list, if it is, skip working on it const displayName = ${this.sanitize(reading.model)}; const IgnoredDeviceNames = this.config.IgnoreDeviceNames; if( IgnoredDeviceNames.includes(displayName)) { // it will return true if you DeviceName is one of array values else false //Device is in the Ignore-List so skip working on it this.log.debug("Device in Ignore List", displayName," skipping the device!"); return; }

asednev commented 2 years ago

@MrFly72 could you correct lint errors so that checks will pass?

MrFly72 commented 2 years ago

Done...

asednev commented 2 years ago

Thank you for your contribution!

rmaes4 commented 2 years ago

Updating to 1.1.5 caused a boot loop for me

====================
[18/03/2022, 14:28:01] ERROR LOADING PLUGIN homebridge-plugin-govee:
[18/03/2022, 14:28:01] Error: Cannot find module '/usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/bluetooth-hci-socket/lib/binding/bluetooth_hci_socket.node'
Require stack:
- /usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/bluetooth-hci-socket/index.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/hci-socket/hci.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/hci-socket/bindings.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/resolve-bindings.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/index.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/govee-bt-client/dist/index.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/dist/platform.js
- /usr/local/lib/node_modules/homebridge-plugin-govee/dist/index.js
- /usr/local/lib/node_modules/homebridge/lib/plugin.js
- /usr/local/lib/node_modules/homebridge/lib/pluginManager.js
- /usr/local/lib/node_modules/homebridge/lib/server.js
- /usr/local/lib/node_modules/homebridge/lib/cli.js
- /usr/local/lib/node_modules/homebridge/bin/homebridge
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/bluetooth-hci-socket/lib/native.js:6:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
MrFly72 commented 2 years ago

Update worked for me. Only thing I notice is that your path is different then mine. My node_modules are under /usr/lib/node_modules and not /usr/local/lib/node_modules

Not a Unix crack here, so I cannot explain this difference. Did you check, if the folder exist?

You can try installing the previous version on the plug-in page

rmaes4 commented 2 years ago

Not sure, I am using a very new Homebridge installation installed to a RPI 3 just a week ago. Saw a prompt to update, updated and got a boot loop with the aforementioned error. After downgrading to the previous version, the issue went away.

MrFly72 commented 2 years ago

Looks to me, that the sub-node-modules which are needed are not in the folder that is mentioned and though cannot be loaded. I wonder if they are missing or just are in a different folder. I am using a raspizero 2 w for this. Just wonder why your patches are different (or mine)... I think we have to wait for the main developer. I have only programmed a very small part which cannot lead to this error.

Write commented 2 years ago

Cause boot loop to me too. Reverted to 1.1.4 for now.

[3/20/2022, 8:50:31 PM] TypeError: Cannot read properties of undefined (reading 'includes')
    at GoveeHomebridgePlatform.goveeDiscoveredReading (/usr/lib/node_modules/homebridge-plugin-govee/src/platform.ts:114:28)
    at Noble.<anonymous> (/usr/lib/node_modules/homebridge-plugin-govee/node_modules/govee-bt-client/dist/index.js:59:9)
    at Noble.emit (node:events:520:28)
    at Noble.onDiscover (/usr/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/noble.js:213:10)
    at NobleBindings.emit (node:events:520:28)
    at NobleBindings.onDiscover (/usr/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:188:10)
    at Gap.emit (node:events:520:28)
    at Gap.onHciLeAdvertisingReport (/usr/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/hci-socket/gap.js:250:10)
    at Hci.emit (node:events:520:28)
    at Hci.processLeAdvertisingReport (/usr/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/hci-socket/hci.js:814:12)
    at Hci.processLeMetaEvent (/usr/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/hci-socket/hci.js:768:10)
    at Hci.onSocketData (/usr/lib/node_modules/homebridge-plugin-govee/node_modules/@abandonware/noble/lib/hci-socket/hci.js:596:12)
    at BluetoothHciSocket.emit (node:events:520:28)
[3/20/2022, 8:50:31 PM] Got SIGTERM, shutting down Homebridge...

RPI 4 4GB, if that matter

EDIT : Removing the config was enough to fix the issue

MrFly72 commented 2 years ago

Yours is handled in #59 It is not the same boot loop. It was my fault in handling an empty list of ignored devices. As an interim just add a device with name aaaaaaa or whatever so there is at least one device in the ignore list. I already sent a pull request with a fix

Write commented 2 years ago

Ok, sorry for the mistake.

Thanks for the information !