Hass.IO
Of all things, not something I expected I’d do. But, as it turns out – automation is definitely nice. I’ve got Wake-on-LAN working, and my lights etc – so I can turn on the lights in my office and boot up my workstation, with one button, on my phone. Everything is ready to use by the time I’ve made a coffee and walked from the kettle to the computer in the office.
Setup was surprisingly easy. I followed the official instructions, but I added some extra steps along with them (because I liked the look and function better).
Rather than everything being in configuration.yaml, I now have sensors in their own folder, with a yaml file per sensor (radarr, sonarr etc each have their own). Switches, themes, device trackers, zones… all separate files.
To be honest – it’s for my convenience. Being able to add a sensor and test around with it without risking damaging my existing config file is a godsend. YAML is space-sensitive, so one thing in the wrong place screws you.
curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s
That’s the command to install it on Ubuntu with docker already running. You need it for this method. After running it, open the web ui and create a user etc. Don’t bother going further than being able to log in – we’re going to change a lot.
mkdir /usr/share/hassio/homeassistant/custom_components
mkdir /usr/share/hassio/homeassistant/www
mkdir /usr/share/hassio/homeassistant/device_trackers
mkdir /usr/share/hassio/homeassistant/sensors
mkdir /usr/share/hassio/homeassistant/switches
mkdir /usr/share/hassio/homeassistant/themes
mkdir /usr/share/hassio/homeassistant/zones
The above commands will create the folders for HACS, and separate sensor configs. They help immensely. Next, we’re going to replace the default configuration file.
mv /usr/share/hassio/homeassistant/configuration.yaml /usr/share/hassio/homeassistant/configuration_default.yaml
That renames the default. It’s only there as a backup, for if this next bit royally f***s itself.
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Uncomment this if you are using SSL/TLS, running in Docker container, behind a reverse proxy and exposed to the web etc.
# http:
# base_url: *YOUR HASS WEB ADDRESS*
# use_x_forwarded_for: true
###########################################
# Simple Components
###########################################
map:
sun:
# Wake-on-LAN
# https://home-assistant.io/components/switch.wake_on_lan/
wake_on_lan:
###########################################
# Text to speech
###########################################
tts:
- platform: google_translate
service_name: google_say
###########################################
# Frontend
###########################################
frontend:
themes: !include_dir_merge_named themes
###########################################
# Includes
###########################################
# Single Files
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# All Files in Folder
device_tracker: !include_dir_merge_list device_trackers
group: !include_dir_merge_list groups
sensor: !include_dir_merge_list sensors
switch: !include_dir_merge_list switches
zone: !include_dir_merge_list zones
That needs to go into /usr/share/hassio/homeassistant/configuration.yaml
To achieve this, nano /usr/share/hassio/homeassistant/configuration.yaml
, followed by CTRL+O and CTRL+X (Overwrite and eXit).
Open your Web UI and go to Configuration
-> Server Controls
-> Restart
. HASS will restart and reload the new config. Now any valid config file you place in the relevant folder will be loaded when restarting HASS. I’ve got a few Wake-on-LAN switches in the switches folder, some sensors for sonarr and radarr in the sensors folder, and hacs in the custom_components folder.
More on that in posts to follow.