Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon monitor)

Hi Aleksey,

thanks for your quick response.
It was actually just a matter of time. I just waited some longer time and restarted HASSIO again and then i got the sensors.

thanks a lot for your good work.

@DrBlokmeister I think that in your case, the key information is that you have an Intel NUC.
Here is an issue with a problem similar to yours. The author of the issue turned out to be quite a technically savvy person, and he found that the problem lies in the implementation of Intel wireless adapter support in recent versions of the Linux kernel. If you know how to reinstall kernels and related packages, then there is a solution to your problem. Otherwise, I can only suggest trying an external usb adapter…

Aleksey, my friend, happy to report that after 30 days and quite a few updates from HA (as always!!) and many reboots and related nonsenses, your (our :smiley:) addon continues to work well and is very stable.
Quick Q (not urgent). The battery figures never included since day 1. All I see are the 4 basic readings from my two sensors.
Am i missing some setting?

Kind regards and best of health to you.

1 Like

Glad everything is good.
The ability to create separate entities for batteries exists since version 0.5.5.
To enable them, use the batt_entities option.

1 Like

Any plans to get the Xiaomi Smart Mosquito Repellent included also?

It would be great to the able to know consumable status, on/off status and battery remaining, but not sure if these are broadcasted or need pairing…

We have no plans to implement support for certain devices.
It all depends on the users of these devices.
The FAQ describes the process of collecting the necessary information.

1 Like

Here it is. Thanks in advance.

Hello,
I have a LYWSD03MMC which is successfuly working with the hacs component. In addition I also have a LYWSDCGQ. Due to the hacs mitemp_bt component, I had to remove the “mac:xxx:xxx…” line and now I don’t know how to connect this sensor to my home assistant.
Any idea ?

thanks a lot !

Nothing needs to be configured (additional) for LYWSDCGQ.
If you have custom.mitemp_bt installed and the signal from the sensor reaches your host, then the corresponding entities will appear automatically.

Ok, now it works, the sensor was to far away therefore it was not connected.
Thanks a lot !

Version 0.6.8 with whitelist option and Xiaomi Mija Mosquito Repellent WX08ZM support released

1 Like

Hello

i have been using your addon @Magalex for a two months now. I believe, that is the best option to make my three: LYWSD03MMC work under HA. I want to thank you for it very much.

I am reading all this statements above and starting thinking, that my configuration is wrong. Why? Because:

  1. previously to make it work i needed to give new and new Binkeys after few HA restart.
  2. Since last HA update those three LYWSD03MMC just don’t want to connect back. I keep generating bindkeys - no luck. I even capitalize all letters in it - still nothing.

Can you please (or anybody) tell me how to find the error?

My most recent configuration:

sensor:
  - platform: cpuspeed
  - platform: mitemp_bt
    rounding: True
    decimals: 1
    period: 60
    log_spikes: False
    use_median: False
    active_scan: False
    hci_interface: 0
    batt_entities: True
    encryptors:
                'A4:C1:38:27:89:42': '2432BE8CE73F450CE7A306AA6505DBAA'
                'A4:C1:38:62:A4:DE': 'F51745017DC51AE127CB704599E1F40E'
                'A4:C1:38:8B:CF:37': 'F9241D0AD4CA8741A2980C6BBE209DF4'
    whitelist: True

EDIT: Obviously, as you wrote in point 6 in your installation manual, I left the sensors paired with my mobile.
EDIT2: Versions: Home Assistant 0.109.4 and BLE monitor 0.6.8.

Hmm. Let’s figure it out…

Keys can fly off only if the sensors have passed the pairing procedure. In any case, I am not aware of other reasons. Even changing the battery does not reset the keys.

  • First, check the HA log for errors and other suspicious messages.
  • Secondly, enable debug mode as described in our FAQ.
  • Tell me more about the host configuration - is this a standard Hassio image or is it installed on a generic Linux host (Python venv)?
  • How did you determine the need to generate new keys?
  • Make sure that no other applications (including MiHome) are connected to the sensors because during the active connection they stop broadcasting (this can be determined by the active Bluetooth icon on the sensor display).
