Wow, it’s working great. Only one issue happens to me. Whenever I restart Home Assistant, I receive always the last MQTT event from googlebackup/result. I have an automation with that event, and it always launches when I restart Home Assistant.
Here is the log, just restarted without invoking rest_command.googlebackup:
2019-02-19 11:24:13 DEBUG (MainThread) [homeassistant.components.mqtt] Subscribing to googlebackup/result
2019-02-19 11:24:13 DEBUG (MainThread) [homeassistant.components.mqtt] Received message on googlebackup/result: b'{"backupTimestamp": "2019-02-19T10:20:46.157264", "fromPattern": "/backup/*.tar", "backupDirID": "xxxxxxxxxxxxxxxxxxxx", "fileCount": 7, "alreadyCount": 7, "backedUpCount": 0, "deletedCount": 0, "deletedFromGoogle": 0}'
2019-02-19 11:24:13 WARNING (ThreadPoolExecutor-1_0) [pycec] Not initialized. Waiting for init.
Hah! The last event is there on startup because I intentionally set it to “retain = True”. I had “retain = False” at first, but I noticed the most recent backup would not appear unless it had happened since the last restart. I thought “oh, people won’t like that”, so I changed it to “retain = True”. So, I guess I’m not a good predictor of what people want.
Plus, I did a little more reading this morning (after seeing your reaction), and I’ve learned that “retain” is really more appropriate for something like a temperature sensor, or a door sensor that reports the current state of something. I’ll change retain to False in an update just as soon as I get some time.
Use 192.16X.XXX.XXX:[port]/gb or hassio.local:[port]/gb from your web browser to access the UI for setting up authorization with Google Drive.
Use 192.16X.XXX.XXX:[port]/gb/doBackup to perform a backup manually from your web browser.
Use localhost:[port]/gb/doBackup in your rest_command setup to facilitate backup automations.
The web UI will not be accessible from outside your network unless you’ve configured port forwarding for that specific port on your router.
Double check your IP address by trying this from a command line:
ping 192.16X.XXX.XXX
Try stopping and restarting the add-on.
Below is my configuration for the rest_command and automation. Notice the timeout value of ‘300’ given as a string in single quotes, not as an integer without any quotes.
I have my automation setup like this:
- id: '1541263656718'
alias: Run Google Backup
trigger:
- at: 02:00:00
platform: time
condition:
- condition: time
weekday:
- mon
- wed
- fri
action:
- service: rest_command.google_backup
The automation uses a REST command that I setup like this:
Oh! I just saw the segmentation fault. Sorry, I missed that earlier. You’re probably running 64 bit version of hassos. There seems to be an issue with the Python 3 and Alpine 3.9 on 64 bit architectures. The issue doesn’t present on 32 bit systems. I’ll have to create an alternative build for people running on 64 bit. I’m not sure how soon I’ll be able to do that, but I hope to do it soon.