Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon monitor)

Hello! The entry with the text Parsed: 0 hci events,... is an alarming entry, often saying that something is wrong at the system level.
Describe in more detail your system - hardware, software, how do you install Home Assistant.

Thanks for the reply

i installed Home Assistant Supervised with the following script https://github.com/home-assistant/supervised-installer

arch 	x86_64
dev 	false
docker 	true
hassio 	true
os_name 	Linux
os_version 	5.6.10-arch1-1
python_version 	3.7.7
timezone 	Europe/Madrid
version 	0.109.4
virtualenv 	false
Lovelace
dashboards 	1
mode 	auto-gen
resources 	0

CPU: Intel Celeron G1610T (2) @ 2.300GHz
Bluetooth: 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Memory: 1077MiB / 3758MiB

if i miss something just ask

Do you have the ability to run the hcitool lescan command outside and inside the container?

Also, check the system log for any errors related to bluetooth.

Perhaps the matter is access rights to the bt interface. I definitely can’t tell you how to check this in the case of docker. The bottom line is that the process working with the bt-interface should get the rights, as indicated here(step 1). Probably in the case of Docker, these rights should be granted both inside the container to the python process and to the container itself. But I can be wrong, because I have no experience with docker…

Googling on your dongle’s ID shows that it could be a pretty old device. Is it supports Bluetooth Low Energy (has been included in the Bluetooth specification since version 4.0)?

must be the case. going to buy a new one, and report back. Again, thanks for your time.

The Bluetooth 4.0 specification was approved in 2010. I just don’t want you to waste money. Maybe you should make sure that this is the case?

You can try to run:

sudo hciconfig hci0 version

or

sudo btmgmt info

or

sudo hciconfig hci0 lestates

and post output here

1 Like
 sudo hciconfig hci0 version
hci0:   Type: Primary  Bus: USB
        BD Address: 00:22:F7:17:D5:75  ACL MTU: 310:10  SCO MTU: 64:8
        HCI Version: 2.1 (0x4)  Revision: 0x149c
        LMP Version: 2.1 (0x4)  Subversion: 0x149c
        Manufacturer: Cambridge Silicon Radio (10)
 sudo btmgmt info
Index list with 1 item
hci0:   Primary controller
        addr 00:22:F7:17:D5:75 version 4 manufacturer 10 class 0x000104
        supported settings: powered connectable fast-connectable discoverable bondable link-security
sudo hciconfig hci0 lestates
Can't read LE supported states on hci0: Input/output error(5)

Yes, your dongle is too old…
Output must be like this:


Just buyed This dongle Will reporte back. Thanks for time and efforts to help me. Much appreciated :blush:

1 Like

How to display the effect in the picture? Maximum and minimum temperature.

It is a custom mini-graph-card plugin.
By the way, it was taken as the basis for the current sensor card, but has much more capabilities.

Thanks for providing!

Hello again

Sorry for being pain in the … but I unfortunately again I need your help.

What I did yesterday is as we spoke, I left everything as been configured and wait over a night to see what happens. Nothing changes. Still sensors didn’t catch the flow.

Today 4 hours ago I decided, that again I will do everything from scratch so:

  • I deleted sensors from my Xiaomi mobile app, restarted the app and added them again.
  • After that I switched off the app and copy bind key into the configuration.yaml file.
  • Checked again is debug mode provided on your website is on.
  • Restarted the HA.
  • I waited till now to see is there any difference - no luck.

I am pasting most recent log file (last couple of minutes), but I believe, that there is nothing important there:

2020-05-06 20:15:50 WARNING (SyncWorker_8) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device
2020-05-06 20:16:01 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2020-05-06 20:16:11 ERROR (SyncWorker_6) [miio.miioprotocol] Got error when receiving: timed out
2020-05-06 20:16:11 WARNING (SyncWorker_6) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device
2020-05-06 20:16:22 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2020-05-06 20:16:33 WARNING (MainThread) [homeassistant.components.vacuum] Updating xiaomi_miio vacuum took longer than the scheduled update interval 0:00:20
2020-05-06 20:16:34 ERROR (SyncWorker_0) [miio.miioprotocol] Got error when receiving: timed out
2020-05-06 20:16:34 WARNING (SyncWorker_0) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device
2020-05-06 20:17:04 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2020-05-06 20:17:14 ERROR (SyncWorker_3) [miio.miioprotocol] Got error when receiving: timed out
2020-05-06 20:17:14 WARNING (SyncWorker_3) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device
2020-05-06 20:17:25 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2020-05-06 20:17:35 ERROR (SyncWorker_2) [miio.miioprotocol] Got error when receiving: timed out
2020-05-06 20:17:35 WARNING (SyncWorker_2) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device
2020-05-06 20:17:46 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2020-05-06 20:17:56 ERROR (SyncWorker_0) [miio.miioprotocol] Got error when receiving: timed out
2020-05-06 20:17:56 WARNING (SyncWorker_0) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device
2020-05-06 20:18:07 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2020-05-06 20:18:17 ERROR (SyncWorker_2) [miio.miioprotocol] Got error when receiving: timed out
2020-05-06 20:18:17 WARNING (SyncWorker_2) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device
2020-05-06 20:18:28 WARNING (MainThread) [homeassistant.helpers.entity] Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
2020-05-06 20:18:39 WARNING (MainThread) [homeassistant.components.vacuum] Updating xiaomi_miio vacuum took longer than the scheduled update interval 0:00:20
2020-05-06 20:18:40 ERROR (SyncWorker_7) [miio.miioprotocol] Got error when receiving: timed out
2020-05-06 20:18:40 WARNING (SyncWorker_7) [homeassistant.components.xiaomi_miio.vacuum] Got exception while fetching the state: No response from the device

