Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon monitor)

Set all of the 3 units to “mi like” but still none detected.

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] update_ble called

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Discovering Bluetooth LE devices

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Time to analyze...

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Getting data from HCIdump thread

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: joining

2020-11-14 20:47:19 DEBUG (Thread-7) [custom_components.ble_monitor.sensor] HCIdump thread: main event_loop stopped, finishing

2020-11-14 20:47:19 DEBUG (Thread-7) [custom_components.ble_monitor.sensor] HCIdump thread: Run finished

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: joined

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Spawning HCIdump thread(s).

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: Init

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: Init finished

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Starting HCIdump thread for hci0

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: Run

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump threads count = 1

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: Connection

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: Connected

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Finished. Parsed: 2 hci events, 0 xiaomi devices.

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: start main event_loop

What is the minimum config to set them to be discovered?
2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] update_ble called

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Discovering Bluetooth LE devices

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Time to analyze...

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Getting data from HCIdump thread

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: joining

2020-11-14 20:47:19 DEBUG (Thread-7) [custom_components.ble_monitor.sensor] HCIdump thread: main event_loop stopped, finishing

2020-11-14 20:47:19 DEBUG (Thread-7) [custom_components.ble_monitor.sensor] HCIdump thread: Run finished

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: joined

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Spawning HCIdump thread(s).

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: Init

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump thread: Init finished

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Starting HCIdump thread for hci0

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: Run

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] HCIdump threads count = 1

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: Connection

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: Connected

2020-11-14 20:47:19 DEBUG (SyncWorker_55) [custom_components.ble_monitor.sensor] Finished. Parsed: 2 hci events, 0 xiaomi devices.

2020-11-14 20:47:19 DEBUG (Thread-112) [custom_components.ble_monitor.sensor] HCIdump thread: start main event_loop

Is this the minimum config to get them discovered?

ble_monitor:
   discovery: True

ble_monitor: is enough. discovery is true by default.

Since the total number of received messages is logged regardless of the whitelist, I am confused by their small number (Parsed: 2 hci events).

@cherokee93, does your log contain a messages with a greater number of parsed events?

Yes, tried the ble_monitor: method without any luck.

Finished. Parsed: 3 hci events, 0 xiaomi devices.
This one is the one with the most hci events.

Tomorrow I’ll try to plug a bluetooth usb dongle to this proxmox VM instead of using the host builtin bluetooth and see what happens.
What is weird, is that from the hassio SSH & terminal plugin, if I type bluetoothctl scan on I see those devices

EDIT: something changed

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] update_ble called

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] Discovering Bluetooth LE devices

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] Time to analyze...

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] Getting data from HCIdump thread

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] HCIdump thread: joining

2020-11-14 21:06:22 DEBUG (Thread-125) [custom_components.ble_monitor.sensor] HCIdump thread: main event_loop stopped, finishing

2020-11-14 21:06:22 DEBUG (Thread-125) [custom_components.ble_monitor.sensor] HCIdump thread: Run finished

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] HCIdump thread: joined

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] Spawning HCIdump thread(s).

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] HCIdump thread: Init

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] HCIdump thread: Init finished

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] Starting HCIdump thread for hci0

2020-11-14 21:06:22 DEBUG (Thread-126) [custom_components.ble_monitor.sensor] HCIdump thread: Run

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] HCIdump threads count = 1

2020-11-14 21:06:22 DEBUG (Thread-126) [custom_components.ble_monitor.sensor] HCIdump thread: Connection

2020-11-14 21:06:22 DEBUG (Thread-126) [custom_components.ble_monitor.sensor] HCIdump thread: Connected

2020-11-14 21:06:22 DEBUG (Thread-126) [custom_components.ble_monitor.sensor] HCIdump thread: start main event_loop

2020-11-14 21:06:22 DEBUG (SyncWorker_14) [custom_components.ble_monitor.sensor] Finished. Parsed: 237 hci events, 0 xiaomi devices.

