monitor
monitor copied to clipboard
monitor stopped performing scans, bluetoothctl error
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.
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?
Did you connected your phones via monitor.sh -c <
No, I have not connected any device with monitor.
Please try to connect first. I did not modify the script to always measure rssi.
@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.
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.
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 helpful feedback. Thanks!