Backup Services
In this article, you will learn how to generate backups of your Home Assistant configuration and restore it when needed. To create backups, a service is called that generates a secure archive with configuration files. Also service adds Mosquitto brocker and Zigbee2MQTT configuration to backup if exist. This service then adds the archive to IPFS and stores the resulting CID in Robonomics Digital Twin.
Creating Home Assistant Configuration’s Backup
Creating a backup allows you to easily restore your Home Assistant configuration in the event of a failure.
In the web interface of Home Assistant go to
Developer Tools->Services. Search forRobonomics: Save Backup to Robonomicsand pressCALL SERVICE.Wait until you see the notification
Backup was updated in Robonomicsappear inNotification.WARNINGDo not attempt to create a backup or restore configuration immediately after loading Home Assistant and Robonomics Integration. Please wait for approximately 5 minutes to allow for the initial setup to complete.
Service arguments:
- Full Backup (default: False) - add database to the backup, so history of entity states will be stored too.
- Path to mosquitto password file (default:
/etc/mosquitto) - If you used Home Assistant Core or Docker installation methods and don’t have default path to Mosquitto brocker, you should change this parameter. Not needed for Home Assistant OS or Superviser.
Restoring Home Assistant Configuration from Backup
In order to restore your configuration, you will need an installed Home Assistant and Robonomics Integration.
Install Home Assisntant with Robonomics Integration (if it is not installed yet), following the steps from the article for the desired installation method.
Set up Robonomics Integration using the same seeds you used in previous Robonomics configuration. If you subscription has ended, reactivate it.
In the web interface of Home Assistant go to
Developer Tools->Services. Search forRobonomics: Restore from the Backup in Robonomicsand pressCALL SERVICE. Navigate to theOverviewpage, to check the status of your backup, .After restoring, Home Assistant will automatically restart. If for some reason Home Assistant does not restart, you can check the restoration status by monitoring the state of the
robonomics.backupentity. If the status isrestoredyou will need to manually restart Home Assistant by navigating toSettings>Systemand clicking on theRESTARTbutton located in the upper right corner.If your backup includes the Zigbee2MQTT or Mosquitto configuration, you need to restart these services to enable the new configuration. You can do this manually by restarting the services individually, or you can simply restart the Home Assistant computer to ensure all services are restarted.
Service arguments:
- Path to mosquitto password file (default:
/etc/mosquitto) - If you used Home Assistant Core or Docker installation methods and have not default path to Mosquitto brocker, you should change this parameter. Not needed for Home Assistant OS or Superviser. - Path to Zigbee2MQTT config (default:
/opt/zigbee2mqtt) - If you used Home Assistant Core or Docker installation methods and have not default path to Zigbee2MQTT, you should change this parameter. Not needed for Home Assistant OS or Superviser.
Restore Mosquitto and Zigbee2MQTT Configuration for Home Assistant Core Installation Method
If the backup includes the configuration for Mosquitto or Zigbee2MQTT, during the restore process, they will be placed in the default path or in the path specified in the arguments. However, if you installed the Robonomics integration in an existing Home Assistant Core (not from the preinstalled Robonomics image), the homeassistant user may not have access to this path.
So to restore the configuration of Mosquitto and Zigbee2MQTT, you need to grant the necessary read permissions to the user homeassistant:
sudo chmod a+w /opt/zigbee2mqtt /etc/mosquittoBackup Mosquitto and Zigbee2MQTT Configuration for Home Assistant Docker Installation Method
To backup the Mosquitto and Zigbee2MQTT configurations from a Docker container, you need to create volumes for their respective configurations. This can be achieved by running your Home Assistant container with additional arguments:
docker run -d \
--name homeassistant \
--privileged \
--restart=unless-stopped \
-e TZ=MY_TIME_ZONE \
-v /PATH_TO_YOUR_CONFIG:/config \
-v /etc/mosquitto:/etc/mosquitto \
-v /etc/mosquitto:/opt/zigbee2mqtt \
--network=host \
ghcr.io/home-assistant/home-assistant:stableor make changes in your compose.yaml file:
version: '3'
services:
homeassistant:
container_name: homeassistant
image: "ghcr.io/home-assistant/home-assistant:stable"
volumes:
- /PATH_TO_YOUR_CONFIG:/config
- /etc/localtime:/etc/localtime:ro
- /etc/mosquitto:/etc/mosquitto
- /etc/mosquitto:/opt/zigbee2mqtt
restart: unless-stopped
privileged: true
network_mode: host/etc/mosquitto and /opt/zigbee2mqtt, respectively. However, these paths may vary depending on your specific setup.Backup Buttons
In addition to using services to work with backups, you can simplify the process by using the button.create_backup and button.restore_from_backup buttons from the Robonomics integration. These buttons invoke the respective services with default parameters (the backup button creates a backup without history).
To add buttons to your dashboard, follow these steps:
- Click on the three dots in the top right corner of the dashboard.
- Select
Edit Dashboard. - Click on the
Add Cardbutton in the bottom right corner. - Choose the
Entitiescard. - In the
Entitiesfield, search for the button.create_backup and button.restore_from_backup entities. - Press
Saveto add the entities to the card. - Finish editing by clicking the
Donebutton in the top right corner.
Couldn't complete
It was hard
It was ok
It was easy
Make a contribution
Robonomics wiki is open source. See something that's wrong or unclear? Submit a pull request.