1 Like

Thank you for so quick reply. I will try to be as much precise as possible. Please bear in mind, that I quite new HA user, so some answers can be a little bit funny.

  • You mean log from: Supervisor > System > Supervisor, Core, Host, DNS, … ?

  • Done that. I restarted HA after that, and found nothing suspicious in above logs. Maybe one thing - the time is 2hrs in the past. I will be happy to paste it here, but can you please tell me which one is that?

  • This is Hassio on Ubuntu (Ubuntu 18.04.4 LTS) installation (on laptop) on docker. I followed this video: https://www.youtube.com/watch?v=ekVfLXnoM7k

  • I am getting new keys by using this modified app: https://www.kapiba.ru/2017/11/mi-home.html. Basically I installed the app, created folders, pair the sensors and open the file which contained bind keys.

  • Ok, so you are saying, that after I have go the bindkeys I should remove sensors from xiaomi app, right?

You mean log from: Supervisor > System > Supervisor, Core, Host, DNS, … ?

No, I mean “Developer Tools > LOGS”

I am getting new keys by using this modified app: ЗАПИСКИ ЛЕНИВОГО ЭНТУЗИАСТА: Модифицированный Mi Home с множеством приятных дополнений. Basically I installed the app, created folders, pair the sensors and open the file which contained bind keys.

What interests me is not the way to get the keys, but what were you based on when you made the decision to change the keys? The fact is that if the key does not match, then in the log (indicated above) there will be a corresponding error message. If it is not, then the reason is different.

Ok, so you are saying, that after I have go the bindkeys I should remove sensors from xiaomi app, right?

No, no, you must not remove sensors from the application in any case (keys will be lost). Just make sure the application is not active (just in case). When an application is active, it can connect to the sensor, which is why it stops broadcasting.

Ok, thank you for giving info about the logs. I don’t want to make mess here but in short this is what i have got from Hassio:

Got exception while fetching the state: No response from the device
9:45:59 PM – xiaomi_miio (WARNING) - message first occurred at 9:30:59 PM and shows up 32 times
Got error when receiving: timed out
9:45:59 PM – components/xiaomi_miio/vacuum.py (ERROR) - message first occurred at 9:30:59 PM and shows up 32 times
Updating xiaomi_miio vacuum took longer than the scheduled update interval 0:00:20
9:45:58 PM – Vacuum (WARNING) - message first occurred at 9:32:22 PM and shows up 12 times
Update of vacuum.xiaomi_vacuum_cleaner is taking over 10 seconds
9:45:48 PM – __main__.py (WARNING) - message first occurred at 9:31:30 PM and shows up 31 times
Error handling message: required key not provided @ data['category']. Got None
9:31:08 PM – Home Assistant WebSocket API (ERROR)
Setup of vacuum platform xiaomi_miio is taking over 10 seconds.
9:30:48 PM – Vacuum (WARNING)
Setup of binary_sensor platform ping is taking over 10 seconds.
9:30:48 PM – Binary sensor (WARNING)
Setup of sensor platform command_line is taking over 10 seconds.
9:30:48 PM – Sensor (WARNING)

Regarding changing keys itself. Why did I started to changed them?
I found the red Icon called “restored” from Configuration> Entities. Once I get this icon, the values never show. If this icon dissapear (after changing bindkeys) I always received temperature and humidity values.

Ok, i switched off bluetooth on my mobile and the app itself.

This is normal behaviour when restarting HA. In this case, the sensor has the state UNAVAILABLE. At least one period (your period option) must elapse after a restart so that entities are updated. If during the first period HA has not received data from the sensor, sensor state changes to UNKNOWN. Since LYWSD03 sends data approximately once every 10 minutes (battery once per hour), it may take 10-12 minutes before the actual sensor reading appear.

That is clear for me, unfortunately I am waiting way much longer after restart to be able to see new (most recent) data from sensors. This is what I have get:

