Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon monitor)

See the new thread over here


This custom component developed is an alternative for the standard build in mitemp_bt integration that is available in Home Assistant. Unlike the original mitemp_bt integration, which is getting its data by polling the device with a default five-minute interval, this custom component is parsing the Bluetooth Low Energy packets payload that is constantly emitted by the sensor. The packets payload may contain temperature/humidity/battery and other data. Subsequently, the sensor platform became an integration.

Advantage of this integration is that it doesn’t affect the battery as much as the built-in integration. It also solves connection issues some people have with the standard integration (due to passivity and the ability to collect data from multiple bt-interfaces simultaneously). Read more in the FAQ.

Currently supported sensors:
LYWSDCGQ, CGG1, LYWSD02, LYWSD03MMC, CGD1, MHO-C303, MHO-C401, JQJCY01YM, HHCCJCY01, GCLS002, HHCCPOT002, WX08ZM, MCCGQ02HL

A list of all supported sensors with their description and image is available here.

This topic was created in addition to github issues as a place where you can more freely discuss the operation of the component, ask for support, leave feedback and share your experience.

If you are looking for support, please spend some time reading our Frequently Asked Questions, as it may already contain the answer to your question.

Welcome!

31 Likes

Hi! Thanks for your great custom component!!

Only a question… This is a “passive” receiver for data, which is great for the battery, but maybe, can you add an option to ask for battery information for elements that not publish it in passive form? For example the mi flora sensor. One or twice a day I think will be enough.

Thanks for your work!!

Hello, @McGiverGim!

Similar requests have already been received before, so I think about it, yes. As I already answered you on github, this is only at the stage of reflection (I was busy with other things). If I implement a polling for MiFlora, then sooner or later I will have to implement it for other sensors ) I think how to do this so that for each new sensor do not write a separate procedure (if at all possible).

Thanks! I will wait then until you get to something usable for this. Is a great addon.

1 Like

I carefully followed the installation procedure.
I ran the core stop and core start command, but when I go to add the sensor I have this error:
“mapping values are not allowed here” in the endryptor line

encryptors: ‘A4:C1:38:D3:XX:XX’: ‘8c5476cba78e208ce104378397xxxxxx’

Please, post your config as preformatted text:

sensor:
  - platform: mitemp_bt
    encryptors:
                'A4:C1:38:2F:86:6C': '217C568CF5D22808DA20181502D84C1B'
                'A4:C1:38:D1:61:7D': 'C99D2313182473B38001086FEBF781BD'

you can hide the real mac and key

- platform: mitemp_bt
  rounding: True
  decimals: 2
  period: 60
  log_spikes: False
  use_median: False
  active_scan: False
  hci_interface: 0
  batt_entities: False 
  encryptors: 'A4:C1:38:xx:xx:xx': '8c5476cba78e208ce104378397xxxxxx'
  report_unknown: False
- platform: mitemp_bt
  rounding: True
  decimals: 2
  period: 60
  log_spikes: False
  use_median: False
  active_scan: False
  hci_interface: 0
  batt_entities: False 
  encryptors:
            'A4:C1:38:xx:xx:xx': '8c5476cba78e208ce104378397xxxxxx'
  report_unknown: False

now my config is ok, but afther restarting no new sensor available

[custom_components.mitemp_bt.sensor] HCIdump thread: OS error: [Errno 19] error while attempting to bind on interface 0: No such device

Yes, the dictionary should start on the next line.

Try this

Have you solved your problem? What was the output of the hcitool dev command?

If not, then post information about your hardware and software. Maybe someone experienced the same problem.

it’s a hardware problem.
i have hassos-proxmox installed on a voyo mac v1 mini. it does not have an integrated bluetooth adapter. it comes with usb dongle and apparently the dongle is not working right now. configuration problem I guess

Ah, i see… I have not used proxmox for a long time, but you seem to need to passtrough the usb device to vm.

I just leave it here. To illustrate the difference between a sensor broadcasting every two-three seconds (LYWSDCGQ) and a sensor broadcasting every 10 minutes (LYWSD03MMC):


The period in the component settings is 60 seconds, rounding is disabled.
Approximately the same picture would be if on the right there was the same LYWSDCGQ, but with the data obtained by the polling component.

1 Like

I can’t get this to work. The built-in integration worked fine. This doesn’t. I have a LYWSDCGQ which works ok, but does tend to stop updating. Thought I’d give this a go but no senors are available after setup.

There are no errors in my logs either.

Our FAQ describes several situations that can lead to this. Most often, this is a system problem with bluetooth on raspberry.

In any case, to help, I need more information about your installation.

I’m not using a raspberry pi, I’m running hassio in docker on a Debian system. I have a usb bluetooth LE dongle in one of the USB ports, and shows up as hci0. The built-in integration works fine and for now I’ve gone back to it, and it’s working again. The unit and my server are about 2 feet away from each other, so bluetooth distance is not an issue here.

What specific information do you need about my setup?

1 Like

Tell me, is your sensor added to the official MiHome app? Many sensors do not send data in broadcast packets until they are added to the app.

I forget about it all the time :see_no_evil:

1 Like

If this is not your case:

Are there any other components or other software (third-party scripts, for example) that uses bluetooth?
What kind of bt-dongle? Can you show the output of:
lsusb
and
dmesg | grep -i blue
And it is worth to check syslog for bluetooth related errors…

Perhaps that needs to go into the docs :grinning:.