homebridge-plugins / homebridge-govee

Homebridge plugin to integrate Govee devices into HomeKit.
MIT License
487 stars 49 forks source link

Noble keeps searching for new devices #265

Closed X19S closed 2 years ago

X19S commented 2 years ago

What issue do you have? Please be as thorough and explicit as possible.

Noble keeps searching for new devices until it freezes with a buffer overflow

Details of your setup.

Please paste any relevant logs below.

[14/06/2022, 20:08:50] Homebridge v1.4.1 (HAP v0.10.2) (Homebridge 1DD3) is running on port 51378.
[14/06/2022, 20:08:51] [Govee] Login successful.
[14/06/2022, 20:08:51] [Govee] HTTP/AWS clients enabled as Govee username and password provided.
[14/06/2022, 20:08:51] [Govee] Disabling API client as API key not provided.
[14/06/2022, 20:08:54] [Govee] BLE client enabled as packages successfully found.
[14/06/2022, 20:08:54] [Govee] [H6125_AB81] initialising with options {"adaptiveLightingShift":0,"brightnessStep":1,"logging":"debug"}.
[14/06/2022, 20:08:54] [Govee] [H6125_AB81] initialised with id [96:AB:A4:C1:38:E9:AB:81] [H6125].
[14/06/2022, 20:08:55] [Govee] [noble] stateChange: poweredOn.
[14/06/2022, 20:08:56] [Govee] ✓ Setup complete. This plugin currently has a 5☆ rating on HOOBS! http://bit.ly/hb-govee-review
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] not sending AWS update as not available or enabled.
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] starting update with params [{"cmd":1,"data":0}].
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] starting timer.
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] starting scan.
[14/06/2022, 20:09:04] [Govee] [noble] scanning started.
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] scanning started.
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] starting loop.
[14/06/2022, 20:09:04] [Govee] [noble] found device [dc:45:f0:a0:18:f4] [undefined].
[14/06/2022, 20:09:04] [Govee] [noble] found device [a4:c1:38:e9:ab:81] [ihoment_H6125_AB81].
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] has been reported [discoverable] via BLE.
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] attempting to connect.
[14/06/2022, 20:09:04] [Govee] [noble] scanning stopped.
[14/06/2022, 20:09:04] [Govee] [noble] scanning started.
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] has been reported [connected] via BLE.
[14/06/2022, 20:09:04] [Govee] [H6125_AB81] finding device characteristics.
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found some device characteristics.
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found different characteristic [2a00].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found different characteristic [2a01].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found different characteristic [2a04].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found different characteristic [2a50].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found different characteristic [2a05].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found different characteristic [000102030405060708090a0b0c0d2b12].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found different characteristic [000102030405060708090a0b0c0d2b10].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found correct characteristic [000102030405060708090a0b0c0d2b11].
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] found correct characteristic so breaking loop.
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] [BLE] sending update {1: 0}.
[14/06/2022, 20:09:06] [Govee] [H6125_AB81] current state [off].
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] not sending AWS update as not available or enabled.
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] starting update with params [{"cmd":1,"data":1}].
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] starting timer.
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] starting scan.
[14/06/2022, 20:09:10] [Govee] [noble] scanning started.
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] scanning started.
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] starting loop.
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] found correct characteristic so breaking loop.
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] [BLE] sending update {1: 1}.
[14/06/2022, 20:09:10] [Govee] [H6125_AB81] current state [on].
[14/06/2022, 20:09:10] [Govee] [noble] found device [3f:f4:6a:74:bd:68] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [6d:69:f6:a0:a0:66] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [02:fc:fc:22:51:8c] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [50:de:06:86:22:d5] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [88:c6:26:a0:52:92] [].
[14/06/2022, 20:09:10] [Govee] [noble] found device [60:93:90:e1:af:a9] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [14:4f:b3:3d:41:dd] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [35:ee:8e:31:44:0a] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [69:11:40:fa:06:71] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [cc:9e:27:83:f1:e8] [Philips S7783].
[14/06/2022, 20:09:10] [Govee] [noble] found device [f6:7a:43:f6:37:51] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [5c:35:2f:c9:56:b1] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [72:01:a9:52:5c:2e] [undefined].
[14/06/2022, 20:09:10] [Govee] [noble] found device [78:fb:56:6d:94:c8] [undefined].
[14/06/2022, 20:09:11] [Govee] [noble] found device [c3:f3:28:3a:f7:ab] [undefined].
[14/06/2022, 20:09:11] [Govee] [noble] found device [dc:45:f0:a0:18:f4] [undefined].
[14/06/2022, 20:09:13] [Govee] [noble] found device [cb:f6:67:1d:d4:25] [undefined].
[14/06/2022, 20:09:23] [Govee] [noble] found device [a4:c1:38:e9:ab:81] [ihoment_H6125_AB81].
[14/06/2022, 20:09:23] [Govee] [H6125_AB81] has been reported [discoverable] via BLE.
[14/06/2022, 20:09:23] [Govee] [H6125_AB81] attempting to connect.
processLeAdvertisingReport: Caught illegal packet (buffer overflow): Error: Peripheral already connected
[14/06/2022, 20:09:23] [Govee] [noble] scanning stopped.
jro07880 commented 2 years ago