Ok to clarify.

  • Config is ok, right?

  • To get the bindkeys I should use the app (add the sensors) and straight after that I should switch off app/bluetooth an the bindkeys paste to my configuration. Restart the HA an leave it for the night, yes? It dosn’t metter are the letters are as capital or not.

  • There is nothing related to the sensors in logs, right? I haven’t found anything interesting, but as I said I am newbie. So I rather to kindly ask.

Is the above make sense?

Yes. Your configuration looks good.

Yes. Yes. In fact, turning off Bluetooth is not necessary. It may not even be necessary to unload the application from memory - I advise you to try this for confidence.

Yes. In the log, you showed there, is nothing related to our component.

In general, for now, I suggest that you tolerate and just wait. Depending on further behaviour, we will decide what to do next. Check the log from time to time. If the sensors still do not appear, then you must enable debugging mode, as I wrote above.

Hi there!

Im kinda new in the home automation world
I’m trying to setup 3 LYWSD03MMC devices, but no one is shown on dashboard.
Here is my setup:

sensor:
  - platform: mitemp_bt
    encryptors: 
                'A4:C1:38:3A:CC:43': '952c3c97473f5d72e36d7582341bbc8f'
                'A4:C1:38:4D:37:6B': 'b170ae40ab3e7e923c93f41f354b7238'
                'A4:C1:38:1D:7F:40': '1ec5c4897da65037a9e1ebe9610e8132'
    decimals: 1
    period: 60
    log_spikes: False
    use_median: False
    active_scan: False
    whitelist: False

The logs shows:

2020-05-06 00:08:26 DEBUG (Thread-28) [custom_components.mitemp_bt.sensor] HCIdump thread: start main event_loop
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] update_ble called
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] Discovering Bluetooth LE devices
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] Time to analyze...
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] Getting data from HCIdump thread
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] HCIdump thread: joining
2020-05-06 00:09:27 DEBUG (Thread-28) [custom_components.mitemp_bt.sensor] HCIdump thread: main event_loop stopped, finishing
2020-05-06 00:09:27 DEBUG (Thread-28) [custom_components.mitemp_bt.sensor] HCIdump thread: Run finished
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] HCIdump thread: joined
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s).
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] HCIdump thread: Init
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0
2020-05-06 00:09:27 DEBUG (Thread-29) [custom_components.mitemp_bt.sensor] HCIdump thread: Run
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1
2020-05-06 00:09:27 DEBUG (SyncWorker_6) [custom_components.mitemp_bt.sensor] Finished. Parsed: 0 hci events, 0 xiaomi devices.
2020-05-06 00:09:27 DEBUG (Thread-29) [custom_components.mitemp_bt.sensor] HCIdump thread: Connection
2020-05-06 00:09:27 DEBUG (Thread-29) [custom_components.mitemp_bt.sensor] HCIdump thread: Connected
2020-05-06 00:09:27 DEBUG (Thread-29) [custom_components.mitemp_bt.sensor] HCIdump thread: start main event_loop
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] update_ble called
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] Discovering Bluetooth LE devices
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] Time to analyze...
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] Getting data from HCIdump thread
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] HCIdump thread: joining
2020-05-06 00:10:28 DEBUG (Thread-29) [custom_components.mitemp_bt.sensor] HCIdump thread: main event_loop stopped, finishing
2020-05-06 00:10:28 DEBUG (Thread-29) [custom_components.mitemp_bt.sensor] HCIdump thread: Run finished
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] HCIdump thread: joined
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] Spawning HCIdump thread(s).
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] HCIdump thread: Init
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] HCIdump thread: Init finished
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] Starting HCIdump thread for hci0
2020-05-06 00:10:28 DEBUG (Thread-30) [custom_components.mitemp_bt.sensor] HCIdump thread: Run
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] HCIdump threads count = 1
2020-05-06 00:10:28 DEBUG (SyncWorker_8) [custom_components.mitemp_bt.sensor] Finished. Parsed: 0 hci events, 0 xiaomi devices.

I read the documentation but i don’t know what i missing :sob:

Thanks in advance