Replies: 2 comments
-
Hi @regan-a , I'm starting to use this code for my ESP32 Home Assistant BTHome sensors too. Just experimenting with the example code and learning from it at the moment. My c++ is pretty rusty and I'm using this case for getting along with proper coding standard and learning something more. Anyway ... one of my next steps will be to implement some deep sleep code as you already did. So I guess I will encounter same probs like you. I'd gladly share ideas and code with you. Let's keep in touch. |
Beta Was this translation helpful? Give feedback.
-
How hacky are those changes? Would you share it? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, first of all, thank you for this great project! I am using this code in a battery-operated luminosity sensor that I put into deep sleep when not reading & transmitting sensor data. The problem I've run into is that the value of m_encryptCount does not properly increment across the sleep/wake cycle. I understand this is because the previous value is not stored in RTC memory and thus a new random value is generated for each BLE advertisement.
This is problematic because my receiving system (Home Assistant) has started caring about this counter. Now, if the encryption counter value is equal to or less than the previous counter value, the advertisement is skipped. This results in most advertisements being discarded.
I have made some very hacky changes to BTHome.cpp that allow the counter to increment properly on sleep/wake but my knowledge of C++ is very limited so I'm still very much interested in seeing this functionality properly implemented into this project.
Has anyone else encountered this? How did you overcome it?
Beta Was this translation helpful? Give feedback.
All reactions