Warning: this content is not reviewed, so there might be some mistakes.

This past week or so I started to tinker with the open source home automation software, Home Assistant. I don’t have a big set-up, but I do have a Nest thermostat, a couple Amazon Echo Dots, and six Philips Hue bulbs. My introduction into home automation was with the first Philips Hue starter kit I purchased years ago. I have been iching to expand every since.

I recently picked up a Raspberry Pi 3 from Micro Center, so decided it was a good time to give one of the “DIY hubs” a try. My only computer is a laptop, so it’s hard to run something like this without an always on machine. Home Assistant looked the most promising to me due to the amount of integrations it supported and what looks like a healthy community.

Maybe I’ll do a post on how I set everything up, but basically the Raspberry Pi 3 is running the Hassbian image, so everything is default to that set-up and not the All in one set-up.

After it was up and running I soon learned that doing the configuration was a real pain in the hass. I did my inital configuration using terminal in osx and sshing into the Raspberry Pi. This really made doing something that should be pretty simple, especially for someone that is used to doing this kind of thing, a slow painful process. Maybe I’m spoiled by using code editors that help me out with completion and spacing!

This morning I set out to make this process better and allow me to use a code editor. In this case I am using Atom. After consulting with Google about my options I settled on using SSHFS and OSX Fuse. I am running macOS Sierra. Here is the source blog post that helped me get this set-up.

Okay ley’s get to it…

Step one: You need an SSH Key

If you don’t already have an SSH key (or are unsure), then head over to this guide on Github first: https://help.github.com/articles/checking-for-existing-ssh-keys/

Step two: Move your SSH Key from local to remote

So your SSH Key currently is on your local machine (my MacBook in my case), but we need to have a copy of the public key on the remote machine (Raspberry Pi in my case). An easy way to do this is to use rsync. shell $ rsync -avz ~/.ssh/id_rsa.pub pi@[IPADDRESS]:/home/homeassistant/.ssh You will want to use the username that you use to ssh into your remote machine currently. In this case I am using pi. Replace [IPADDRESS] with the ip address of the remote machine. And of course replace [USERNAME] with the username on the remote. I ended up putting this in both pi and homeassistant folders. That way I don’t have to type the password in when I ssh in.

The import thing to know is that this NEEDS to be in the home folder for the user that has access to homeassistant. In my case that is a user called homeassistant. This will help with permissions of files.

After the rsync is complete ssh into the remote machine and rename id_rsa.pub to authorized_keys and update the permissions. See source for more details on updating the permissions. shell $ ssh pi@[IPADDRESS] $ [sudo if needed] mv /home/homeassistant/.ssh/id_rsa.pub /home/homeassistant/.ssh/authorized_keys # # or if you are logged in as homeassistant user you can use this: $ mv ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys # # update the permissions $ chmod go-w ~/ $ chmod 700 ~/.ssh $ chmod 600 ~/.ssh/authorized_keys At this point you should be able to ssh into the remote to the users that you added your SSH public key to. Moving forward we will assume this is the homeassistant user. Below is just an example of how to test this. I don’t recommend logging and making changes with this user. I just use the pi user for ssh still. shell $ ssh homeassistant@[IPADDRESS] # look ma, no password!

Step three: Install OSXFuse and SSHFS

Both of these can be downloaded and installed from the OSXFuse web site https://osxfuse.github.io/

I installed OSXFuse from there, but I installed SSHFS using homebrew at an earlier time. It maybe an out of date version on homebrew, but it worked for me. But to be safe just download them both from the OSXFuse web site and install them on your Mac.

Step four: time to mount

You will need to create a dedicated folder on your local machine for the mount point. I just created a new Remotes folder inside of my home directory. And put another folder inside there called homeassistant for the actual mount point. ~/Remotes/homeassistant

Now we can manually mount the homeassistant configuration folder /home/homeassistant/.homeassistant is where mine is located. shell $ sshfs -o IdentityFile=/Users/[Local_Username]/.ssh/id_rsa homeassistant@[IPADDRESS]:/home/homeassistant/.homeassistant /Users/[Local_Username]/Remotes/homeassistant If everything worked you should be able to browse to the Remotes/homeassistant directoty on your Mac and see the Home Assistant configuration files from your remote (RaspberryPi) machine.

If you want you can save the above command and just run that when you want to mount it. But if you want it to be auto mounted on boot…

Step four: Mount on boot

Create a launchd agent definition file ~/Library/LaunchAgents/local.automount.sshfs.plist

```xml <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>

AbandonProcessGroup Label local.automount.sshfs ProgramArguments /usr/local/bin/sshfs -o IdentityFile=/Users/[Local_Username]/.ssh/id_rsa homeassistant@[IPADDRESS]:/home/homeassistant/.homeassistant /Users/[Local_Username]/Remotes/homeassistant RunAtLoad

```

Then load the job: launchctl load ~/Library/LaunchAgents/local.automount.sshfs.plist

Now everytime you bootup or login the mount should be done automatically. I just set this up this morning, but so far today it is working great for me and making editing the configuration files so much better.

Thanks to G. Kay Lee for posting how to do this back in 2015 on Medium. It really helped me get this set-up with no issues.