The whole file I attached here: https://pastebin.com/e9cTSfS7

Can I kindly ask you to have a quick look?

In your log there are no entries at all about custom.mitemp_bt (it must produce quite a lot of entries in debug mode). There is not even a standard warning You are using a custom integration for hacs which has not been tested by Home Assistant that appears at the start of each custom component (see the beginning of the log). That is, I don’t even see an attempt to start the component.

I think that the key information from your log is this record:

YAML file /config/configuration.yaml contains duplicate key "sensor". Check lines 82 and 178.

This is problem. Fix it and restart HomeAssistant.

As promised, reporting back:

All 3 sensors reporting :blush: :blush:. Now i will try with my mi flora sensors and start doing my first steps with automation and scenes.
Thanks again Megalex :clap: :clap:

1 Like

Hello again Aleksey

Yes, you were right. I had double “sensor” declaration (one for LYWSD03MMC and one for printer ink). Anyway, I corrected it, restarted (as you stated) HA and after 2hrs … nothing.
So, I generate again bindkeys and did restart. Still nothing.
But, I have noticed, something in logs. As you mentioned Bluetooth scan appeared, but it seems it’s not detecting anything, please have a look:

2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] update_ble called
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] Discovering Bluetooth LE devices
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] Time to analyze...
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] Getting data from HCIdump thread
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] HCIdump thread: joining
2020-05-07 19:49:57 DEBUG (Thread-172) [custom_components.mitemp_bt.sensor] HCIdump thread: main event_loop stopped, finishing
2020-05-07 19:49:57 DEBUG (Thread-172) [custom_components.mitemp_bt.sensor] HCIdump thread: Run finished
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] HCIdump thread: joined
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s).
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] HCIdump thread: Init
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0
2020-05-07 19:49:57 DEBUG (Thread-173) [custom_components.mitemp_bt.sensor] HCIdump thread: Run
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1
2020-05-07 19:49:57 DEBUG (SyncWorker_1) [custom_components.mitemp_bt.sensor] Finished. Parsed: 0 hci events, 0 xiaomi devices.
2020-05-07 19:49:57 DEBUG (Thread-173) [custom_components.mitemp_bt.sensor] HCIdump thread: Connection
2020-05-07 19:49:57 DEBUG (Thread-173) [custom_components.mitemp_bt.sensor] HCIdump thread: Connected
2020-05-07 19:49:57 DEBUG (Thread-173) [custom_components.mitemp_bt.sensor] HCIdump thread: start main event_loop

So i browse throught the whole log and found, that I am still receiving the same value “0”:

Finished. Parsed: 0 hci events, 0 xiaomi devices.

Shouldn’t I have number 3 there? Since I have 3 sensors?

Yes, there must be 3 devices. The disturbing thing here is that events is 0…
This usually indicates some problems at the system level.

You need to check syslog for any Bluetooth related errors.
Run the uname -a command and show its output
Run the command dmesg | grep -i blue and show its output
You can also try running btmon -t on the host (stop it with CTRL+C after a few minutes)
Try to run hcitool --lescan also

1 Like

Do you use some third-party HA bluetooth components or external bt tools?

Incredible! Really thank you Aleksey! You helped me a lot!

As you described I went to the syslog and found many entries like:
Bluetooth: hci0: command 0x200c tx timeout
So I restart the computer and VoilĂ ! Everything going back to normal!

Once again Aleksey thank you very much for your patience and support I really appreciate it.

It is likely that this will be repeated. It is necessary to google the reason for this error (in relation to your hardware). If I remember correctly, on laptops this can happen because of the enabled energy saving.