Closed axlthorell closed 4 years ago
Not sure actually, have been investigating where that message derives from, but haven't found anything yet. Looks to be from the noble lib, but the phrase isn't found. Continuing my investigation...
I think I've at least found why we get spammed with that, and that is that the noble lib looses the connection and instead of rising an error that we can listen to, it starts displaying warnings in the log instead. Why there's so many is because we send a ping packet to Plejd every 3 seconds.
Need to figure out how to catch this error and do a proper reconnect.
I got this in my log. I'm on 0.2.1.
onInterfaceStateChanged(poweredOn) scan() scan completed, found 16 device(s). onDeviceScanComplete() trying to connect to the mesh network. connecting to f528f1acd290 with addr f5:28:f1:ac:d2:90 and rssi -39 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to f8c872bfaad7 with addr f8:c8:72:bf:aa:d7 and rssi -39 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to f0dbfa8ef904 with addr f0:db:fa:8e:f9:04 and rssi -24 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to e9386487c452 with addr e9:38:64:87:c4:52 and rssi -29 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to f3512fd62648 with addr f3:51:2f:d6:26:48 and rssi -26 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to cd8b6aa7b964 with addr cd:8b:6a:a7:b9:64 and rssi -29 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to ce089221090a with addr ce:08:92:21:09:0a and rssi -45 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to ff454fb16bb9 with addr ff:45:4f:b1:6b:b9 and rssi -33 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to e0832a2623c6 with addr e0:83:2a:26:23:c6 and rssi -34 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to fcc8622ba94c with addr fc:c8:62:2b:a9:4c and rssi -43 onDeviceConnected() error: discovering characteristics timed out. trying next device. disconnect() connecting to c7e4ca93a8be with addr c7:e4:ca:93:a8:be and rssi -39 onDeviceConnected() authenticate() startPing() plejd: connected via bluetooth. (node:290) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 write listeners added. Use emitter.setMaxListeners() to increase limit noble warning: unknown peripheral c7e4ca93a8be error: writing to plejd: ReferenceError: uuid is not defined noble warning: unknown peripheral c7e4ca93a8be (node:290) UnhandledPromiseRejectionWarning: ReferenceError: uuid is not defined at NobleBindings.notify (/plejd/node_modules/@icanos/noble/lib/hci-socket/bindings.js:416:38) at Noble.notify (/plejd/node_modules/@icanos/noble/lib/noble.js:353:19) at Characteristic.notify (/plejd/node_modules/@icanos/noble/lib/characteristic.js:106:15) at Characteristic.unsubscribe (/plejd/node_modules/@icanos/noble/lib/characteristic.js:119:8) at PlejdService.unsubscribeCharacteristics (/plejd/ble.js:590:37) at PlejdService.onPingFailed (/plejd/ble.js:353:10) at PlejdService.emit (events.js:198:13) at PlejdService.ping (/plejd/ble.js:397:12) at Timeout.pingRef.setInterval (/plejd/ble.js:332:14) at ontimeout (timers.js:436:11) (node:290) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:290) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Wonderful, now I see what's wrong. Will try to fix this asap and push a new release.
I've pushed some changes to the dev branch, are anyone of you able to download the code in the dev branch and manually deploy the add-on to test it?
I don't wanna break the public branch with experimental code :-) I can't test this as my setup has been running for 3 weeks without a break.
However I suspect that the error happens when a Plejd device disconnects from Hass.io because of either the gateway connecting or maybe signal loss. Do all of you own the gateway?
I don't have a gateway, but I do use the Plejd app on my Android device to connect.
I've never deployed an add on manually. Is there some documentation on how to do it?
It's quite easy, either ssh/smb into the device or download the IDE Hass.io add-on if using that and browse the config folder, in there create a folder named addons
and in that one, create a plejd
folder.
In the plejd
folder, paste all files from the dev branch into it. Go to the HA web interface and click Hass.io in the left side menu, go to Add-ons store in the top menu and hit the refresh button in the top right corner. Look for Local add-ons in the top of the add-ons page and select that and install.
Guide with images can be found here: https://developers.home-assistant.io/docs/en/hassio_addon_tutorial.html
I checked the dev branch but didn't find any commits from today. There were however new commits and a 0.2.2 release on master.
I've updated the "official" addon in hass.io.
Are there commits on dev that you wanted me to test locally?
Haha, first day back from vacation and forgot to switch branch. Yeah, what can I say. Then there's no need for the dev branch atm :-)
This issue originates from pre 0.3.x, if you're experiencing this issue, please update to the newest version.
The error from #1 is back. I get
noble warning: unknown peripheral
in my log and the add-on stops working until I restart it.I'm running the 0.2.0 version and this is now a more frequent error than before. It happens once a day at least.
Any ideas on what is causing this error?