I also am having the same issue. I'm running the latest Hoobs on a raspberry pi 3 with all the latest updates and using the 5.2.1-2 beta plugin

6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] starting update with params [{"cmd":1,"data":0}].
6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] starting timer.
6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] starting scan.
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] scanning started.
6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] scanning started.
6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] starting loop.
6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] found correct characteristic so breaking loop.
6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] [BLE] sending update {1: 0}.
6/30/2022, 12:01:19 PMGovee BridgeGovee[H613B] current state [off].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [4c:c9:5e:06:a4:b9] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [57:b7:aa:35:f0:40] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [69:51:4d:fd:11:ea] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [50:da:7f:07:72:ae] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [61:c2:4e:56:45:bb] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [5f:39:3d:38:c4:7e] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [32:50:31:c0:50:88] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [6e:e1:e0:40:c2:de] [undefined].
6/30/2022, 12:01:19 PMGovee BridgeGovee[noble] found device [71:4b:1b:3d:2f:5e] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [54:b7:e5:66:fe:f7] [PB2K1FEF7].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [5a:cb:f3:21:75:ec] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [78:f4:03:f7:3f:9c] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [49:df:54:15:32:84] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [43:03:03:75:9b:62] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [5e:9e:39:16:29:fd] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [59:99:99:ea:9b:c6] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [1c:b3:c9:10:4a:73] [undefined].
6/30/2022, 12:01:20 PMGovee BridgeGovee[noble] found device [2e:79:b2:23:f6:de] [undefined].
6/30/2022, 12:01:21 PMGovee BridgeGovee[noble] found device [7a:8e:34:33:b5:7b] [undefined].
6/30/2022, 12:01:21 PMGovee BridgeGovee[noble] found device [e4:58:f5:6b:c0:d7] [undefined].
6/30/2022, 12:01:21 PMGovee BridgeGovee[noble] found device [e9:33:9e:5f:b2:5b] [undefined].
6/30/2022, 12:01:21 PMGovee BridgeGovee[noble] found device [66:4a:6b:80:19:72] [undefined].
6/30/2022, 12:01:21 PMGovee BridgeGovee[noble] found device [7e:02:a6:31:8a:29] [undefined].
6/30/2022, 12:01:21 PMGovee BridgeGovee[noble] found device [e7:42:40:ba:ef:c1] [undefined].
6/30/2022, 12:01:21 PMGovee BridgeGovee[noble] found device [6b:90:3f:ad:b9:62] [undefined].
6/30/2022, 12:01:22 PMGovee BridgeGovee[noble] found device [45:7f:ff:34:92:4e] [undefined].
6/30/2022, 12:01:22 PMGovee BridgeGovee[noble] found device [ea:08:55:5e:fe:25] [undefined].
6/30/2022, 12:01:23 PMGovee BridgeGovee[noble] found device [c2:ba:50:67:02:bf] [undefined].
6/30/2022, 12:01:23 PMGovee BridgeGovee[noble] found device [5e:d4:fa:3f:4b:f1] [undefined].
6/30/2022, 12:01:25 PMGovee BridgeGovee[noble] found device [44:12:1a:45:89:af] [undefined].
6/30/2022, 12:01:30 PMGovee BridgeGovee[noble] found device [7c:a6:b0:5f:e7:d7] [GBK_H613D_E7D7].
6/30/2022, 12:01:30 PMGovee BridgeGovee[H613B] has been reported [discoverable] via BLE.
6/30/2022, 12:01:30 PMGovee BridgeGovee[H613B] attempting to connect.
6/30/2022, 12:01:30 PMGovee BridgeGovee[noble] scanning stopped.
6/30/2022, 12:01:30 PMGovee BridgeERRORprocessLeAdvertisingReport: Caught illegal packet (buffer overflow): Error: Peripheral already connected
eskridgebreskr commented 2 years ago

