Giter Club home page Giter Club logo

clean_up_snapshots's Introduction

Clean up snapshots

hacs_badge CI

This Home Assistant extension exposes a service to automate the clean up of old snapshots.

Prerequisites

To be able to use this extension you must must have the following integrations enabled and configured within your Home Assistant installation.

To manage the installation and upgrades easier it's recommendated to use HACS.

HACS installation:

  1. Navigate to HACS Store
  2. Under the Integrations tab, click the add button (the one with a plus sign)
  3. Search for "Clean up snapshots service"
  4. Click on the service, and then on Install this repository in HACS
  5. Restart Home Assistant (Configuration > Server Controls > Restart)
  6. Generate a Long Lived Token
    1. Navigate to your profile page.
    2. At the bottom of the page you will see a section called Long-Lived Access Tokens.
    3. Click Create token.
    4. In the pop up give your token a name.
    5. Copy the token from the following pop up This will not be saved anywhere so put it somewhere you can find it again
  7. Copy resulting token input this in configuration.yaml:
clean_up_snapshots_service:
  host: !secret base_url
  token: !secret clean_up_token
  number_of_snapshots_to_keep: 3
  1. Restart Home Assistant (Configuration > Server Controls > Restart)
  2. Look for the new clean_up_snapshots_service.clean_up service (Developer Tools > Services).

Consumption in automations

You can trigger this service in an automation similarly to the one below.

alias: Daily snapshot clean up
initial_state: 'on'
trigger:
  platform: time
  at: '03:00:00'
condition:
action:
  - service: clean_up_snapshots_service.clean_up
    # Data is optional if you have defined the number of snapshots to keep in the configuration.yaml.
    # data:
      # If this property is passed to the service it will be used regardless of what you have in the configuration.yaml
      # number_of_backups_to_keep: 7

Configuration:

When configuring this plugin you will need to define a few parameters.

  1. host (Required) - This is the url to access your home assisant instance. The url can have a trailing / if you desire. It can also be https or http
    1. https://supervisor:8123
    2. https://supervisor:8123/
  2. token (Required) - The Long-Lived Access token you generated during installation.
  3. number_of_snapshots_to_keep (Optional - default value is 3) - The number of snapshots you wish to retain.
  4. use_ssl_with_ip_address (Optional - default value is False) - If you wish to verify the SSL Certificate for your home assistant instance and you are using an IP Address for your url then you need to set this to True.

Example configurations

clean_up_snapshots_service:
  host: !secret base_url
  token: !secret clean_up_token
  number_of_snapshots_to_keep: 3

clean_up_snapshots_service:
  host: "https://supervisor:8123"
  token: mytoken
  number_of_snapshots_to_keep: 3

clean_up_snapshots_service:
  host: http://supervisor:8123
  token: mytoken
  number_of_snapshots_to_keep: 3

clean_up_snapshots_service:
  host: http://supervisor:8123/
  token: mytoken
  number_of_snapshots_to_keep: 3

clean_up_snapshots_service:
  host: https://1.1.1.1:8123
  token: mytoken
  number_of_snapshots_to_keep: 3
  use_ssl_with_ip_address: True

Note When using hassio as your domain you may need to have your url be hassio.lan:8123 See issue #12

clean_up_snapshots's People

Contributors

tmonck avatar inverse avatar hcanber avatar snoof85 avatar

Watchers

James Cloos avatar

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.