monitor icon indicating copy to clipboard operation
monitor copied to clipboard

monitor stopped performing scans, bluetoothctl error

Open airdrummingfool opened this issue 4 years ago • 8 comments

I'm creating this issue mostly to document a problem I found, in case it happens to someone else.

I noticed after a long period (weeks) of uptime, at some point after a restart of HA and monitor (using an MQTT message to monitor/scan/restart), monitor stopped actually scanning and finding my devices.

monitor continued to respond to MQTT messages such as restart and status, but any time a scan was requested, nothing would be posted back to MQTT - no confidence report messages or anything indicating that the scan happened.

The only log entry that I could find that seemed relevant was a message from bluetoothctl regarding a source not found. The presence of this message during monitor's startup seemed to correlate with monitor not working.

bluetoothctl[2406]: Source ID 20 was not found when attempting to remove it

Restarting monitor (using monitor/scan/restart) did not fix things, nor did anything else I tried short of a full reboot of my Raspberry Pi.

It would be cool if there was a way to trigger a full reboot of the host device that monitor was running on via MQTT, for times where something like this happens. However, this might not be a realistic request: host devices/monitor setups vary considerably, and a simple sudo reboot might not always work.

airdrummingfool avatar Apr 14 '20 19:04 airdrummingfool

I have the same thing, the log shows the following: Apr 23 07:00:07 monitor bluetoothctl[8448]: Source ID 20 was not found when attempting to remove it

Running sudo bash monitor.sh shows: (bluetoothctl:15427): GLib-CRITICAL **: Source ID 20 was not found when attempting to remove it

Tried to use this: https://github.com/gadric/monitor/tree/dev-python-bluez because of https://github.com/andrewjfreyer/monitor/pull/295 This worked yesterday but gives me the same result today. Maybe @gadric can assist?

jlo88 avatar Apr 23 '20 06:04 jlo88

Did you connected your phones via monitor.sh -c <> for rssi?

gadric avatar Apr 23 '20 14:04 gadric

No, I have not connected any device with monitor.

airdrummingfool avatar Apr 23 '20 15:04 airdrummingfool

Please try to connect first. I did not modify the script to always measure rssi.

gadric avatar Apr 23 '20 19:04 gadric

@gadric my apologies, perhaps your question was not for me - I am not using your fork, just the vanilla monitor script. I am not looking for RSSI measurements.

airdrummingfool avatar Apr 25 '20 08:04 airdrummingfool

Update on this issue: my monitor instance became unavailable today. I did a simple sudo service monitor restart on the Pi, and received a similar bluetoothctl[]: Source ID x was not found when attempting to remove it error as the monitor process restarted. However, monitor successfully pinged my phone and reported me as 'home', and then successfully reported me as 'away' and back to 'home' in further testing. It would seem that receiving a "source ID" error does not guarantee that there will be a problem with monitor.

airdrummingfool avatar Apr 25 '20 08:04 airdrummingfool

FWIW I have multiple instances of monitor running, two on 0.2.197 and one on 0.2.200. Only the latest version gets the bluetoothctl error, but it seems to work regardless.

michaelblight avatar Apr 27 '20 06:04 michaelblight

@michaelblight helpful feedback. Thanks!

andrewjfreyer avatar Apr 28 '20 21:04 andrewjfreyer