Passive BLE Monitor integration (Xiaomi Mijia BLE MiBeacon monitor)

Oh… Thank you for your attentiveness and for the report. I added a fix to the branch.

Good Morning,

I don’t know why, but it is impossible for me to configure this integration in Home Assistant. I have tried to install it through HACS, manually … with stock firmware, with custom firmware … and there is no way it works. I put everything according to the repository instructions:

ble_monitor:
  rounding: True
  decimals: 1
  period: 60
  log_spikes: False
  use_median: False
  active_scan: False
  hci_interface: 0
  batt_entities: False
  discovery: True
  report_unknown: False
  devices:
    - mac: 'XX:XX:XX:XX:XX:XX'
      name: 'Termohigrometro 1'
      encryption_key: 'XxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXx'
    - mac: 'XX:XX:XX:XX:XX:XX'
      name: 'Termohigrometro 2'
      encryption_key: 'XxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXx'

But I always end up with the same message: “Invalid config. The following integrations and platforms could not be set up: ble_monitor.sensor. Please check your config.”

I am running Home Assistant on a Raspberry Pi 3B + through a docker container.
Can anyone give me any ideas? Is there a way to see, somewhere, why it won’t install?

Hi,

I had a similar error. Remove the Caps in “True” and “False” and leave without them, so change them to “true” and “false”

Regards,

Hmmm… Do you know the details of why this happens? In my configuration all True and False are capitalized and I have no problem with that. And I have never heard of such a thing before…

@mesoulrock, which version of the component are you trying?

Hi @magalex, to me maybe was a coincidence, but after that, the debug message of error dissapeared. By the way the RJ-45 extension that you shared in a previous message I think are great, cheaper and in the future I’ll purchase one of those. Thanks for that suggestion.

1 Like

Have you tried doing a configuration check before restarting? (Advanced mode must be enabled in your HA profile).

Good evening everyone, and thanks for replying.

@juansa, I have tried to make the changes that you tell me and unfortunately the problem has not been solved, in my case.

@magalex, right now I’m on HA version 0.114.4, and I’m testing with BLE Monitor integration 0.8.5.

By the way, thank you very much for telling me how to activate the advanced options, I had been wondering for a long time why I was not able to verify the configuration … :slight_smile: I was always restarting HA and seeing if it gave me errors in Notifications.
The configuration as I have it gives me as correct, but it still does not work for me.

Hm. 0.114… Perhaps the point is some kind of incompatibility, introduced since 0.114… I usually test with the current at the moment release version.
@Ernst, do you have any ideas on this?

Can you copy/paste full text of your error from the HA log, and are there any other errors there?

@magalex, I have also thought about the possibility that it is due to the HA version, but I have a problem with that:
I have integrated a Broadlink RM 3 mini and a Beok thermostat. Starting from a certain version, the integration of the Broadlink RM 3 mini is done natively, and for some reason, it is not compatible with the integration (floureon) of the thermostat. So … I have to choose between having an integrated device or the other.

That is why I stayed in an older version.
And from what I see… I may also have to choose now again.

Sorry, I have not said the devices that I want to integrate, although in principle they are compatible with BLE Monitor. It is about Xiaomi thermohygrometers, model LYWSD03.

Am… the error shows it to me in the notification area, it does not give me the option to see the log as when there is an error (because apparently there are no errors).
Tell me how can I do it and I try.

Captura de pantalla 2020-12-08 a las 21.22.34

Seems like i found the reason: https://github.com/custom-components/ble_monitor/issues/130#issuecomment-716131311

I think we can do something about it. Need to think.

Now the log can be viewed in Configuration -> Logs. Earlier, if my memory serves me, it was somewhere in the Developer Tools.

I have found things in the logs:

## Detalles de registro (ERROR)

Logger: custom_components.ble_monitor
Source: custom_components/ble_monitor/__init__.py:484
Integration: Passive BLE monitor integration documentation
First occurred: 20:44:05 (15 occurrences)
Last logged: 21:17:03

