hass.io: how to access and edit files

To be able to efficiently develop home automation functions (mostly yaml code) on your hass.io platform you need easy access to files and folders on you Raspberry Pi. I recommend three different ways that complement each other; Samba Share, SSH and hass.io Add-on Configurator.

All three are installed through the hass.io web interface by selecting Hass.io in the left menu and then Add-on Store on the tab at the top.

SSH (Secure Shell)
For SSH search for SSH Server and click install. Then apply your SSH Config as below and hit save. Be sure to start the Add-on by clicking start before you leave the page.

Figure1. Add SSH server to your hass.io instane.
SSH server config
{
  "authorized_keys": [],
  "password": "mySSHpassword"
}
I am aware that it is much more secure to create keys and use those to SSH into your Raspberry but as a first time user I would recommend to be satisfied with a password at this stage to be able to focus on home automation and return to security enhancements later.

SSH allows you to access your hass.io through a terminal window to do file changes directly on the Raspberry. A simple (and free) to use software for this purpose is Putty.

Figure 2. Use Putty to SSH to your hass.io instance.

Once a connection is made with Putty you need to supply username root and password mySSHpassword to log in. As a newbie it was not obvious that the username was root and it took me some googling to find out, especially as I at the time was fiddling around with Hassbian that had multiple users.

Samba Share
For Samba search for Samba Share and click install. Then apply your Samba config as below and hit save. Be sure to start the Add-on by clicking start before you leave the page.

Figure 3. Add Samba share to your hass.io instance.

Samba config
{
  "workgroup": "WORKGROUP",
  "username": "mySAMBAusername",
  "password": "mySAMBApassword",
  "interface": "",
  "allow_hosts": [
    "10.0.0.0/8",
    "172.16.0.0/12",
    "192.168.1.0/16"
  ],
  "veto_files": [
    "._*",
    ".DS_Store",
    "Thumbs.db",
    "icon?",
    ".Trashes"
  ]
}
Samba share allows you to access files directly on your Raspberry from (for example) a Windows file browser. This is an extremely convenient way of editing files on the Raspberry to develop the home automation you want. Enter \\192.168.1.65 in the Windows file browser and provide the username mySAMBAusername and password mySAMBApassword to get access. This is how I do most of my development and as text editor I use Microsoft visual studio code.

Configurator
If you want to add code directly in your browser while logged in to hass.io you can do that through an Add-on called Configurator. I find this convenient if I want to do changes from a mobile device or if I am on a computer that is outside of my network and I do not have direct access to files on the Raspberry.

Search for Configurator and click install. Be sure to start the Add-on by clicking start before you leave the page.

Figure 4. Add Configurator to your hass.io instance.

Figure 5. Configurator view showing ui-lovelace.yaml.

You should now be all set for doing the needed changes to hass.io.

Please let me know in the comments field if you have any questions or comments.

Comments

Post a Comment