Giter Club home page Giter Club logo

Comments (7)

kuba2k2 avatar kuba2k2 commented on May 30, 2024 1

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.

descipher avatar descipher commented on May 30, 2024

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.

descipher avatar descipher commented on May 30, 2024

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.

descipher avatar descipher commented on May 30, 2024

Not a bug in any case, closing this, thanks.

from libretiny.

descipher avatar descipher commented on May 30, 2024

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.

descipher avatar descipher commented on May 30, 2024

It's repeatable.

  1. Starting from a off state after a power cycle.
  2. Set state to on and wait 60+ seconds.
  3. Power cycle and verify the on state occurs.
  4. Set state to off and wait 60+ seconds.
  5. Power cylcle. State save of off fails an will be on in the on state. (this will occur every time)
  6. Now from the last point set the state to off, immediately followed by on and then finnish with an off state waiting 60+ seconds.
  7. 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.

descipher avatar descipher commented on May 30, 2024

Parameters were in error, it works as expected given enough time.

from libretiny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.