Wednesday, 7 March 2018

How to install Home Assistant on Synology DS216j


This week, I have spent quite some time to setup Home Assistant on my Synology DS216j. 

I have several smart home devices, however, they don't talk to each other... Nest thermostat, Almond+ router, GE smart LED, Google home mini, iPhone, envisalinks 3 (the security system), logitech harmony control, nexus player, Nvidia Shield TV, TP-Link smart plugs... Always try to find a way to control them in a central place. 

Among all the devices, envisalinks 3 is hard to work with the rest of the system. It is said Samsung smartthings can work with envisalinks. However, I don't want to spend $120+tax for another smart hub.

Home Assistant, which is developed in Python, open source, seems to be a good candidate to aggregate all my devices. And here is my guide:


How to install on Synology NAS

need to pip3 install home-assistant-frontend, pyenvisalink, pyfttt, python-nest
install modules in

 

Install Netdisco and other packages with dependency issue on Synology NAS

Install Debian Chroot from SynoCommunity

SSH into Synology DiskStation. Use this command to go into chroot: /var/packages/debian-chroot/scripts/start-stop-status chroot

cd /usr/bin/

I prefer nano which was thankfully available but vi should do the job (vim was not available).
nano /etc/apt/sources.list
Change all “jessie” sources to “stretch”. Thats it, no messing around with preferences.

Installing python and pip:
  1. apt-get update
  2. apt-get install libpython3.5-dev
  3. apt-get install python3.5
  4. apt-get install python3-pip (note: no 3.5)

Install netdisco: python3.5 -m pip install netdisco
install warrant: python3.5 -m pip install warrant
install warrant: python3.5 -m pip install HAP-pythonexit

Get back to the DS SSH with: exit

Copy all packages:
cd /volume2/@appstore/py3k/usr/local/lib/python3.5/site-packages/
cp /usr/local/debian-chroot/var/chroottarget//usr/local/lib/python3.5/dist-packages/* . -R

Restart home assistant /volume1/homeassistant/hass-daemon restart (assuming that’s where you put it).


Setup IFTTT Envisalinks

setup on nas https reverse proxy on synology using web UI, so that all communications are in SSL. So port 8443 will be used as my SSL port. I used 8443 as 443 port has been used on my synology. Any valid port number should be fine.
https 8443 -> http local host 8123

To arm the security system, in IFTTT, setup gadget using webhooks to post to Home assistant server. So I can use voice command from Google home to control my security system:
Arm stay
https://xiezhensheng.synology.me:8443/api/services/alarm_control_panel/alarm_arm_home?api_password=xxxxxxxx
Arm away
http://192.168.0.8:8123/api/services/alarm_control_panel/alarm_arm_home?api_password=xxxxxxxx post
entity_id:alarm_control_panel.home_alarm

I haven't setup disarm yet. When I am going to use it?

Setup Auto Start

Q&A

How to find services of Home Assistant?
use ARC chrome extension, GET /api/services

How to find entity_id to fill the webhook post section?
in developer tool <> section

No comments:

Post a Comment