Home-Assistant Hassbian Configuration
The Home-Assistant project offers it's own linux distribution to host the home automation system in a Raspberry Pi portable computer. This tutorial aims to help anyone whom might join the adventure of using and configuring this system. Another good source is this video.
- Raspberry Pi
- Computer
- Internet access
No extra keyboard or monitor is needed to use or configure the Hassbian. Setting up Hassbian requires internet connection.
First step is writing the SDCard with Hassbian image, next is choosing cable over wi-fi connection. Instructions in the official website cover only cable and this tutorial tries to cover both, pick a flavor: user friendly or command line.
- Download the Hassbian image (364 MB)
- Use Etcher to flash the image to your SD card
- Ensure your Raspberry Pi has wired access to the internet.
- Insert SD card to Raspberry Pi and turn it on. Initial installation of Home Assistant will take about 5-10 minutes.
- Proceed to Network Configuration.
In this tutorial I will dd
, a command-line tool that requires some knowledge for it can seriously damage the computer's operating system.
Proceed only when safe, if not proceed via the official website instructions. Commands may vary from system to system.
- Download Hassbian image
- Go to downloads folder and unzip it. Note it may be a newer version number.
$ cd ~/Downloads
$ unzip Hassbian_1.23.zip
- Insert the SSDCard if it's not in it's socket.
- List mounted devices and unmount the SDDCard. In my case the SDDCard is
disk2
and partitions aredisk2s1
anddisk2s2
.
$ diskutil list
$ diskutil umount /dev/disk2s1
- Write the disk using
dd
. Afterdd
starts nothing is written to tell the user it's going on, but it is, just wait a few minutes until it's finished. :)
$ sudo dd bs=1m if=2017-05-09-Hassbian.img of=/dev/disk2
1324+1 records in
1324+1 records out
1389256704 bytes transferred in 311.064509 secs (4466137 bytes/sec)
- To connect the raspberry using the ethernet cable just run
diskutil umount /dev/disk2s1
to unmount the device and safely unplug from the computer then insert in the Raspberry Pi and proceed to cable topic. Otherwise just follow steps in the Wi-Fi session before unmounting.
There is two ways to get hassbian up and running with Home-Assistant installed and available. By plugging it to an ethernet cable or by configuring the wi-fi connection before installing. This wi-fi setup should work for both Raspberry v3, with wi-fi builtin, and older versions with a wi-fi dongle connected to it.
The vanilla way described in Home-Assistant website is to connect it directly in a router port with an ethernet cable, power it up and proceed to the system configuration session.
To enable wi-fi to work in the same way that plugging the ethernet cable does a file must be created in the SDCard boot partition. Since Win, Linux and Mac all them mount this partition automatically, the task is easy as create the file and write the right contents in it.
This tutorial uses
nano
to edit the file, but any text editor can be used. In MacOS the commandopen
will open a dialog for the user to choose a program to open the file.
- Go to the
boot
mounted partition, or drive letter in Win, and create thewpa_supplicant.conf
file.
$ touch wpa_supplicant.conf
- Open the configuration file with the text editor of choice.
$ nano wpa_supplicant.conf
- Write it with wi-fi ssid and password between the double-quotes
"
.
SSID is the name of the network. ie.: "Home Wi-Fi"
PSK or password key is the network's password. ie.: "shhh it's a secret!"
network={
ssid="Wi-Fi network name example"
psk="password string example"
}
In case the wi-fi network has no password just use this configuration instead.
network={
ssid="Open network example"
key_mgmt=NONE
}
- Save the file. If using
nano
pressctrl+o
,enter
to confirm, thenctrl+x
to exit the editor.
In mac keyboards press
command+o
andcommand+x
instead.
- Eject or unmount before unplugging the SSDCard from the computer and insert it in the Raspberry Pi slot.
- Proceed to System Configuration.
By now the Rasberry Pi shall be powered and accessing the internet. After it is powered just wait a few minutes before checking out if hassbian home is already up. Hassbian uses this minutes to configure the device, download the latest version of Home-Assistant and install it. Access it be sure
Access and login are required to change the Home-Assistant configurations files. The default credentials for the hassbian are pi
and password raspberry
. After running ssh pi@hassbian
type yes
to add hassbian as a trusted device and then insert the password.
This tutorial uses
ssh
. Windows users might use PuTTY or MinGW.
$ ssh pi@hassbian
The authenticity of host 'hassbian (192.168.1.120)' can't be established.
ECDSA key fingerprint is SHA256:8L+WLEcJdiG2cD/C81doennZ+4Ggf/XZNP7aQjT96YE.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hassbian' (ECDSA) to the list of known hosts.
pi@hassbian's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jul 10 07:55:54 2017 from c3po
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
pi@hassbian:~ $
If hassbian hostname is not available try enabling network discovery in the os or running a scanner like
nmap
.
$ nmap -p 8123 192.168.1.2-255
Nmap scan report for hassbian (192.168.1.120)
Host is up (0.021s latency).
PORT STATE SERVICE
8123/tcp filtered polipo
By default the pi
user is not enabled to execute sudo
or super user commands before updating password. To update run sudo passwd pi
and type in the new password twice.
pi@hassbian:~ $ sudo passwd pi
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
The raspi-config
tool is a very easy to use gui to enable all kinds of linux system configurations. The most important steps are configuring the timezone and wi-fi channels regulations in the Localization Options menu. Countries have different regulations that might apply heavy fees for noncompliance.
pi@hassbian:~ $ sudo raspi-config
Configuring home-assistant to know your available extensions and devices.