bthome-ble: BTHome incidentally fails decryption

Describe the bug Since HA Core beta 2024.2b1 BTHome incidentally fails decryption and I can only get rid of the reconfigure message by re-applying the bind key, even though the device was successfully decrypting on newer messages. Problem is also in 2024.2b2 and 2024.2b3

To Reproduce Install the latest HA Beta and over time you will get notices that the BTHome needs re-authentication.

Additional context

The notice on re-authentication: Screenshot 2024-02-02 at 19 48 12

The reconfigure message: Screenshot 2024-02-02 at 19 45 21

The device is just successfully receiving valid data Screenshot 2024-02-02 at 19 45 33

Relevant messages from home-assistant.log

2024-02-02 16:28:37.792 WARNING (MainThread) [bthome_ble.parser] Decryption failed:    
2024-02-02 17:22:00.324 WARNING (MainThread) [bthome_ble.parser] Decryption failed:
2024-02-02 19:29:47.136 WARNING (MainThread) [bthome_ble.parser] Decryption failed:                      

Notice there is no additional info in the logs even though the : makes you think more info should follow.

The re-authentication notice and reconfigure message disappear after a HA restart but then appear again after some time

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 24 (1 by maintainers)

Most upvoted comments

Just a note, to see the debug for bthome-ble, you probably also need to add it:

logger:
  default: info
  logs:
    homeassistant.components.bluetooth: debug
    homeassistant.components.bthome: debug
    homeassistant.components.bthome_ble: debug

The issue should be closed in the next point release of HA (2024.3.1), see https://github.com/home-assistant/core/pull/113008

This issue can be closed therefore. Thanks all for your help

Yes, I understand. But it would be good to understand why some of the messages are encrypted incorrectly.

I will look into creating a workaround in the bthome parser, to avoid reauthentication.

Ok, there’s a lot of logging going on now. I now have to wait for a Decryption failed: message

There is (most likely) a bug in the most recent firmware versions of the Shelly door/window sensor, see https://github.com/home-assistant/core/issues/109529

I have send Shelly a message on discord, but haven’t got a response yet. Please send a message to Shelly.

I’m using 5 Xiaomi temperature sensors with the pvvx firmware. I’ll mail you the MAC addresses and encryption keys