bwssytems / ha-bridge

Home automation bridge that emulates a Philips Hue light system and can control other systems such as a Vera, Harmony Hub, Nest, MiLight bulbs or any other system that has an http/https/tcp/udp interface. This is a compact impl to run on small format computers. This is impl started from this project https://github.com/armzilla/amazon-echo-ha-bridge.
Apache License 2.0
1.45k stars 198 forks source link

Backup & Restore #1033

Closed tuicemen closed 5 years ago

tuicemen commented 5 years ago

Currently the Backup and restore of HA-Bridge works great. However this saves the files to the device HA-Bridge is running on. If this device fails or if in a Pi and the SD card gets corrupt there is no way to retrieve a back up to restore. Or am I missing the obvious? It would be great if when trying to do a back up or restore HA-Bridge asked the location to save or restore from/to

Hollybrook commented 5 years ago

+1 on this issue. I tried to stop HA-Bridge and ftp the config file, but it is locked for access.

bwssytems commented 5 years ago

This makes it simple to manage backup files and load them back in. I suppose we could enhance it to be able to download the backup files from the list to your remote machine.

Also, you could open up sftp (would not recommend ftp anymore) and you can mount that on you other machine and copy them over. The service is not started by default but can be enabled in the raspi-config program or google it.

Hollybrook commented 5 years ago

Sorry, I should have been more precise. I was using sftp on my other machine but could not access the config file because it was "open for read" even after stopping the bridge on the Pi.

And to Tuicemen's point, a one button backup to other machine like HomeGenie provides would be an optimum solution.

tuicemen commented 5 years ago

This makes it simple to manage backup files and load them back in. I suppose we could enhance it to be able to download the backup files from the list to your remote machine.

Agreed the backups and restores currently are simple to create and restore also much faster then saving or restoring to/from another device. The big problem I had was is if the device HA-Bridge is running on crashes like my PC did recently and one of my Pi SD cards got corrupt. No fault of HA-Bridge was my own fault for not putting a back up else where.Having this option most likely have made things so much easier (that is if I used it)

craigski commented 5 years ago

I think the issue is the *.cfgbk backup files are owned by 'root'. The 'pi' user does not have read access when using ftp/scp from another machine:

pi@pi2:~/ha-bridge/data $ ls -lrt total 24 -rw------- 1 root root 1430 Dec 7 09:05 habridge.config-2018-12-07-09-23-09.cfgbk -rw-r--r-- 1 root root 3632 Dec 7 10:08 device.db-2018-12-07-14-52-05.bk -rw------- 1 root root 1430 Dec 7 12:18 habridge.config-2018-12-07-14-51-57.cfgbk -rw------- 1 root root 1780 Dec 14 21:52 habridge.config -rw-r--r-- 1 root root 5710 Dec 15 14:21 device.db

Changing permissions of .cfgbk to 644 same as the .db and *.bk files would allow ftp/scp.

tuicemen commented 5 years ago

@craigski you are correct changing the file permission will allow you to copy the cfgbk file. Still a lot of extra work, if this could be avoided that would be awesome.

bwssytems commented 5 years ago

I have download working, next is upload

tuicemen commented 5 years ago

Awesome!!