NOTICE: DUE TO CHRONIC STABILITY PROBLEMS, I DO NOT RECOMMEND USING STANDARD ARMBIAN ON OPZero. DIET PI RESOLVES STABILITY ISSUES. NEW BLOG POST WILL BE FORTHCOMING.
Guide here: https://home-assistant.io/blog/2017/05/13/home-assistant-on-orange-pi-zero/
Important: Have your router set the IP for the Orange Pi before you configure it. Manual configuration has broken the entire thing several times.
- Download Armbian for pi zero
- Download Etcher
- Extract Armbian and use etcher to burn image to microSD card (I used 2GB which may be too small)
- Insert mSD and plug into network.
- Check router for IP after giving time to boot.
Save a profile to putty:
- include: keepalive 10 as per this post and enlarge the font if you are old like me and don’t like craning your neck to watch terminal output.
- Putty to SSH into PiZero with root:1234
Change root password and create a user so you don’t have to use root.
sudo apt-get update
sudo apt-get upgrade
(directory locked and had to reboot first). This step takes a while to download and install packages.
next install python and its packages:
sudo apt-get install python3-dev python3-pip python3-venv
Now execute the following:
ha@orangepizero:~$ pyvenv-3.5 homeassistant
ha@orangepizero:~$ cd homeassistant && source bin/activate
(homeassistant) ha@orangepizero:~/homeassistant$ pip3 install --upgrade pip
(homeassistant) ha@orangepizero:~/homeassistant$ pip3 install homeassistant
(homeassistant) ha@orangepizero:~/homeassistant$ hass
USE pyenv-3.4 if in dietpi
aiohttp takes quite a while to install so go get coffee or something. First loading hass also takes a while and appears to hang at several points. That’s okay. Just give it some time.
Make sure to upgrade pip3 from the venv once it’s initiated. Not doing that will cause a raft of errors.
There can be problems with venv so if needed, just destroy it with
sudo rm -rf homeassistant
Whoop! Dare it is!
I then restored by configs from the .homeassistant directory.
This threw errors for pylutron-caseta (because it wasn’t installed yet) and mqtt because mosquitto wasn’t installed yet.
Tackling mosquitto as a broker:
sudo apt-get install mosquitto
apt-get install mosquitto-clients
Gotta have both to monitor the messages using:
mosquitto_sub -h 127.0.0.1 -t “home-assistant/”
There is also a known issue with installation of pylutron-caseta (click for forum link).
To solve this one:
sudo apt-get install build-essential libssl-dev libffi-dev python-dev
Until you do that, you won’t get anywhere installing pylutron-caseta.
Also, be aware that pynacl take an extremely long time to install due to it only using one of the 4 cores for compilation. There is a bug and fix enroute for this at the time of writing.
sudo -H pip3 install pylutron-caseta
This eventually installs in the venv after a reboot. I also installed paho-mqtt through pip but am unsure if it is needed at all.
There are some super useful aliases which you’ll want to edit the .bashrc to add:
alias config='nano ~/.homeassistant/configuration.yaml'
alias checkconfig='hass --script check_config'
alias venv='cd ~/homeassistant && source bin/activate'
alias hasslog='nano ~/.homeassistant/home-assistant.log'
alias customize='nano ~/.homeassistant/customize.yaml'
alias restart='sudo systemctl restart home-assistant@ha'
alias status='sudo systemctl status home-assistant@ha'
alias stop='sudo systemctl stop home-assistant@ha'
alias start='sudo systemctl start home-assistant@ha'
alias secrets='nano ~/.homeassistant/secrets.yaml'
Don’t forget to enable HASS autostart.
## The line below needs modification based on file location
ExecStart=/srv/homeassistant/bin/hass -c “/home/homeassistant/.homeassistant”
Install Armbian Monitor to use web interface for stats
sudo armbianmonitor –r
To Do list:
- Shell script automate backups of config files to github. cron job.
- Backup to image using easus and win32 Disk Imager
- Test restored backups to secondary card
- Try restoring to disparate size card
- Automate shell script complete disk image backups.
- change units of some sensors so they don’t all get graphed together
- Particularly the DarkSky API sensor.
- Automatically enter the venv from login/boot