Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist state across restarts #249

Closed
Koenkk opened this issue Aug 5, 2018 · 11 comments
Closed

Persist state across restarts #249

Koenkk opened this issue Aug 5, 2018 · 11 comments
Labels
feature request Feature request stale Stale issues

Comments

@Koenkk
Copy link
Owner

Koenkk commented Aug 5, 2018

When zigbee2mqtt is restarted all cached states of the sensors are lost.

Zigbee2mqtt should persist the state to a file in the following way:

  • Save the state to every 5 minutes.
  • Save the state on exit.

Follow-up of #245

@tb-killa
Copy link
Contributor

tb-killa commented Aug 5, 2018

What about use the available devbox and build a own database with it?

@Koenkk
Copy link
Owner Author

Koenkk commented Aug 5, 2018

@tb-killa dumping the JSON object is enough :)

@cmorlok @hoangtuit can you checkout the dev branch and check if it solves your problem?

@cmille34
Copy link

Is this getting close to becoming production? Retaining the values across reboots would help with some of the issues I've been annoyed with as well.

@Koenkk
Copy link
Owner Author

Koenkk commented Aug 13, 2018

If you want to try it out you can use the dev branch for now.

@cmille34
Copy link

Is there a docker image with the dev branch? If not, any brief instructions on how I would use dev in a docker?

@Koenkk
Copy link
Owner Author

Koenkk commented Aug 14, 2018

Yes, the -dev images.

@lolorc
Copy link
Contributor

lolorc commented Aug 29, 2018

@Koenkk can it be configurable ?
when I restart zigbee2mqtt it sends all the persisted states. And it's not what I want at all, I really don't want to risk feeding mqtt with very old outdated states...

@Koenkk
Copy link
Owner Author

Koenkk commented Aug 29, 2018

Would an option to disable this be enough? (in configuration.yaml)

@clockbrain
Copy link
Contributor

Perhaps a specified time limit in configuration.yaml e.g. 60 (minutes)? On restart if saved state is within that limit it uses saved state otherwise it doesn't.

@lolorc
Copy link
Contributor

lolorc commented Aug 30, 2018

@Koenkk an option would be great, so it could either be a boolean or a integer to specify the retention period as @clockbrain proposed. 0 could be no retention, 1 could be 1sec/min/hour...
but lastseen attribute would be needed to do the retention thing ;-)

@stale
Copy link

stale bot commented Dec 15, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Stale issues label Dec 15, 2018
@stale stale bot closed this as completed Dec 22, 2018
wilmardo pushed a commit to wilmardo/zigbee2mqtt that referenced this issue Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Feature request stale Stale issues
Projects
None yet
Development

No branches or pull requests

5 participants