Decryption failed: MAC check failed
## Detalles de registro (ERROR)

Logger: custom_components.ble_monitor
Source: custom_components/ble_monitor/__init__.py:485
Integration: Passive BLE monitor integration documentation
First occurred: 20:44:05 (15 occurrences)
Last logged: 21:17:03

* token: 4fc50e0d
* token: a38523fb
* token: fdb51e1d
* token: a5cd728e
* token: b84e1eeb
## Detalles de registro (ERROR)

Logger: custom_components.ble_monitor
Source: custom_components/ble_monitor/__init__.py:486
Integration: Passive BLE monitor integration documentation
First occurred: 20:44:05 (15 occurrences)
Last logged: 21:17:03

* nonce: 43fa0a38c1a45b0570060000
* nonce: f858ca38c1a45b056a060000
* nonce: 43fa0a38c1a45b0572060000
* nonce: f858ca38c1a45b056c060000
* nonce: f858ca38c1a45b056e060000
## Detalles de registro (ERROR)

Logger: custom_components.ble_monitor
Source: custom_components/ble_monitor/__init__.py:488
Integration: Passive BLE monitor integration documentation
First occurred: 20:44:05 (15 occurrences)
Last logged: 21:17:03

* cipherpayload: 3a21a497d7
* cipherpayload: 911d2c46
* cipherpayload: c18b0e298b
* cipherpayload: d6dbf69ff2
* cipherpayload: 3d10af85ed

Make ble_monitor configuration minimal, restart HA, and check the log for errors.
Like this:

ble_monitor:
#  rounding: True
#  decimals: 1
#  period: 60
#  log_spikes: False
#  use_median: False
#  active_scan: False
#  hci_interface: 0
#  batt_entities: False
#  discovery: True
#  report_unknown: False
#  devices:
#    - mac: 'XX:XX:XX:XX:XX:XX'
#      name: 'Termohigrometro 1'
#      encryption_key: 'XxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXx'
#    - mac: 'XX:XX:XX:XX:XX:XX'
#      name: 'Termohigrometro 2'
#      encryption_key: 'XxXxXxXxXxXxXxXxXxXxXxXxXxXxXxXx'

@mesoulrock I have prepared for you an archive, with the contents of which you need to replace all the files in the folder custom_components/ble_monitor and restart HA.

The errors that you cited above, in a normal situation, indicate an inappropriate encryption key. First, try to run the code from my archive with minimal configuration, and if everything goes well, restore the full configuration.

Now it has worked!
I previously tried the minimal configuration as well and it failed me the same. Thank you very much @magalex!

I started the first time with the minimum configuration and it recognized me sensors (without the name).
Then I started adding the full configuration and as you said, it works!

Although … now he recognizes me, I think, the gentlemen in duplicate. It is normal?
I correct: I see that it recognizes them as old … I guess it’s a matter of “deleting” them and that’s it …

Captura de pantalla 2020-12-08 a las 22.22.55

Yes, this is due to the fact that with minimal configuration, component created entities with mac addresses in the names. After you returned the configuration, new entities appeared with the names “Termohigrometro”. You can fully comment out the entire configuration (along with ble_monitor: text), reload HA, delete all these entities, return the full configuration, reload HA again.

Amm … I still have a problem: now it recognizes me, but … it does not show me data:

The unknown status in the absence of errors in the log and in the presence of encryption keys means that the component hears the sensor, but has not yet received any useful data from it (otherwise the status would be unavailable).
LYWSD03MMC rarely send data (everything is in the documentation).

Ok, it’s probably my mistake, but I don’t know how to interpret that information.
So you mean that the component works fine, but the devices are not configured correctly (possibly due to an error in the encryption_key)?

I have reconnected the devices with the ThelinkFlasher page to get two new keys again. I have modified the configuration, I have rebooted and there is one of the devices that now does not recognize me :frowning:. However, the other that does recognize me already shows data :slightly_smiling_face:.

I correct: I did not recognize it because it was still connected to the mobile. I have disconnected the bluetooth of the mobile and it has gone to “Unknown”.