Passive BLE Monitor integration

The instructions to install MiHome pertain to Xiaomi devices and is not necessary for Govee devices. I am confused when you say you installed the Govee App; you mean on a smart phone or tablet? The Govee app is not required either. Did you enable “active scan” in the integration configure options?

Thanks for the quick reply, Yes installed MiHome & Govee on my smart phone, thinking I needed to find the MAC address. Ok will remove.

Starting from the top, Installed BLE Monitor with HACS, left the AA’s, checked the active scan clicked submit, it said successful but not seeing any devices.

The HA log is showing this:
This error originated from a custom integration.

Logger: root
Source: custom_components/ble_monitor/init.py:550
Integration: Passive BLE monitor (documentation, issues)
First occurred: 9:28:06 AM (48 occurrences)
Last logged: 10:15:09 AM

Uncaught thread exception
Traceback (most recent call last):
File “/usr/local/lib/python3.9/threading.py”, line 954, in _bootstrap_inner
self.run()
File “/home/homeassistant/.homeassistant/custom_components/ble_monitor/init.py”, line 550, in run
mysocket[hci] = aiobs.create_bt_socket(hci)
File “/srv/homeassistant/lib/python3.9/site-packages/aioblescan/aioblescan.py”, line 1688, in create_bt_socket
family=socket.AF_BLUETOOTH, type=socket.SOCK_RAW, proto=socket.BTPROTO_HCI
AttributeError: module ‘socket’ has no attribute ‘AF_BLUETOOTH’

Discovery is checked too? If you haven’t yet, also restart Home Assistant.

yes to both your question and I also did setcap & getcap since I’m running HA core

A few things to check.

  • move the devices next to the Bluetooth receiver to ensure there is no interference.
  • make sure that the MAC address listed under “Mac address Bluetooth interface” is the same MAC as the hardware interface.
  • Check the HA logs under Configuration->Logs and ensure there are no error messages.
  • I have never used HA Core before but ensure that user set up for the account has permissions to bluetooth devices.

If all of that fails, use a tool like btmon:
sudo btmon | fgrep 5101
or bluetoothctl:
bluetoothctl scan.clear && bluetoothctl scan on | fgrep 5101

to search for the name and ensure it is being discovered.

Check the HA logs under Configuration->Logs and ensure there are no error messages.
Did you see the error message I posted above?

Sorry, I missed that. What version of Python 3.9 are you using and which Linux distro are you using? There are various versions where AF_BLUETOOTH is not enabled or there were issues with it. I would suggest using the HA docker container which has a version that works correctly.

Python 3.9.1 & Raspbian OS Lite 32bit (2021-05-07)
Will read up on DOCKER but CORE has been great for 4 years now.
Maybe time to try something new.

If you are not running anything else on the device other than HA, I would suggest just using the Raspberry Pi image. You can also try updating Python using apt.

could you explain this a little more, I’m not seeing a MAC address anywhere for my Govee devices

This is likely not the issue given the error message you posted. Under integrations, click on configure for the Passive BLE monitor, the first field should be named “Mac address Bluetooth interface”. This is the MAC address for the Bluetooth controller in the Raspberry PI. Depending on configurations, external dongles, virtualized devices, etc, there may be more than one listed and the one selected is not the physical device needed to scan.

That makes sense thanks for the education, I’m seeing AA:AA:AA:AA:AA:AA

AA:AA:AA:AA:AA:AA …that’s not right or you have the easiest BT MAC addresses to memorize. If you click on the field is there another MAC? If so, click on that and uncheck the MAC address that sounds like a visit to the doctor.

1 Like

Thanks for your help, but I think I need to read up on Bluetooth some more and see if I need to activate/install something else. The A’s are all I see.

Please check the FAQ on github. This error (AttributeError: module ‘socket’ has no attribute ‘AF_BLUETOOTH’ ) is explained in the faq and normally means that you build python without Bluetooth support. Instructions are in the FAQ how to solve this.

Thank you, I’ll give that a try. Learning alot about BLUETOOTH today.

Here is the link to the FAQ

1 Like

4.5.1 has been released

BLE monitor now supports the new long term statistics that has been added in Home Assistant 2021.8 for most sensor entities starting from version 4.5.1 (and higher). Statistics Graph Card - Home Assistant

1 Like

Bug report (so tiny that I didn’t want to open an issue about it):

The website link at the GitHub repository is pointing to a topic that doesn’t exist anymore. There is a correct link at the end of the README file; so it would be just a matter of copying that link into the GitHub repository settings.

The documentation will be updated completely with a new layout, thanks to @Thrilleratplay. I’m not sure which link you mean but he said that he fixed some of the links already. So, let’s leave it for now, the new docs will be available in about one week. Thank for reporting anyways.