Passive BLE Monitor integration

Is this why I am able to use passive scanning on BLE monitor but not on the new integration? As far as I understand the problem is that my BlueZ is out of date (or missing some flag, not clear exactly). Is there any chance that whichever method BLE monitor is using will make its way into the official integration at some point? Sorry if these are stupid questions, I guess it’s obvious but I don’t really understand how this all works.

Yes, sort of. As far as I understand it, Bluez has an experimental flag to use passive scanning, which was added a few month’s ago. This is only working if your Bluetooth adapter firmware is supporting this (in combination with Bluez) and you turn this on in the Bluetooth integration.

The official integrations use Bluez to communicate with the Bluetooth adapter.
BLE monitor used aioblescan, a pypi package that converts python code to HCI commands. If I remember correctly, it is making a HCIdump of the incoming data, which is parsed by BLE monitor. A HCIdump can be done in passive or active mode, so in BLE monitor you have this option (passive by default).

Most problems occur when using both passive and active scanning at the same type. Your Bluetooth adapter can only use one method at the same time.

1 Like

@Ernst hello, this is the integration image for Mi Motion Sesnsor 2. Motion sensor information is not displayed. Can you help me? It was working fine yesterday but after updating the integration today there is a problem. I tried downgrading the integration firmware to the previous one but the problem persists.

Any errors in the log?

there are no errors in the log :frowning:

I deleted the integration and reinstalled via hacs. However, the problem persists. By the way my xiaomi ble temperature and humidity sensor is working correctly

now there is an error in the log

Ah, that means that the encryption key has changed. Can happen when changing battery, re-adding it to MiHome and/or resetting the device. Try to get your encryption key again and change it in the BLE monitor settings.

Configuring with yaml fixed the problem :relaxed: Thank you very much for your interest

Hi, I have the same sensor but i have some problems to find the correct uuid to get temperature and humidity status. Were you able to integrate it with esphome?

It seems the mi scale XMTZC02HM is not supported. I can see it in the first post list, but it is missing on the supported device list (only 01HM and 04HM).

You forgot of it? :slight_smile: do you need the ble advertisment? Thanks

I didn’t forgot it, it was a small issue in the documentation page, which made it not being displayed. It is fixed now, thanks for letting me know.

I was just kidding :sweat_smile:
Btw it doesn’t show up. I can see it sending the data, but HA doesn’t see it. My mi flora and temperature/humidity sensors work as expected and added immediately.
Any idea?

:grinning_face_with_smiling_eyes:

If it doesn’t show up, there is something wrong :sleepy: Its best to create an issue on github, preferably with some data collected with the “report unknown devices” option of BLE monitor, like for a new sensor request. If you can collect some BLE advertisements, I can check where things go wrong.

ok, I will do it later when I go back at home. Thanks.

Hello! Just because I am wondering. Is there any reason to migrate to this integration for my MiFlora sensors? They work fine with the stock Xiaomi BLE integration. Is this any better? :slight_smile:

BLE monitor is much older than the HA integration. We are moving BLE monitor to HA BLE integrations, so you can stick to the Xiaomi-ble integration.

So what do you suggest nowadays to write an integration for a new (unsupported) BLE device that supplies data in the advertisement message?

I would like to try to create a bunch of sensors from a Hormann garage door (status “open”/“closed” and %, see my post here) but I don’t know where to start. What do you suggest as a template code? And how should the files be placed for HA to pick them up? Do they work like normal integrations that can be placed in the custom_components folder?

You have two options. Option one is to create an official HA integration. Just copy one of the examples, like govee_ble, xiaomi_ble, bthome_ble, etc. You will need to create a pypi package as well that decodes the data, most can be found on Bluetooth Devices · GitHub. Developing an integration for HA is explained here Starting with Development | Home Assistant Developer Docs.

If you don’t have much experience in programming, it might be easier to first add it to BLE monitor, as BLE monitor has most of the framework build in. You only have to add the parser code. Just have a look here on how to collect the data New sensor request | Passive BLE Monitor integration

1 Like

Hello!

I’ve tried BLE Monitor integration with Jaalee but there’s something wrong.

First the UUID and MAC of sensor keeps changing if enable more than one sensor of same model (seems that different sensors/MAC with same UUID). Screenshot from Bluetooth LE Scanner app:

Then the measurements from a sensor are odd, like 57 °C or something way different from Jaalee app (RH is a little close):

image