Can you tell us more about your hardware?

I suspect you are facing the problem described here. The problem is known, but it takes time to solve it. An external dongle should help, yes.

The problem is that he is using Ubuntu and Hass on docker? and I’m using HassOs. I don’t have hcitool installed or usable via terminal, I think

The problem is related to the way some newer bt-modules work.
If your diagnostic capabilities are limited, then just try this fork.

If you are not impatient, then you better not try the fork, otherwise you will have to deal with breaking changes later. An external dongle should help you temporarily solve your situation. In the meantime, I made a decision to force the solutions to this problem, postponing the rest of the tasks…

Version 0.8.1 (final) has been released.

If you are upgrading from version 0.7.x or earlier, pay attention to the breaking changes!

This morning, I’ve tried the fork you linked me, with builtin bluetooth, with usb bluetooth. Still no luck, right now i’m using a spare ESP32 I had lying around and it works perfectly.

But it’s time to test the new 0.8.2 update :slight_smile:

When you have an error during updating in HACS from 0.7.x to 0.8.x (Error: No content to download), try to uninstall the component, restart home assistant and install it again. It is most likely a sync issue in HACS due to the folder change.

Hi everyone,

I’m trying to configure my new Cleargrass (Qingping) CGD1 clocks with this ble_monitor integration but I’m not being able to get any info out of those pretty clocks.

My current configuration.yaml config is:

ble_monitor:
  discovery: False
  report_unknown: True
  devices:
    - mac: '58:2D:34:53:**:**'
      name: 'Bed_Clock'
      encryption_key: '25cd00d2b6ad026aa7d2a074********'
      temperature_unit: C


logger:
  default: warn
  logs:
    custom_components.ble_monitor: debug

looking at the logs all I see is:

...
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] Starting
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] Spawning HCIdump thread(s).
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] HCIdump thread: Init
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] HCIdump thread: Init finished
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] Starting HCIdump thread for hci0
2020-11-16 17:24:18 DEBUG (Thread-5) [custom_components.ble_monitor.sensor] HCIdump thread: Run
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] HCIdump threads count = 1
2020-11-16 17:24:18 INFO (SyncWorker_7) [custom_components.ble_monitor.sensor] Attention! Option report_unknown is enabled, be ready for a huge output...
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] 1 encryptors mac:key pairs loaded.
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] whitelist: [58:2D:34:53:**:**]
2020-11-16 17:24:18 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] 1 whitelist item(s) loaded.
2020-11-16 17:24:18 DEBUG (Thread-5) [custom_components.ble_monitor.sensor] HCIdump thread: Connection
2020-11-16 17:24:18 DEBUG (Thread-5) [custom_components.ble_monitor.sensor] HCIdump thread: Connected
2020-11-16 17:24:18 DEBUG (Thread-5) [custom_components.ble_monitor.sensor] HCIdump thread: start main event_loop
2020-11-16 17:24:19 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] update_ble called
2020-11-16 17:24:19 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] First run, skip parsing.
...
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] update_ble called
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] Discovering Bluetooth LE devices
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] Time to analyze...
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] Getting data from HCIdump thread
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] HCIdump thread: joining
2020-11-16 17:25:19 DEBUG (Thread-5) [custom_components.ble_monitor.sensor] HCIdump thread: main event_loop stopped, finishing
2020-11-16 17:25:19 DEBUG (Thread-5) [custom_components.ble_monitor.sensor] HCIdump thread: Run finished
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] HCIdump thread: joined
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] Spawning HCIdump thread(s).
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] HCIdump thread: Init
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] HCIdump thread: Init finished
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] Starting HCIdump thread for hci0
2020-11-16 17:25:19 DEBUG (Thread-8) [custom_components.ble_monitor.sensor] HCIdump thread: Run
2020-11-16 17:25:19 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] HCIdump threads count = 1
2020-11-16 17:25:20 DEBUG (Thread-8) [custom_components.ble_monitor.sensor] HCIdump thread: Connection
2020-11-16 17:25:20 DEBUG (Thread-8) [custom_components.ble_monitor.sensor] HCIdump thread: Connected
2020-11-16 17:25:20 DEBUG (Thread-8) [custom_components.ble_monitor.sensor] HCIdump thread: start main event_loop
2020-11-16 17:25:20 DEBUG (SyncWorker_12) [custom_components.ble_monitor.sensor] Finished. Parsed: 382 hci events, 0 xiaomi devices.
...

