Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon monitor)

Hi Ghassan, I’ll take a look when I’m home. I hope I’ll find the firmware version anywhere, as I’m not using (and doesn’t have installed) the MiHome app… :laughing:

I only use this custom_component and ZHA for all zigbee thermometers… :wink:

Ok thanks,

But how did you get the encryption codes without using the MiHome app?

Aren’t you using the small square ones, LYWSD03MMC? These are the ones I am using and probably they have different behavior than the other models.

Regards,:slight_smile:

It worked very well, but it stopped after the last update. HA was stopped and started. Still I have:
obraz
Do you have any idea?

Edit: Ok, I already know what happened. I have 24-character token, not 32. So before update I changed AES128KEY_REGEX = "(?i)^[A-F0-9]{32}$" to AES128KEY_REGEX = "(?i)^[A-F0-9]{24}$". Update has changed this entry again to 32, thats the reason.
But I’ve just bought another BLE device. What if it has 32-character token and the second one is 24? How to change sensor.py?

Hi everyone, i´m trying to setup my 2 sensors ( LYWSD02 and LYWSDCGQ ) using this HACS addon. For what i understand reading the documentation these sensors dont need the encryption key, so i have not bothered with that.

Here is a picture from my configuration Yaml
Capturar

Here is my full Log (ignore other error non related to these sensors)

2020-07-20 12:39:46 WARNING (SyncWorker_1) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "group". Check lines 17 and 73.
2020-07-20 12:39:46 WARNING (SyncWorker_1) [homeassistant.util.yaml.loader] YAML file /config/configuration.yaml contains duplicate key "sensor". Check lines 113 and 198.
2020-07-20 12:39:47 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-07-20 12:39:59 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for emby_upcoming_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-07-20 12:40:00 WARNING (SyncWorker_9) [custom_components.emby_upcoming_media.client] Host 192.168.1.198 is not available
2020-07-20 12:40:02 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up emby_upcoming_media platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/emby_upcoming_media/sensor.py", line 88, in setup_platform
    categories = filter(lambda el: el["Name"] in include, categories)
TypeError: 'NoneType' object is not iterable
2020-07-20 12:40:05 INFO (MainThread) [pyipma.location] Using Lisboa (Geofísico) as weather station for Lisboa - Jardim Botânico
2020-07-20 12:41:23 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for erse which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-07-20 12:41:23 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for trakt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

I dont have any entities or readings from these sensors. At the begining i had the “normal” HA integration with LYWSDCGQ and worked fine, but since i also wanted to add the other sensor i decided to go with this HACS addon.

Can someone explain me what i´m doing wrong so the sensors are not recognized?
Thanks.

Did you follow all the instructions described here? https://github.com/custom-components/sensor.mitemp_bt#how-to-install

Is your hci-interface set correct? I Also see the encryptor option in your config, but you said you don’t have these. Please remove them.

Please also check the faq.

I believe followed everything correctly.

This is what i have in configuration yaml

sensor:
  - platform: mitemp_bt
    rounding: True
    decimals: 1
    period: 60
    log_spikes: False
    use_median: False
    active_scan: False
    hci_interface: 0
    batt_entities: False
    encryptors:
       'E7:2E:00:B1:D8:B3'
       '4C:65:A8:D2:DA:76'
    report_unknown: False
    whitelist: False

And this is my Logs

2020-07-20 19:05:49 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-07-20 19:06:00 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2020-07-20 19:06:14 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for mitemp_bt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-07-20 19:06:15 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.mitemp_bt]: expected a dictionary for dictionary value @ data['encryptors']. Got 'E7:2E:00:B1:D8:B3'. (See /config/configuration.yaml, line 92). Please check the docs at https://github.com/custom-components/sensor.mitemp_bt

I think i´m doing everything right, but it doesnr work… Any ideas?

See the last error message. Just remove the following lines from your configuration.

    encryptors:
       'E7:2E:00:B1:D8:B3'
       '4C:65:A8:D2:DA:76'

You only need these lines if you have a device with encryption, which you don’t have. (Note. It gives an error, because you don’t specify an encryption key. In your case, leave the entire encryption part out of your configuration. As stated in the instructions, you only need this for LYWSD03MMC and CGD1 sensors.)

You are correct!!! Thanks!

How stupid of me! reading the documentaion i knew my sensors didnt need the Bind Key BUT i thought they needed the MAC adress (as in the normal HA integration). I never thought on the possibility you told… how silly of me!!

Thanks again.

There is currently an issue with the latest beta 7.1, which prevents Home Assistant 0.113 to fully start up. You will see the starting up message in the left bottom corner after a restart, which stays there forever. Please up/downgrade to the latest stable version 6.10, which doesn’t have this issue.

Is there a way to turn on/off xiaomi mosquitto ble repellent with this platform ?

At this moment, no.

Is there a trick I missed?
I do not see anything when I search for Xiaomi.
(HomeAssistant docker v0.113.1, HACS v1.2.2)

Yes there is. You need to press the +, and then search. Very confusing, but that is the way it is.

image

1 Like

Thanks for your tutoring.

I had used the sensor with that manual integration in the past on the same hardware - except the damaged sd-card.

Now I have moved my underlying OS tu ubuntu 20.04. Will that still work? -
Is there no need to specify the MAC adress?

The log shows:
HCIdump thread: OS error: [Errno 19] error while attempting to bind on interface 0: No such device

When I run sudo hcitool lescan I get this error:
Could not open device: No such device

Did you do

sudo apt-get install bluez 

Did a sudo snap install bluez to install:

sudo apt-get install bluez
Reading package lists... Done
Building dependency tree       
Reading state information... Done
bluez is already the newest version (5.53-0ubuntu3).
bluez set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt install pi-bluetooth
sudo reboot
3 Likes

Hi,
With Xiaomi Mosquito is possibile have a switch to start and stop it from home assistant?

LYWSDCGQ
no new entity_id come out
does it works?
doesn’t it need ip and token?

 [custom_components.mitemp_bt.sensor] HCIdump thread: OS error: [Errno 97] Address family not supported by protocol

Hello, my device is Synology DS918+ doceker