Deleted complete /home/hass/.homeassistant by mistake

Ok…wanted to sync my homeassistant directory via WinSCP with a windows share but by mistake synced the wrong way around replacing all my files in the .homeassistant dir (and sub-dirs) on the PI with an empty one! Smart move.

I made a full backup of all in this dir + sub dirs last sunday + I had some key yaml files still open in Notepad++.

So what I did:

  • Stopped HASS
    
  • Copied all files back from my backup into .homeassistant on the PI
    
  • Copied the 5 newer yaml files to the same dir (replacing the one from the backup)
    
  • upgraded HASS
    
  • rebooted
    

However , no go… (also not if I only just copy the backup to the .homeassistant directory without changing any other files.

Nothing in the logs either (log files last update from the date of the backup).

Any tips?

Have you checked the permissions on the yaml files?

1 Like

Permissions? They probably weren’t preserved when you made the backup and if they are just copied over with basic file perms, most of the executables won’t be set for the executable permissions.

May be easier at this point to just reinstall and copy over the YAML files you need. Would suggest doing it with .29.6 at this time as there are some issues in the latest release and that would complicate things.

Sorry. We all learn expensive lessons but you’ll be more diligent because of it.

1 Like

@Vertikar LOL, within minutes of each other!

1 Like

Ok, thanks.

I find that if I delete simply everything under .homeassistant and then reboot I at least have a working (empty) hass. But indeed when I start copying YAMLS over it’s not coming back. Unfortunately somewhere in tis process I think I upgraded to the latest version and guess I need to downgrade hass first to 28.6.

Just to make sure: What permission do the YAML files need to have? And with which user, User root or does it need to be HASS (I am on the AIO installer).

Other Q: What happens to the zwave stuff? I just added a few devices today (before I deleted all). Will hass (as soon as I have the old working configuration yaml back in) pull the zwave info file ‘fresh’ from OpenZwave?

Mine are all 777 owner and group are both root. I used the AIO installer as well.

Apparently the AIO installer symlinks the OZWCP configs; I’m not sure how that’s going to affect you if you deleted and then restored it. I’m still weak in my ZWave kung fu, but I’m sure someone here could help you get it back online. If you lost the zwave xml config file in the process of all of this, then you might have to open OZWCP and save the configuration again.

I’m going to grab some dinner but I will try to check in a bit to see how you’re doing, ok?

For what it’s worth, the files in my /home/hass/.homeassistant folder have 644 permissions, and hass is both the owner and the group. I am also running HASS installed with the AiO installer.

If I’m not mistaking, HASS copies the Z-Wave settings files over from the original location, being /srv/hass/src/open-zwave-control-panel/. So as long as they are still in that folder, they should be copied over to your .homeassistant folder once you’ve started HASS. In fact, I’ve created symbolic links in my .homeassistant folder to the original files to make sure they are always up-to-date.

He should be able to pull them off of his Sunday backup then.

Thanks guys! All is back up again.

Not sure what is the best procedure but to get it working I did:

  • Make sure all in .homeassistant is empty (everything incl. subdirs)
  • Downgrade hass to the version I had the backup off (in my case 28.8)
  • Reboot the PI (check if you now have a working -but empty- Hass)
  • Copy only (!) the YAML files back to .homeassistant
  • Check permissions (owner HASS and 644) of YAML files (and potential files in subdirs, in my case some scripts)
  • Reboot the PI
  • Close HASS
  • Start OZWCP, give t some time and save
  • close OZWCP and reboot
  • You should be back in business

I still had some issues so copied back the YAML files back one for one (customize, input_boolean etc,) and did some restarts in between to see where I got stuck. For some unknow reason groupview.yaml was causing issues (HASS would not start and not even show anything in the log). I had to copy the contents of the backup groupview.yaml to a new empty one. No ideas what was going on there.

2 Likes

Great news @Tyfoon! Glad to hear you’re back in business.

May help you going forward, I have the following:

SMB installed on the same machine as HASS
other windows machine has a mapped drive to the .homeassistant directory
task schedule for, hourly, and daily and monthly robocopies of all the yaml and conf files over to a dropbox folder on the windows machine

has saved my bacon a few times!

1 Like

That’s a great idea, @elPaulio! You ought to do a write up about it in the share your projects section.

Wouldnt really class it as a ‘project’… but sure. I can do that. The scripts are simple… but i’ll add some comments to them first :slight_smile:

1 Like