aronsky / esphome-components

Custom components for ESPHome
MIT License
38 stars 33 forks source link

Add v3 signature to a packet #9

Closed flicker581 closed 6 months ago

flicker581 commented 7 months ago

V3 protocol require packet signatures before CRC and "whitening".

Current LampSmart Pro does not support sending commands without this signature, so, I suppose it is harmless.

oxcid3 commented 7 months ago

Watching this and testing on my light. Not currently working but very excited that you're trying to sort. Thanks 🤞🏻

flicker581 commented 7 months ago
  1. LampSmartPro 1.2.9 sends only v3 messages (i.e. with the signature). This makes me feel that the change is backward compatible. I have no ways to test, because I do not own any of these lamps. I have checked only that:
    • the signature generated by the code is passing the same check as LampSmartPro's signature.
    • my friend's lamp is working with this code.
  2. Ok. Unfortunately, base code have no provisions for pluggable algorithms.
  3. AES code is from https://github.com/kokke/tiny-AES-c, where it is published as "public domain". Now I have replaced it with mbedtls, which comes in arduino-espressif32. Have no idea how stable this dependency is.

Feel free to use my code as you wish, integrate it some way or drop it. I personally have no special interest in it. Sorry.

@oxcid3 So, if this does not work for you (and you are sure doing thing right), your lamp needs older algo. Tried lampify yet?

aronsky commented 7 months ago

@flicker581 - thanks for the changes! I'll test it as soon as I get the chance (to verify that it's backward-compatible), and get back to you.

aronsky commented 6 months ago

Thanks for the changes. I didn't get a chance to test them out (as I switched to a different LED driver that works with a different app). I'm merging this - hopefully it works for everyone. In any case, for now, the version without the signature remains available in the refactored code - and in the future, I'll add support to make the signing optional.