I am also seeing this same issue of constant searching for and finding devices. Raspberry Pi 4 4GB, Homebridge UI v1.5.0 plugin v5.2.0

[02/07/2022, 20:29:42] [Govee] [noble] found device [68:c8:8f:d8:03:bb] [N02PE]. [02/07/2022, 20:29:42] [Govee] [noble] found device [08:66:98:ae:96:74] [undefined]. [02/07/2022, 20:29:42] [Govee] [noble] found device [f2:d1:67:e3:ce:df] [undefined]. [02/07/2022, 20:29:43] [Govee] [noble] found device [c9:6b:11:6c:b7:95] [undefined]. [02/07/2022, 20:29:45] [Govee] [noble] found device [5b:d0:78:10:5b:38] [undefined]. [02/07/2022, 20:29:45] [Govee] [noble] found device [d7:3b:3c:0f:29:76] [undefined]. [02/07/2022, 20:29:46] [Govee] [noble] found device [df:9a:93:fa:2b:20] [undefined]. [02/07/2022, 20:29:47] [Govee] [noble] found device [df:de:84:3b:09:42] [undefined]. [02/07/2022, 20:29:52] [Govee] [noble] found device [ca:a2:c7:d9:8c:0c] [undefined]. [02/07/2022, 20:29:53] [Govee] [noble] found device [df:ef:56:64:69:20] [N078W]. [02/07/2022, 20:29:54] [Govee] [noble] found device [e2:00:b4:8e:b7:6d] [undefined]. [02/07/2022, 20:30:00] [Govee] [noble] found device [dd:ff:bb:c8:73:39] [undefined]. [02/07/2022, 20:30:00] [Govee] [noble] found device [f0:aa:f0:03:4e:66] [undefined]. [02/07/2022, 20:30:01] [Govee] [noble] found device [c9:d2:a8:ce:0d:8a] [undefined]. [02/07/2022, 20:30:04] [Govee] [noble] found device [df:ac:bc:15:d3:f2] [undefined]. [02/07/2022, 20:30:08] [Govee] [noble] found device [f8:c8:8f:bf:d9:3e] [undefined]. [02/07/2022, 20:30:08] [Govee] [noble] found device [d4:bc:25:76:df:4c] [undefined]. [02/07/2022, 20:30:10] [Govee] [noble] found device [d0:0a:77:d2:ea:01] [undefined]. [02/07/2022, 20:30:17] [Govee] [noble] found device [63:6b:da:96:71:ff] [undefined]. [02/07/2022, 20:30:21] [Govee] [noble] found device [51:71:77:0d:1a:b6] [N04KG]. [02/07/2022, 20:30:22] [Govee] [noble] found device [c4:11:fb:12:2e:41] [undefined]. [02/07/2022, 20:30:30] [Govee] [noble] found device [d0:d9:4f:83:1f:7d] [MEATER]. [02/07/2022, 20:30:30] [Govee] [noble] found device [f8:4f:81:b6:cd:3f] [Keyboard K850]. [02/07/2022, 20:30:33] [Govee] [noble] found device [5d:18:b7:89:6d:e1] [undefined]. [02/07/2022, 20:31:23] [Govee] [noble] found device [5f:49:d0:6d:9d:d5] [undefined]. [02/07/2022, 20:31:48] [Govee] [noble] found device [78:9c:85:13:37:e3] [M107HR9]. [02/07/2022, 20:31:50] [Govee] [noble] found device [c7:0b:6a:0b:45:8e] [undefined]. [02/07/2022, 20:31:52] [Govee] [noble] found device [7d:e4:9e:00:2b:11] [undefined]. [02/07/2022, 20:32:18] [Govee] [noble] found device [78:9c:85:11:59:d8] [undefined]. [02/07/2022, 20:32:29] [Govee] [noble] found device [44:67:55:34:2d:29] [bhyve_242D29]. [02/07/2022, 20:34:37] [Govee] [noble] found device [d0:d9:4f:83:30:65] [MEATER]. [02/07/2022, 20:35:37] [Govee] [noble] found device [39:3c:b1:67:f6:6c] [undefined]. [02/07/2022, 20:35:37] [Govee] [noble] found device [4e:79:0e:8c:75:96] [undefined]. [02/07/2022, 20:35:57] [Govee] [noble] found device [44:67:55:9a:03:5d] [undefined]. [02/07/2022, 20:36:15] [Govee] [noble] found device [65:d1:1c:dd:c9:a7] [N02SB]. [02/07/2022, 20:36:55] [Govee] [noble] found device [7c:ae:ac:25:1b:1a] [undefined]. [02/07/2022, 20:36:58] [Govee] [noble] found device [67:ce:40:ec:ab:44] [undefined]. [02/07/2022, 20:36:58] [Govee] [noble] found device [26:a6:dc:c6:3e:f0] [undefined]. [02/07/2022, 20:36:58] [Govee] [noble] found device [44:44:d4:7a:3c:9c] [undefined]. [02/07/2022, 20:37:14] [Govee] [noble] found device [ef:b3:b9:24:c7:21] [undefined]. [02/07/2022, 20:37:18] [Govee] [noble] found device [6d:fb:83:73:aa:88] [undefined]. [02/07/2022, 20:37:19] [Govee] [noble] found device [10:d3:1e:4b:45:7d] [undefined]. [02/07/2022, 20:38:31] [Govee] [noble] found device [1e:ea:da:73:f2:94] [undefined]. [02/07/2022, 20:39:27] [Govee] [noble] found device [ff:39:5d:48:6c:54] [undefined]. [02/07/2022, 20:39:37] [Govee] [noble] found device [51:d8:c1:95:00:4a] [undefined]. [02/07/2022, 20:40:02] [Govee] [noble] found device [6b:cd:61:e6:70:00] [N04KG].

