Passive BLE Monitor integration

Thank you ! you are a legend!

1 Like

Great Component, thank you!

I also have a question:

I would like to scan for BLE messages for like 20sec and then pause the scan (power-off the HCI scanner) for 60sec, in order to save energy, then start scannig again for 20sec. How can this be done?

Thank you for your input,

Fred

Passive BLE monitor is a passive scanner, so it wont affect battery life (with active scan set to False). It is just listening to BLE advertisements, it does not send anything to your sensors, like is being done with sensors that require a connection.

@Ernst you misunderstand where I want to save energy: At the scanning device, not the BLE sensor devices that are scanned by this device.

A, sorry. That isnā€™t possible at the moment. It is also a bit tricky if you have e.g. motion sensors, in that case it will need to run the scanning continuously. There are also sensors, like LYWSD03MMC, that update pretty rarely, like once per 10 minutes (with default firmware).

1 Like

6.7.1 release

Since the last update I mentioned in this topic (6.4.3), we have added several new sensors and fixed some bugs.

new sensors

  • Govee Meat Thermometer (H5183)
  • Inkbird IBS-TH2
  • Switch and opening sensor for LYWSD03MMC with ATC firmware (sensors are disabled by default, but can be enabled via the UI)

bug fixes

  • Fixes in auto-restart logic

Other
We have also found a solution for this nasty bug

HCIdump thread: Runtime error while stop scan request on hci0: Event loop stopped before Future completed.

If you are facing this bug, please check the faq, especially step 3, which is refering to another article in the FAQ. We have added the following note, which seems to solve it for some people.

Note 2

When Home Assistant is installed in pyenv, the output of the command which python3 looks like /home/homeassistant/.pyenv/johndoe/python3 but this is not the real link to actual python3 interpreter. The actual binary is placed in a folder like /home/homeassistant/.pyenv/versions/3.9.9/bin/python3.9 (it might slightly differ depending on the installed python version). So to grant root access to python, it is required to run the setcap command with the correct path, i.e.

setcap 'cap_net_raw,cap_net_admin+eip' /home/homeassistant/.pyenv/versions/3.9.9/bin/python3.9

Hi,
New to HASSOS and keen to add BLE devices. Iā€™ve followed the instructions on a clean install using HACS on HASSOS but I keeps reporting the error. Added debug but this just keeps reporting no device advertised every 60 seconds. (also, I canā€™t putty in and using Terminal add-on I canā€™t work out how to copy text. Itā€™s making me feel very dumb)

Seems everyone else with a similar error once had it working but Iā€™ve never been able to get past this point.
Hope someone can point out where Iā€™m going wrong?
Cheers
Martin

@mjb183
There is an FAQ article about this error, which you can check for possible solutions. But, normally, this issue occurs on HA core, venv or docker installations, that have issues with the access rights to Bluetooth. In your case, you are running HA Os, which makes it difficult to run most solutions. Canā€™t remember that I have seen this issue on HA OS before.

You can install the SSH & Web Terminal add in in HA to gain access to the terminal, although the terminal is still limited (as in, you canā€™t run every command). In that way, you could run some of the tips in the FAQ. Otherwise, check this issue on github

Thanks for getting back so quick!

Hmmm, I didnā€™t find that FAQ so thanks. Seems this might some digging as bluetoothctl command canā€™t see any controllers even though the log shows a mac address. As you say, sadly I have very limited command available through the Terminal add-on.

Iā€™ll persevere for a bit longer and see if I can find the solution.

Thanks
Martin

Right after midnight today I started getting an error that just says:

SensorPush device type id 83 unknown

The error is occurring hundreds of times a minute. I just cleared my logs and within 3 minutes it was already up to 500 times. Does anyone know what this error means? I donā€™t have any SensorPush devices at all, and it looks like the only SensorPush devices supported by this integration are temperature/humidity sensors, which I also donā€™t have (from any brand).

Iā€™ve never gotten this error before in the year Iā€™ve been using this integration, and I definitely didnā€™t get any new devices since midnight.

@scoutamis Try updating to 6.9.2, I thinks this should fix the issue.

Weird, it seems to have stopped on its own at exactly midnight. Just as strangely as it started at exactly midnight. Either way, I will update to 6.9.2 in case it comes back. Thanks!

I am sorry if there was an answer already but I cannot find it using search.
Can I use this integration without having bluetooth on my HA host? My HA is running on a virtual machine and I do not have any bluetooth dongles on that server nor I want to spend time making it available for my virtual machine if I attach one.
I have several ESP32 in my apartment up and running and I want to use them as a source of data from BLE devices for this integration. Is it possible?

Yes, that is possible. You can use ESPHome with BLE gateway to forward the received BLE messages to BLE monitor over WiFi. BLE monitor has a special service to process this data, without having the need to an actual Bluetooth interface. Check this page for a link to BLE gateway.

1 Like

I just added this integration to try and add my Xiaomi Mijia Temperature sensor, but it appears that whenever I enable this integration it turns my raspi into a potato. SSH lag through the roof (10+seconds for characters to start appearing), network-based integrations fail to load (e.g. sensibo for my dumb ac), and lovelace struggles to load pages. I canā€™t see anything in the logs related to this, just the side effects (i.e. failed to establish connection with sensibo), but when I disable the ble integration all the symptoms go away, and then when I re-enable it they come back

Is your HA device connected to WiFi? I suspect that your Bluetooth radio is interfering with your WiFi signal. Try using the 5 GHz Wifi or a cable, just to see if thatā€™s the issue.

No Problem, I have 4 on one esp32:

this is how my YAML looks:

sensor:
  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:A4:C1:38
    bindkey: "Insert your bindkey within the quotes"
    temperature:
      name: "Shower-room Temperature"
    humidity:
      name: "Shower-room Humidity"
    battery_level:
      name: "Shower-room T&H Battery Level"
      
  - platform: xiaomi_lywsd03mmc
    mac_address: A4:C1:38:A4:C1:38
    bindkey: "Insert your bindkey within the quotes"
    temperature:
      name: "Kitchen Temperature"
    humidity:
      name: "Kitchen Humidity"
    battery_level:
      name: "Kitchen T&H Battery Level"  

Hi all,
iā€™ve some problems with temperature/humidity sensors in the past week, i donā€™t know if dependt from last updatesā€¦

Logger: homeassistant
Source: custom_components/ble_monitor/sensor.py:577
Integration: Passive BLE monitor (documentation, issues)
First occurred: 08:25:24 (1 occurrences)
Last logged: 08:25:24

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/ble_monitor/sensor.py", line 224, in async_run
    entity.collect(data, period_cnt, batt_attr)
  File "/config/custom_components/ble_monitor/sensor.py", line 577, in collect
    <= data[self.entity_description.key]
KeyError: 'temperature'

Can you tell me which sensors you have?

Thank you Ernst for reply,
there are 2 Thermoplus and 1 MHO-C401 (Azarton), all with original firmware.