Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon monitor)

I’ve tried the sensor in various places, including right next to my Pi. Currently, with the sensor in the place I want it to be, the RSSI value is -67.
The LYWSDCGQ is much further away, but working well.
I’m also tracking both devices with ESPHome and I see the same behaviour there too.

Hmmm… Did you try this app? There you need to pay special attention to the choice of the region. Many sensors only work in the Mainland China region.

1 Like

That was the first one I tried. I’m not sure what region I had selected. Presumably not China. I’ll give it another go.

I think it might be working!
You were right. If you select China you get loads more devices to choose from. It took me a while to get it to discover the sensor, but that’s because I hadn’t given it permission to access Location.

So the steps were:

  1. Download Xiaomi Home app.
  2. Switch on Bluetooth and Location on your phone and give the app permission to use Location when it asks.
  3. Create an account and sign in.
  4. Select “China Mainland” as your country.
  5. Add a new device in the app. Find the sensor the Sensor section, and connect to it.

Glad to hear! The quantity of the received messages for the time specified in the option period can be viewed in the last_mean_of sensor attribute. If you have a period of 60 seconds (default), then, for CGG1, as far as I know, you should see the 20 there (plus or minus, depends on the reception conditions).

Aleksey Makarenko thanks for you work to date. I have searched the forum for this issue but not found a resolve?

Platform error sensor.mitemp_bt requirements for mitemp_bt not found [‘aioblescan>=0.2.4’]

I see the error when using

ha core check

Checked manifesr.json file

{ “domain”: “mitemp_bt”, “name”: “Xiaomi passive BLE monitor sensor integration”, “documentation”: “GitHub - custom-components/ble_monitor: BLE monitor for passive BLE sensors”, “requirements”: [“aioblescan>=0.2.4”, “pycryptodomex>=3.9.7”], “dependencies”: , “codeowners”: [ “@Magalex2x14”, “@Ernst79” ] }

Running Home Assistant 0.108.6 with HACS Xiaomi passive BLE monitor sensor platform.

Hmm. This is strange because the Home Assistant automatically installs the dependencies.
Is everything okay with internet access from your host? Try uninstalling the component and installing it again…

Uninstalled ha host reboot, installed , ha core check same issue. PI its running on has internet access no proxy. Funny thing is temp sensor works fine just ha core check tells me that,

Platform error sensor.mitemp_bt requirements for mitemp_bt not found [‘aioblescan>=0.2.4’]

Is missing.

I just can’t get this to work … maybe someone can help me here. I trusted the certificate, but every time when I hit “sniff now” it shows me “pairing not possible”. Without sniffing its working perfect. I also recognized, that the automation content in the app is not visible. It says “no internet connection”…

Edit: Didnt notice the step 4… Thanks mate!

Magalex removed rebooted and seems DNS was the issue, 3rd time lucky installed correclty. ha core check is good now thanks.

Three days ago I published a new version of the component - 0.6.6-beta.
It seriously enhances data filtering, so the more people test, the better.
I ask all interested to try it and report if any problems arise. This version works for me stably.

In addition, HassOS was recently updated. It seems that something was done there in terms of bluetooth, so if you have experienced problems with the stability of the bluetooth subsystem (especially on rpi3b), then you should try updating.

It’s a bit unclear for me how to set this up for my miflora devices. I have added all devices to the flower care app and updated the firmware. However, when I add:

sensors:
  - platform: mitemp_bt

to my config, I don’t see any sensors being added. Note that I also have the miflora component still activated for all sensors:

  - platform: miflora
    mac: '80:EA:CA:89:1E:B5'
    name: Galileo
    force_update: true
    median: 3
    monitored_conditions:
      - moisture
      - light
      - temperature
      - conductivity
      - battery

and these work. When I check the logs, I do see HCIdump lines, but no Xiaomi devices are detected. I feel like I’m missing something here. Any suggestions?

Firstly, you need to try to comment out all lines related to the miflora component (and other components using the same bt interface) and restart HA - FAQ.

Thanks for the quick response! I appreciate it! :slight_smile:

I removed all the bluetooth integrations, but now I get this in my log:

