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

Addon is checking every hour, fixed time or with a trigger possible? #46

Open
Imperial-Guard opened this issue Nov 28, 2018 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Imperial-Guard
Copy link

Now my add-on is checking every hour. But would it be a possible to set a trigger or on a fixed time?

I make every night my backup, so for e.g. would be great to execute my upload a hour later.

@d0ugal d0ugal added the enhancement New feature or request label Nov 28, 2018
@Imperial-Guard Imperial-Guard changed the title Addon is checking every hour, fixed time possible? Addon is checking every hour, fixed time or with a trigger possible? Nov 28, 2018
@d0ugal
Copy link
Owner

d0ugal commented Nov 28, 2018

Yeah, I think we need to change how this works. It is a little tricky.

Really I want the addon to run, backup the snapshots and stop. Then your automation would just start the backup after the snapshot is created. The problem is, you can trigger a snapshot but you don't know when it is ready. I can see three ways to handle this.

  1. In your automation you guess how long the snapshot will take to generate. So then it looks like...
    1.1. Create snapshot
    1.2. Wait for X minutes
    1.3. Start snapshot backup

  2. The addon starts and waits for a new snapshot to be added. Once it finds one and upload it then it stops. Then the automation looks like this:
    2.1 Create snapshot
    2.2 Start addon. It will say something like "INFO: Waiting for new snapshot...." then it will upload it and then exit.

  3. Add a new event to HASS.io that happens when the snapshot creation is finished. We can then use that to start the addon. The automation then looks like...
    3.1 Create snapshot
    3.2 HASS.io finishes creating the snapshot and triggers event "snapshot_creation_finished" (or similar)
    3.3 Second automation is triggered by this event and starts the backup addon.

I think option three is best, but that requires a change in HASS.io. Then option two and I think option one is worst :)

Either way, all of these options would be more efficient than the current approach of checking every X minutes all day long.

@Imperial-Guard
Copy link
Author

@d0ugal Thanks for your quick reply and off course for creating this add-on.

I understand what you're saying. What do you recommend for time to check? And did you noticed any performance issues?

@d0ugal
Copy link
Owner

d0ugal commented Nov 28, 2018

What do you recommend for time to check?

Do you mean how long should it check between uploads? I use hourly. If there is nothing to upload it is very quick and finishes fast

And did you noticed any performance issues?

I have not noticed any but I run HA on a fairly powerful server (not a pi).

@d0ugal
Copy link
Owner

d0ugal commented Nov 28, 2018

I opened a HASS.io issue. Maybe we can look into adding the event there which would be nice. home-assistant/supervisor#839

@d0ugal d0ugal added the help wanted Extra attention is needed label Apr 1, 2019
@dawiyo
Copy link

dawiyo commented Apr 24, 2019

Here's a solution I've been using. I have mins_between_backups set to 1500 which is 25 hours. I then use hassio.addon_restart to restart the plugin which manually triggers a backup.

@d0ugal
Copy link
Owner

d0ugal commented Apr 24, 2019

@dawiyo That works, the downside is that the addon is still running and waiting to backup - wasting a small bit of resources.

@dawiyo
Copy link

dawiyo commented Apr 24, 2019

@dawiyo That works, the downside is that the addon is still running and waiting to backup - wasting a small bit of resources.

I guess I could do hassio.snapshot_full, 10 min delay, hassio.addon_start, 10 min delay, hassio.addon_stop. It's hacky but might work.

@d0ugal
Copy link
Owner

d0ugal commented Apr 24, 2019

Yup, that would do it!

I think adding an option to stop the add on after uploading would be a decent solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants