Closed moritzmhmk closed 1 year ago
The following pre-checks failed:
:x: Failed to import plugin: EAFNOSUPPORT, Address family not supported by protocol
Comment /check
to run checks again.
/check
:white_check_mark: Pre-checks completed successfully.
Hi @moritzmhmk
How does your plugin handle cases where abandonware/noble
has not been able to install - does the plugin properly catch the error in this case?
Hi it will log an error message here and since the accessory never receives a value for temperature and humidity it will be marked as unreachable in the Home App.
alrighty thank you for confirming.
also, does this plugin offer any more functionality than the already verified switchbot plugins?
It might be worth a note in your readme about how your plugin is different.
Whilst there is no official plugin verification rule against multiple plugins with the same functionality, I think it would be helpful for users who are looking for their right plugin to see (e.g. in your readme) how yours is different from the others
When trying to get the sensor to work on my Raspberry Pi 4 with Docker, I kept getting the error adapter is not ready: unknown
, while other (non switchbot) BLE devices in the setup worked fine. Tracking down the error, I found that the node-switchbot
library used by the other plugins was causing the error. Looking into creating a PR for node-switchbot
, I found that it is easier to create a new plugin from scratch that only handles the device in question and does not rely on dependencies (besides noble
).
So, unlike the other alternatives, my package is written according to the philosophy of doing only one thing but doing it well and having as few dependencies as reasonably possible. I tried to hint towards this in the README, if you have a suggestion on how to better communicate this to other users I will be happy to adjust the README accordingly.
I updated the README.
After some communication with the creator of the other plugin, I looked at the problem again.
The node-switchbot
package indeed has a BLE initialisation that is not compatible with my (and others Docker based) setup. Furthermore, and this is what made the troubleshooting so confusing, there is no support in node-switchbot
at all for the sensor in question and additionally a wrong identifier used in the homebridge-switchbot
plugin.
I have created corresponding PRs in both repos. Nevertheless, I will keep using my plugin due to its few dependencies and the concise code. For all those who also only use the hygrometers from Switchbot, it might be a lightweight alternative.
One more small thing, after installing the plugin and configuring an accessory with the ble address of a thermometer sensor with a different brand (yes, I wasn't expecting to work!) but it does throw homebridge into a crash loop:
[03/09/2023, 14:16:17] [Hygrometer] Restarting Process...
[03/09/2023, 14:16:19] [Hygrometer] Launched child bridge with PID 11611
[03/09/2023, 14:16:19] Registering accessory 'homebridge-switchbot-sensor-ble.SwitchBotSensorBLE'
[03/09/2023, 14:16:19] [Hygrometer] Loaded homebridge-switchbot-sensor-ble v1.3.2 child bridge successfully
[03/09/2023, 14:16:19] Loaded 0 cached accessories from cachedAccessories.0E7C2D126D68.
[03/09/2023, 14:16:19] [Hygrometer] SwitchBotSensorBLE finished initializing!
[03/09/2023, 14:16:19] Homebridge v2.0.0-beta.1 (HAP v1.0.0-beta.8) (Hygrometer) is running on port 44449.
TypeError: Cannot read properties of undefined (reading '10')
at SwitchBotSensorBLE.updateFromAdvertisement (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/src/accessory.ts:86:13)
at Noble.<anonymous> (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/src/accessory.ts:72:12)
at Noble.emit (node:events:514:28)
at Noble.onDiscover (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/noble.js:218:10)
at NobleBindings.emit (node:events:514:28)
at NobleBindings.onDiscover (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:213:10)
at Gap.emit (node:events:514:28)
at Gap.onHciLeAdvertisingReport (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/hci-socket/gap.js:175:10)
at Hci.emit (node:events:514:28)
at Hci.processLeAdvertisingReport (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/hci-socket/hci.js:1148:12)
[03/09/2023, 14:16:22] [Hygrometer] Child bridge process ended
[03/09/2023, 14:16:22] [Hygrometer] Process Ended. Code: 1, Signal: null
[03/09/2023, 14:16:29] [Hygrometer] Restarting Process...
[03/09/2023, 14:16:30] [Hygrometer] Launched child bridge with PID 11626
[03/09/2023, 14:16:30] Registering accessory 'homebridge-switchbot-sensor-ble.SwitchBotSensorBLE'
[03/09/2023, 14:16:30] [Hygrometer] Loaded homebridge-switchbot-sensor-ble v1.3.2 child bridge successfully
[03/09/2023, 14:16:30] Loaded 0 cached accessories from cachedAccessories.0E7C2D126D68.
[03/09/2023, 14:16:31] [Hygrometer] SwitchBotSensorBLE finished initializing!
[03/09/2023, 14:16:31] Homebridge v2.0.0-beta.1 (HAP v1.0.0-beta.8) (Hygrometer) is running on port 44449.
TypeError: Cannot read properties of undefined (reading 'data')
at SwitchBotSensorBLE.updateFromAdvertisement (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/src/accessory.ts:91:38)
at Noble.<anonymous> (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/src/accessory.ts:72:12)
at Noble.emit (node:events:514:28)
at Noble.onDiscover (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/noble.js:218:10)
at NobleBindings.emit (node:events:514:28)
at NobleBindings.onDiscover (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:213:10)
at Gap.emit (node:events:514:28)
at Gap.onHciLeAdvertisingReport (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/hci-socket/gap.js:175:10)
at Hci.emit (node:events:514:28)
at Hci.processLeAdvertisingReport (/usr/local/lib/node_modules/homebridge-switchbot-sensor-ble/node_modules/@abandonware/noble/lib/hci-socket/hci.js:1148:12)
[03/09/2023, 14:16:31] [Hygrometer] Child bridge process ended
[03/09/2023, 14:16:31] [Hygrometer] Process Ended. Code: 1, Signal: null
Thanks for the feedback, this is now fixed in v1.3.3.
/check
(trying against plugin v1.4.0)
@moritzmhmk apologies i must have closed this accidentally
I wondered if closing the issue meant that verification was about to happen 😅
Is there anything left that needs to be addressed code-wise?
Yeah sorry about this i just happened to be going through closed issues and saw yours and remembered it hadn’t been verified. Must have just closed by mistake so apologies. Will have a look through the checklist a bit later 👍🏻
/check
:white_check_mark: Pre-checks completed successfully.
Everything Looks Good!
Congratulations! Your plugin has been verified.
You can now add the Verified by Homebridge badge to your plugin's README:
[![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
Your plugin is now also eligible to display a :heart: Donate button on its tile in the Homebridge UI. See https://github.com/homebridge/homebridge/wiki/Donation-Links for instructions.
If for any reason in the future you can no longer maintain your plugin, please consider transferring it to our unmaintained plugins repo. We can take ownership until another willing developer comes along.
Don't forget to join the official Homebridge Discord server, where plugin developers can get tips and advice from other developers and the Homebridge project team in the #plugin-development channel!
Thank you for your contribution to the Homebridge Community. https://homebridge.io
sorry for the confusion in the interim re accidentally closing the issue
nice 👍
Thank you - I just added the badge in the Readme 🙂
Link To GitHub Repo
https://github.com/moritzmhmk/homebridge-switchbot-sensor-ble
Link To NPM Package
https://www.npmjs.com/package/homebridge-switchbot-sensor-ble