2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] update_ble called
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] Discovering Bluetooth LE devices
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] Time to analyze...
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] Getting data from HCIdump thread
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] HCIdump thread: joining
2020-04-22 17:56:44 DEBUG (Thread-46) [custom_components.mitemp_bt.sensor] HCIdump thread: main event_loop stopped, finishing
2020-04-22 17:56:44 DEBUG (Thread-46) [custom_components.mitemp_bt.sensor] HCIdump thread: Run finished
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] HCIdump thread: joined
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s).
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] HCIdump thread: Init
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0
2020-04-22 17:56:44 DEBUG (Thread-54) [custom_components.mitemp_bt.sensor] HCIdump thread: Run
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1
2020-04-22 17:56:44 DEBUG (Thread-54) [custom_components.mitemp_bt.sensor] HCIdump thread: Connection
2020-04-22 17:56:44 DEBUG (SyncWorker_19) [custom_components.mitemp_bt.sensor] Finished. Parsed: 4 hci events, 0 xiaomi devices.
2020-04-22 17:56:44 DEBUG (Thread-54) [custom_components.mitemp_bt.sensor] HCIdump thread: Connected
2020-04-22 17:56:44 DEBUG (Thread-54) [custom_components.mitemp_bt.sensor] HCIdump thread: start main event_loop

The component works for you. However, there are too few events (Parsed: 4 hci events). Try rebooting the system (to reset the bt interface). More details about your system are required.

I have the same issue
What was the reason? How did you fix it?

Hello, thanks for the good work.

I installed the mitemp_bt custom component manually copying the files into Hassio as described in the component guide

I tried to follow your guide:

  • step 1 did not show the Mac addresses for the LYs but I fetched these from within the MI Home app under the properties of the devices.

  • Steps 2-5 performed, I got the bind_key for both devices and completed the - platform: mitemp_bt entry in the configuration.yaml

  • step 6: Stopped- restarted, power off/on the Pi and waited for long time but no new entities are discovered.

Any logs I can look into?

Maybe already step 1 not being able to list the LY mac addresses indicates an issue

Do I need to create sensor entities somewhere and specify entity_id or name, or are these generated automatically be the mitemp_bt custom component?

Any other suggestions?

Thanks!

I figured this out,
the CA was not installed/registered properly on my iPhone.

Hello! Make sure there are really no entities (Developer Tools -> States -> Filter entities by string mi_).
Sensor entities will be created automatically.
If there are no typos in the mac-addresses, then everything should work.
There can be many reasons for the opposite. To get started, place one sensor in the immediate vicinity of your host. Remember that LYWSD03 sends data every 10 minutes approximately. Look carefully at the log (both HA and system). Read our FAQ.
If the problem cannot be solved on your own, then write, we will think together.

1 Like

Disabled all bluetooth components, also turned off a rpi0 that I was using for bluetooth2mqtt. Reboot the intel NUC that runs Hass.io. What other details do you need?

This is the log from just a few minutes ago.

Thanks for helping by the way! :slight_smile:

2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] update_ble called
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] Discovering Bluetooth LE devices
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] Time to analyze...
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] Getting data from HCIdump thread
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] HCIdump thread: joining
2020-04-24 19:50:26 DEBUG (Thread-4957) [custom_components.mitemp_bt.sensor] HCIdump thread: main event_loop stopped, finishing
2020-04-24 19:50:26 DEBUG (Thread-4957) [custom_components.mitemp_bt.sensor] HCIdump thread: Run finished
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] HCIdump thread: joined
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s).
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] HCIdump thread: Init
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0
2020-04-24 19:50:26 DEBUG (Thread-4965) [custom_components.mitemp_bt.sensor] HCIdump thread: Run
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1
2020-04-24 19:50:26 DEBUG (Thread-4965) [custom_components.mitemp_bt.sensor] HCIdump thread: Connection
2020-04-24 19:50:26 DEBUG (Thread-4965) [custom_components.mitemp_bt.sensor] HCIdump thread: Connected
2020-04-24 19:50:26 DEBUG (Thread-4965) [custom_components.mitemp_bt.sensor] HCIdump thread: start main event_loop
2020-04-24 19:50:26 DEBUG (SyncWorker_28) [custom_components.mitemp_bt.sensor] Finished. Parsed: 4 hci events, 0 xiaomi devices.