Comments (7)
Note how it says "RTC" in the code you highlighted. Beken chips, unlike ESP, don't have any RTC memory for data preservation. Even if they did, a power loss would make it go away.
Thus, preferences are stored in the flash memory. Because of wear leveling, they are saved every 10 minutes or so, not upon each change. I believe ESP chips do the same and that they won't recover the very latest state after a power loss either.
from libretiny.
Thanks for the info, I did, notice the Real Time Clock abstraction to flash. There are some use cases where we need to have an consistent restore state on the save without waiting for the s_pending timeout call back. I believe that was handled by the restore_from_flash schema option within esp based components. Perhaps I can look at it, just very new to the code base so it's not easy finding some elements within the heavy abstraction structure of esphome functions.
from libretiny.
Ok, found the save interval define, its 60 seconds, that works for almost every case, unfortunatly its "global" not sure thats the best way to handle it. Also restore_from_flash appears to be required for esp8266 based devices.
from libretiny.
Not a bug in any case, closing this, thanks.
from libretiny.
Retested with the new parameters, we do have a bug. It failed to save an off state after 10min. Seems to be good on saving an on state consistently but not always an off state.
from libretiny.
It's repeatable.
- Starting from a off state after a power cycle.
- Set state to on and wait 60+ seconds.
- Power cycle and verify the on state occurs.
- Set state to off and wait 60+ seconds.
- Power cylcle. State save of off fails an will be on in the on state. (this will occur every time)
- Now from the last point set the state to off, immediately followed by on and then finnish with an off state waiting 60+ seconds.
- Power cycle, the state will be succesfully restored as the off state.
My assumption would be that only the on state triggers a flag to save the current state with a switch component.
from libretiny.
Parameters were in error, it works as expected given enough time.
from libretiny.
Related Issues (20)
- Reset to default
- RTL87xx chips don't support CHANGE interrupts HOT 2
- BK7231N : Save user data HOT 2
- LT 1.5.0 crashes with "RTL8195A Hard Fault Error" after WiFi scan HOT 4
- Error while compiling in HA HOT 1
- restore_mode ALWAYS_OFF not working on generic-bk7231n-qfn32-tuya HOT 1
- support for BK7231M(CB2S) HOT 19
- PlatformIO is Broken with "KeyError: \"Invalid board option 'build.family'\"" HOT 4
- Support for bk7238 HOT 3
- Wifi chip from Smart Plug reports as Rtl8710c How to flash or dump it? HOT 4
- [RTL8710BX] [T102_V1.1] [BL0937] pin change interrupts / Getting BL0937 to work with rtl87xx
- BK7231N : The compiled Firmware file size exceeds the flash memory HOT 3
- instructions contradictory in ltchiptool? HOT 6
- Further clarification to what 1.5M baud rate refers to HOT 2
- Problems when configuring wifi for devices using the BK7231N chip and connecting the device to the App HOT 2
- MOES WS-B-US 2 Button Smart Switch did not create other components such as binary_sensor, light, etc. in HA? HOT 2
- LibreTiny refactor HOT 3
- unable to write to BK7231M on CB2S HOT 7
- Intermittent connection issues with bk72xx ESPHome devices HOT 25
- Feature Request : Maintain constant state through reboot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libretiny.