That’s a shame, instead of using https://hassio.local:1627 I would prefer to use https://192.168.0.50:1627 as the hassio.local address doesn’t always work on my router.
You should be able to do exactly that. I meant that you can’t change the path (the part after “:1627/”). Any thing that resolves to the correct IP address including the IP of the machine running Home Assistant should work (though you’ll run into certificate/hostname problems if you’re using SSL). Is that not working?
No my router can be a bit flakey and the url doesn’t work - I manually change the page to the IP address and then I am in but from clicking on the Web UI link I cannot get the page to show without adding the IP address.
Its a very minor issue that I can work around easily enough.
Hi @sabeechen,
Thank you for this addon, this is one of the addons I’m fond of since its made my life so easy since i constantly make loads of changes and this helps me a ton to backup quick and check for success.
I wanted to check if there are states for the snapshot_backup sensor, so that i can track the status and send updates to my phone, right now it doesn’t change its state, i think its set to change only on “failure” is it possible to have a state for “uploading” or “waiting” and one for successful on the same sensor?.
im looking to make the below work, the nodered is for a ticker in my office.
- alias: Snapshots uploaded
id: 'snapshots_uploaded'
trigger:
- platform: state
entity_id: sensor.snapshot_backup
from: 'waiting' #or uploading status
to: 'backed_up' # or successful_backup
condition: []
action:
- service: notify.iphones
data_template:
title: Snapshots Upload Success
message: Backup Successful today {{ now().strftime('%Y-%m-%d %H:%M') }}
That sensor has 3 states, but I don’t think they’ll help for what you want
- waiting: Waiting for you to connect the add-on with Google Drive
- backed_up: Everything is up-to-date
- error: there was a problem backing up.
You’ll probably want to look at the attributes for the sensor, which has a lot more detail. It includes:
-
last_snapshot
timestamp of the last snapshot (including a pending snapshot) -
snapshots
a list of all the snapshots present, each entry has-
name
- The name you gave it -
date
- The date you created it -
status
- The status you see for the snapshot it in the web-ui
-
To configure what you’re trying to accomplish, I think you could do the following.
- When
last_snapshot
changes, it means a snapshot has started. - When a snapshot with
status=='Backup Up'
has the same date aslast_snapshot
, it means a snapshot was created and backed up. - When the sensor state==
error
it means the backup failed.
You’d need to either write the logic in node-red (where you write arbitrary code) or create some tricky template sensors to do everything in HA. Honestly though, I’d recommend just alerting on the binary_sensor.snapshots_stale sensor. With a setup like this you’re likely to get a lot of noise from transient network errors.
Hey, good one… let me give it a shot. I was more interested in the state on the web UI where the state is evident as it processes backup, but for now just the last snapshot logic seems to fit my purpose.
Or i could just run a message at a particular time when i’m starting backup and check it with the sensor for “error” status before publishing.
Thanks again for your time
Another option, if you really want detail, is to poll http://hassio.local:1627/status. It returns a json object with, basically, the full state of the UI. The web UI functions almost entirely by polling this endpoint every 5 seconds. Be warned though, I don’t expect anything significant about the structure of it to change, but I’ll likely make modifications to what it returns the UI evolves in the future since its not really part of the “official” API of the addon.
That would be easy on me for now, i tried the link and it returns 404 after login.
## 404 Not Found
The path '/status' was not found.
Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 628, in respond self._do_respond(path_info) File "/usr/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 687, in _do_respond response.body = self.handler() File "/usr/lib/python3.6/site-packages/cherrypy/lib/encoding.py", line 219, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/usr/lib/python3.6/site-packages/cherrypy/_cperror.py", line 414, in __call__ raise self cherrypy._cperror.NotFound: (404, "The path '/status' was not found.")
Powered by [CherryPy 18.1.1](http://www.cherrypy.org/)
I’ve released version 0.96. This release includes a lot of options to help resolve DNS resolution issues. Please see the instructions I’ve posted in this issue you’re having that problem.
Refresh the add-on store page to make sure it sees the update!
- Adds Support for reading the snapshot password from your secrets file. Try setting the snapshot password to “!secret sercet_file_entry”
- Adds Better help messaging when it gets errors deleting old snapshots.
- Adds A bunch of debugging options for some users having DNS resolution problems.
- Fixes Some out of date info in the installation readme.
- Fixes An issue causing the add-on to use cached (old) version numbers for manual snapshots.
- Fixes Bugs while parsing DNS record entries
With this add-on working so great, I got to thinking…
What’s the best way to do a full restore if, say, the SD card in my RPi totally dies?
When I first set up HA, I jumped through quite a few hoops, getting the WiFi running, installing SAMBA and SSH, and generally building a base I could work from, before I even got to using HA.
I’m thinking I’d re-install Hass.io on a new SD card in the RPi, remove the SD card, copy the “backup” folder from Google Drive to that card using another computer, then re-boot the RPi off that card and restore the backup using either the Hass.io page in HA or this add-on.
At that point would I be all be back to normal? Even my WiFi network configuration, add-ons, etc.?
You just burn a new SD with the latest image and let HassIO install, then copy the Snapshot across to it (the SD card won’t be readable in a PC once HassIO is on there) so use SSH / Samba / whatever to copy it across via network. Then just do a ‘restore from image’ in the Snapshots menu
thanks, works without issue!
Thanks! I’m still new at this so let me break that down. Burn a new SD card with Hass.io and let it install. Configure it to work on my WiFi network (I remember there were a bunch of steps there!) Install/Configure Samba and/or SSH. Copy the files to the “backup” directory. Then just do the ‘restore from image.’
What about any other add-ons? Do I need to re-install or will the restore pick them up, too?
Do I have to pair devices again (in my case, mostly Zigbee) which were previously paired?
I guess I’m just not clear on what is, and what is not, included in the snapshot.
once you restore, it will all be back to normal including add-ons and devices etc.
Restoring a snapshot will restore all your add-ons(unless you’re making partial snapshots), their configuration, and anything in your /config directory (eg configuration.yaml). I’m not sure where the zigbee config is stored, but I’d be surprised if they aren’t included too.
Most people (I think), restore by doing:
- Burn HA to a new SD card with etcher (or whatever)
- Configure the network on the SD card (which is suprisingly complicated).
- Insert the SD card, boot it, wait for the install, then log into the new instance.
- Install the samba add-on
- Copy the snapshot to the /backup directory through samba
- Refresh the Hass.io snapshots page.
- Restore the snapshot that should now show up
In stead of using the samba add-on, I’ve also added a workflow to the Hassio Google Drive Backup add-on that lets you upload a snapshto directly from Google Drive (eg instead fo installing samba). I always run into trouble trying to get samba to work.
This add-on is great. I got wind of it as Dr Zzs posted a video on youtube about it.
https://www.youtube.com/watch?v=WcErD5PvIYw
As he pointed out, It would be nice if you had a “Buy me a coffee” link.
Just a though
@sabeechen thank you for helping me out that day i was able to get it sorted to the way i want it. Tested it for three days now and confirmed success.
I’m gonna leave this just in case someones interested.
For anyone looking to get the state of the addon processing the backup, here are the steps.
I have made this to help me see the status of upload and success on an a LED ticker.
*THIS REQUIRES NODERED
This has three states as seen on the Web-UI, which can be collected from the JSON from http://hassio.local:1627/status
- Pending - Creating Backup File
- Uploading - Upload progress with percentage
- Backed Up - Backup Successful
First we need to parse JSON using rest sensor for snapshot status data.
Sensors.yaml
#Google Drive Backup status
- platform: rest
name: Google Backup State
username: !secret ha_user
password: !secret ha_pass
resource: http://hassio.local:1627/getstatus
value_template: '{{ value_json.snapshots[2].status }}'
For PHONE Notifications.
Automation.yaml
- alias: Snapshots uploaded id: 'snapshots_uploaded' trigger: - platform: state entity_id: sensor.google_backup_state to: 'unknown' condition: - condition: state entity_id: sensor.snapshot_backup state: 'backed_up' action: - service: notify.iphones data_template: title: Snapshots Upload Success message: Backup Successful today {{ now().strftime('%Y-%m-%d %H:%M') }}
#note that the success message will display unknown from sensor.google_backup_state but not to worry, as the condition is checked with the state of sensor.snapshot_backup to confirm upload.
For LED TICKER
Download Flow
#The result.
additionally these messages also are returned on the LED.
Happy Tinkering.