|

Any idea where I’m doing something wrong?

|

Trying to upfront answer to any upcoming questions, I configured the CGD1 device with the mac address and encryption_key I got out of the Qingping+ android mobile app (from the qingping.log file the app generates).

I also tried to get those information out of the Telink Flasher app, but as I click on the Do Activation button I get the Not connected error

Log:
17:39:53: Searching for devices
17:40:07: TypeError: device.watchAdvertisements is not a function
17:40:07: Reconnect 1 from 5
17:40:14: Connected
17:40:16: Not connected
17:40:23: Not connected

Just for additional info, if I change the discovery: False option to True , I can see the details of my LYWSD02 sensors details, but not the CGD1 ones.

Many thanks in advance!

Attempting to connect a new HHCCJCY01. Using internal bluetooth on RPi 4 Hassio, sensor laying directly next to the RPI. I get the following on both 8.1 and 8.2-beta:

2020-11-16 15:26:23 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] HCIdump threads count = 1
2020-11-16 15:26:23 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] 0 encryptors mac:key pairs loaded.
2020-11-16 15:26:23 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] whitelist: []
2020-11-16 15:26:23 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] 0 whitelist item(s) loaded.
2020-11-16 15:26:24 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] update_ble called
2020-11-16 15:26:24 DEBUG (SyncWorker_7) [custom_components.ble_monitor.sensor] First run, skip parsing.
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] update_ble called
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] Discovering Bluetooth LE devices
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] Time to analyze...
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] Getting data from HCIdump thread
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] Spawning HCIdump thread(s).
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] HCIdump thread: Init
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] HCIdump thread: Init finished
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] Starting HCIdump thread for hci0
2020-11-16 15:27:24 DEBUG (Thread-9) [custom_components.ble_monitor.sensor] HCIdump thread: Run
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] HCIdump threads count = 1
2020-11-16 15:27:24 DEBUG (SyncWorker_23) [custom_components.ble_monitor.sensor] 0 HCI Events parsed, 0 BLE ADV messages processed for 0 known device(s).
2020-11-16 15:27:24 ERROR (Thread-9) [custom_components.ble_monitor.sensor] HCIdump thread: OS error: [Errno 19] error while attempting to bind on interface 0: No such device

Can you run the following command and report back the response

hcitool dev

Did you add the sensor to the MiHome app?

Indeed I was able to add them to the MiHome app v5.8.42, it was easely discovered and configured, but I wasn’t able to add it to the old MiHome v5.0.0 , it did not discover it (probably because by then this devices did not exist).

That’s why I used the Qingping+ app since it discovers it and records information in the qingping.log file that I believe is the correct one (maybe I’m wrong)

Getting hcitool: command not found

Running bluetoothctl leaves me with Waiting to connect to bluetoothhd... hanging.

Looks like Bluetooth / hcitools is not installed. Are you using Ubuntu or raspberry-os? Have a look here for a solution to try.

I’m using Hassio on a raspberry pi 4

Edit: it appears I might have disabled bt during my Razberry v2 module set up. I might need to explore a different z-wave controller or research other options.

Yes, that will be it. The onboard Bluetooth device of the Raspberry Pi will be disabled by adding dtoverlay=disable-bt

@Ernst were you talking about what version of the MiHome app?