bwp91 commented 2 years ago

Hey guys

If you don’t use bluetooth for any of your govee devices, you can update to the beta version of the plugin and it will totally disable the plugin loading bluetooth.

If you do use bluetooth for controlling govee devices, this logging is normal, a few users are experiencing bluetooth issues at the moment and it’s much easier to debug with these logs.

They will appear when you try to control a bluetooth device.

X19S commented 2 years ago

The problem is in the last line of my issue:

[03/07/2022, 16:16:19] [Govee] [H6125_AB81] attempting to connect. processLeAdvertisingReport: Caught illegal packet (buffer overflow): Error: Peripheral already connected

After this, the plugin (or noble, I don't know) won't connect to a Bluetooth device anymore. The only fix I can do then is restarting Homebridge.

jro07880 commented 2 years ago

Rolling back to version 5.1.0 resolved my issue. I'm no longer getting the buffer overflow error.

bwp91 commented 2 years ago

Will check the differences between versions and try and get a new beta sorted soon (i’ll post on here when released)

i am really trying my best with this bluetooth and noble but i feel like i’m playing whack a mole with fixing one issue and three others pop up

eskridgebreskr commented 2 years ago

And as suggested, updating to the 5.2.1 beta solved the issue too, since none of my devices are being used over bluetooth only. Thanks!

X19S commented 2 years ago

Rolling back to version 5.1.0 resolved my issue. I'm no longer getting the buffer overflow error.

Sadly, rolling back to version 5.1.0 did not resolve it for me.

As speaking of the beta version, will the Bluetooth function be disabled in future versions entirely? For now, my one device can only be controlled over Bluetooth.

bwp91 commented 2 years ago

As speaking of the beta version, will the Bluetooth function be disabled in future versions entirely?

No, in a recent release I experimented with enabling bluetooth functionality without the need to explicitly enable it in the config. Reverting this change due to the fact that a lot of users don't want or can't use bluetooth as the main method of connecting to devices. So the plugin will go back to how it was I mean explicitly enabling bluetooth per device.

@X19S can you try the newest beta of the plugin? I've changed the code so it disconnects immediately from the device after sending a command (before it would remain connected for a few seconds in case another command was sent quickly)

X19S commented 2 years ago

I have now tested the plugin v5.2.1-beta.7 a bit, and it runs stable.

Additionally, I tested if the changing of the colors runs without problems.

The only thing is that the brightness fader in the Apple Home app must not be changed too slowly, otherwise the plugin is quite behind. It can even happen that the Home app reports "Unresponsive" to the device.

The fader had already crashed the Noble/Plugin before the update (buffer overflow), now it just lags behind. After some time, the values are slowly transferred to the LED device and then the home app also reports "Responsive" again.

I don't know how a good mix of quickly closing the connection and waiting for further commands could be created. It doesn't bother me because I never use the fader, but in the future someone will probably have problems with it.

The bottom line is that it works for me now. If you want, the issue can be closed, or it will stay open until we find a way to improve the fader.

X19S commented 2 years ago

I just saw on this page (https://github.com/bwp91/homebridge-govee/wiki/Bluetooth-Control) that these commands should be executed if there are problems with Bluetooth.

At first, I thought all your work was now superfluous because I didn't read the documentation properly, but even after installing the packages and installing the old version of the plugin, I still got the buffer overflow.

After that, I wanted to go back to the beta version, but I got serious errors displayed by Homebridge.

First I uninstalled the ""unnecessary"" packages again and then renamed the folder as the log says.

Now the beta plugin works again without problems.

I just wanted to say it, maybe this information will help you for other things.

58 error code ENOTEMPTY
59 error syscall rename
60 error path /var/lib/homebridge/node_modules/homebridge-govee
61 error dest /var/lib/homebridge/node_modules/.homebridge-govee-ppCAhDTt
62 error errno -39
63 error ENOTEMPTY: directory not empty, rename '/var/lib/homebridge/node_modules/homebridge-govee' -> '/var/lib/homebridge/node_modules/.homebridge-govee-ppCAhDTt'
64 verbose exit -39
65 timing npm Completed in 21790ms
66 verbose unfinished npm timer reify 1657105941848
67 verbose unfinished npm timer reify:retireShallow 1657105961064
68 verbose code -39
69 error A complete log of this run can be found in:
69 error     /home/homebridge/.npm/_logs/2022-07-06T11_12_19_483Z-debug-0.log