Estimated reading time: 6 minutes

Home Assistant is an incredibly powerful smart home system, but how do you actually save important states and variables that should be retained when restarting? Here comes the Saver integration into play! With this practical extension, you can save the statuses and variables of your devices and restore them as required so that your smart home continues to run seamlessly and without disruption.

For detailed instructions and an explanation of all configuration options, I recommend the YouTube video linked below. In this video, every single setting is explained in detail so that you receive comprehensive instructions for the exact setup. You can find any code from the video in this article so that you can use it directly without having to type it in.

Why Saver?

Sometimes you want to make sure that certain values, such as the brightness of a lamp or the last temperature measurement of a sensor, are retained even after restarting Home Assistant. By default, such data is often lost after a restart. Saver helps you to back up and automatically restore this information so that your system can seamlessly pick up where it left off.

Installation of HACS and integration of Saver in Home Assistant

Step 1: Installing HACS in Home Assistant

Home Assistant Community Store (HACS) is a custom add-on for Home Assistant that provides access to a variety of custom integrations and plugins developed by the community. How to install HACS:

  1. Check requirements: Make sure that your Home Assistant is ideally up to date.
  2. Download Execute script: Open a terminal for the Docker container version or the core version.
    • Docker: Dial into the container with: docker exec -it homeassistant bash or (similar)
    • Core: Switch to the user who is running Home Assistant
    • Execute the following command for both variants:
      wget -O - https://get.hacs.xyz | bash -
  3. Restarting the Home Assistant: After the files have been copied, restart Home Assistant.
  4. Integrate HACS into Home AssistantGo to "Configuration" > "Integrations" > "Add" in the Home Assistant interface and search for HACS. Add it and enter your GitHub token if prompted.

For the supervised version, please refer to the Documentation of HACS itself to read about the installation.

Step 2: Add Saver integration via HACS

Once HACS is installed, you can simply add Saver:

  1. Open HACS: Go to HACS in the Home Assistant interface.
    Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.
  2. Search for integrationClick on "Integrations" and use the search function to search for "Saver".
  3. Install SaverFind Saver in the list and click on "Install". This will add the integration to your Home Assistant.
    Open your Home Assistant instance and start setting up a new integration.
  4. Restarting the Home Assistant: Start Home Assistant again to apply the changes.
  5. Configure saverAfter restarting, you can set up and customize Saver via "Configuration" > "Integrations" in Home Assistant.

Conclusion

With these steps, you have successfully installed HACS in your Home Assistant and added the Saver integration. This powerful combination opens up a world of additional features and customizations that have been and are being developed by the Home Assistant community. More blog posts and videos on useful integrations to follow. If you don't want to miss out, subscribe to my YouTube channel!

Last updated on 20. November 2024 at 12:20 - Image source: Amazon Affiliate Program. All statements without guarantee.

Saver functions

The Saver integration for Home Assistant, developed by PiotrMachowski, is a flexible tool that allows users to save the state of any entity and retrieve it later. This function is ideal for situations in which certain states need to be saved temporarily and then restored in the automation process. It offers many possibilities, for example for scene and lighting control, temporary state changes or for controlling complex automations.

Here are the most important functions in detail:

1. saving and restoring entity states

With the Saver integration, the current status of an entity (e.g. light, thermostat or volume of a loudspeaker) can be saved. This function is useful for saving the status when starting an automation, for example, and restoring it after completion.

Example application: If an automation changes certain lights, you can save the initial lighting and return it to its original state later, after the automation. This works by calling saver.save_state and later retrieval with saver.restore_state.

service: saver.save_state
data:
  entity_id: light.living_room

2. setting and deleting variables

The integration allows you to set user-defined variables that serve as "caches" for values that are to be used in various automations.

Example application: A variable could be used to store the number of times one of your devices is switched on and off. This can be useful for analysis or for more complex automation logic.

service: saver.set_variable
data:
  name: "counter_lights"
  value: 5

Later, the value of the variable can be retrieved via the name and used in further automations.

3. status management and clearing (Clear Data)

If stored data is no longer required, it can be deleted with the saver.clear_data-function can be deleted. This is particularly useful if new states or variables are saved regularly and old data needs to be cleaned up in order to optimize performance.

Summary and benefits for automation

Saver integration is particularly helpful in more complex automations where various conditions and states need to be taken into account. Examples include

  • Thermostat controlTemporarily save the state of a thermostat in order to make an adjustment during a presence simulation and restore the original state later.
  • Scene managementSave lighting or media states to return to the previous state after a scene such as "Dinner".
  • Variable useDynamically adjust counters or user-defined values such as the number of people in the house, based on motion sensors or other triggers.

The Saver integration creates additional flexibility in Home Assistant, allowing it to control automations more precisely and help users manage state changes safely and efficiently.

For further details and current developments, please contact the GitHub page of the project available.

YouTube video implementation

Conclusion

The Saver integration for Home Assistant is a valuable extension if you want to ensure that certain states and variables are retained even after a restart. It simplifies the saving and restoring of data and thus ensures trouble-free smart home operation.

The display of the products was implemented with the affiliate-toolkit plugin.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

en_US