Hassbian is a raspbian based Debian system with Home assistant installer pre-installed and set to auto start from factory.
Installation
If you'd like to install home assistant (HA for short) all from scratch, this tutorial is not for you.
First thing first, follow THIS ARTICLE to burn the image to your SD card. Remember to write your wifi SSID and password if you want to access your HA wirelessly.
Now, insert the SD card to your raspberry pi and power on. Get the IP of your Raspberry Pi from your router and SSH into it with the username of pi
and password of raspberry
as stated in the article above. Please change your password of pi immediately.
Right after the system booted, the HA installation is already in progress and you can check its status by checking the log file /tmp/hassbian.log. If the installer fails, you can restart the install process by re-run the installer service:
sudo systemctl enable install_homeassistant.service
sudo systemctl start install_homeassistant.service
Once the log says the installation is successful, you'll able to see several processes named hass
and a python3 process together with it. This means your installation is in the second stage.
The HA installer is an install-on-demand system. The first stage only installed the HA core component (which I will talk about later), all other dependencies need to be installed separately during the first startup.
Wait for another 10minutes or more if your network condition is not good enough. When you see no more python3 processes, it has completely installed all the CURRENTLY required component.
Your HA webGUI is ready to be accessed by browsers from http://YOUR.IP:8123/ (not hassio.local:8123 which is only supported by hass.io). Say hello to your HA.
Configuration of HA
Now you have your HA installed (partly), you can modify its configure files by ssh shell if you are really good at it. If you don't, you'd better edit it with something else you're good at via SAMBA.
The first stage of installation actually installed a utility called hassbian-config
. It is responsible for all the follow-up tasks. Type hassbian-config show
to see all its capabilities.
You can install HA accessaries with hassbian-config install NAME
. For example:
hassbian-config install samba
will install the samba sharing service of home assistant for you. By installing it you can access your configure folder by \\YOUR.IP\homeassistant\
hassbian-config install hue
will install the Philips hue emulator component for you which is necessary if you want to use emulated_hue:
command
You can also upgrade your HA installation or even the hassbian system with hassbian-config upgrade
.
Node.js
Node.js is an important component that hassbian may require since a lot of third-party applications are written in node.js.
Install it with the follow command or follow the instructions in This article
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs
Migrate records from SQLite to Mysql(MariaDB)
Homeassistant generates a huge amount of data every day and the purge function really doesn't help much (in fact, it never works). To keep homeassistant from slowing down during long time usage, we'd better use traditional memory database such as MySQL instead.
Here is a full migration log written by sean, you are welcome to borrow any experience he shared.
To install MySQL server (MariaDB server) to your system, type apt-get install mysql-server
.
After installing process, type mysql to enter MySQL command line.
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
create database homeassistant;
GRANT ALL PRIVILEGES ON homeassistant.* TO 'username'@'localhost' WITH GRANT OPTION;
This will create a database named "homeassistant" and grant full access to your new username with new password.
Now, let's deal with MySQL python support.
Type apt-get install libmariadbclient-dev
if you're using mariaDB or apt-get install libmysqlclient-dev
otherwise to install MySQL client OS support.
Cd to homeassistant's bin directory (normally /srv/homeassistant/bin) and run
pip install mysqlclient
to install MySQL python module. (Stackoverflow reference)
Now, head over to homeassistant configuration and add
mysql://username:password@localhost/homeassistant?charset=utf8
under recorder: section and restart your homeassistant.
Also, you need to make sure your MySQL server starts before homeassistant, check official recorder components doc for more instructions.
You're ready to meet your smart home now.
0 comment