-
Notifications
You must be signed in to change notification settings - Fork 258
Description
After I power-cycle my LYWSD03MMC's, they start broadcasting with what I think is a randomised bindkey, not the one I had configured it with. The bindkey appears to be stored in flash OK, and works if I re-configure the bindkey, but stops working after a power-cycle.
Steps to reproduce:
-
Configure LYWSD03MMC with:
- advertising format: BTHome
- adv flags: on
- encrypted: on
-
Send a bind key to the device
- it reports it written and read OK (so looks like the flash write is good).
-
disconnect
- homeassitant then starts receiving encrypted advertisements, and homeassistant's bthome integration decrypts them OK.
-
Remove the battery from the device for several seconds, then reinstall battery.
- advertisements are still encrypted but homeassistant cannot decrypt them with the previously working bindkey.
-
Connect to the device
- "read bindkey" shows correct, original bindkey.
- "write bindkey"
- disconnect
-
Device sends encrypted advertisements, and homeassistant can decrypt them OK.
(note: currently Homeassistant's BTHome integration has a bug where it gets stuck trying to re-auth/reconfigure the device, I'll link to the PR to fix that once I've raised it)
Guesses :-)
I notice that init_ble
is called before bindkey_init
but I don't know if that matters at all.
Since I can read the bindkey after a reboot it looks like the flash is working OK, but for some reason the device starts up not using the bindkey that is stored in flash.