Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Encrypted BtHome? #10

Open
nagyrobi opened this issue Oct 11, 2023 · 3 comments
Open

Encrypted BtHome? #10

nagyrobi opened this issue Oct 11, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@nagyrobi
Copy link

nagyrobi commented Oct 11, 2023

I'd like to passively catch encrypted BtHome advertisments sent by Xiaomi sensors running pvvx firmware. I have the bindkey extracted for each.

Currently they are passed to HA via proxy, and HA decrypts them, but I'd like to use the measurements locally on ESPHome node, rather than import them back from HA through the API.

Additionally, averaging filters on ESPHome are much better than HA's filters, that's another reason to do all the maths in the node firmware. Not mentioning HA as a central single point of failure...

@afarago
Copy link
Owner

afarago commented Oct 11, 2023

Hi, that is a great idea - do you feel like creating an initial PR for the parser?
https://github.com/afarago/esphome_component_bthome/blob/master/components/bthome_base/bthome_parser.cpp
As of today I have bthome_ble_receiver component that works with unencrypted bthome messages.

I have very little knowledge on the AES-CCM yet.
Once we have a working solution I am happy to add the necessary augmentation to the esphome component.

@nagyrobi
Copy link
Author

I lack the C++ knowledge unfortunately, but I assume some inspiration on the logic behind decryption could be taken from how HA BtHome component does it.

@nagyrobi
Copy link
Author

nagyrobi commented Oct 11, 2023

Also see https://github.com/esphome/esphome/blob/41f29c46d024138ae8b3a1dd19d94f1c4ed96816/esphome/components/xiaomi_ble/xiaomi_ble.cpp#L234C19-L321C19

Maybe this would work almost out of the box, as BtHome in pvvx is using the same bindkey as the original firmware.

@afarago afarago added the enhancement New feature or request label Dec 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants