Lassej.se är mina personliga sidor där det går att läsa om mina intressen.
Kika på bilder, kolla vädret i Kungsängen, Se övervakningsbilder och följa de projekt (ofta tekniska) som jag leker med.
New blog posts
Apr 16, 2018 by Lasse Jäderfeldt
Det visade sig att Intel-NUC hade problem med...
Mar 26, 2018 by Lasse Jäderfeldt
Satt i helgen och konfigurerade upp en Intel...
Mar 8, 2018 by Lasse Jäderfeldt
Så kom då årets snö....
Feb 6, 2018 by Lasse Jäderfeldt
Eller egentligen 1/3 av februari kanske......
Enable Google Home to Home Assistant (HASS)
Posted on Oct 23, 2017 by Lasse Jäderfeldt
Enabling Google-Home on Home Assistant (HASS)
In .56 of Home Assistant the support for Google-Home (GH) arrived. Finally. I’ve tried to build some google-actions myself without success.
GH or Google Actions has some pre-requisites that’s good to know:
- Google demand to speak https to your server
- Self-signed certificates do not seem to work
Enable https on HASS
Since my implementation of HASS has been on my LAN only before I had to make some changes. I already have a DNS provider and a website, so some traffic is already allowed to port 80 for example.
My first mission here was to switch over from http Home-Assistant to https. The common advice in the community is to use lets encrypt and duckdns in combination. Since I already had my own DNS provider I didn’t want to use duckdns. I started to look on lets encrypt. While browsing information about lets encrypt I found a PowerShell based script which seemed easy. Lets encrypt for windows. I looked at https://github.com/ebekker/ACMESharp . The nice part with this one was that I could start direct in PowerShell and download from there. Easy you say, maybe not. You must change some behavior in PowerShell to allow script to be downloaded and you also need to run PowerShell as administrator.
I followed the instructions at this page: https://github.com/ebekker/ACMESharp/wiki/Quick-Start
and it helped a lot. But first I tried on my W10 home edition and then I couldn’t write all files in the chosen directory. I tried a few times and I also found a workaround for the problem, that didn’t work on W10Home edition. My other PC is a W10Pro and from here it was no problem to go through the guide. Since I’m not running on HASS on my web server I found that the easiest way for me was to use the guide’s alternative 5, method 3.
In my DNS I created a new subdomain with the name “_acme-challenge” and used a TXT record with the information from the script. After that I could let the script verify that I owned that dns record and the keys could be created.
The keys are not named exactly as HASS names them. In configuration.yaml you should add the lines:
# Uncomment this to add a password (recommended!)
# Uncomment this if you are using SSL or running in Docker etc
The certs can be found in the directory where you saved them under its own subdirectory. The certs you need for this is the Public cert issued by LE (cert1.crt.pem) and your Private Key (cert1.key.pem)
Since HASS is still using port *:8123 we need to reroute traffic from https (port 443) to 8123 in the router.
Now this part is done. One pre-requisite finished
Enable GH on HASS
Update HASS to > .55.2 to enable google_assistant support. Look at the configuration page. Follow it as close as possible. Since we already got the SSL part to work you have one problem less now.
The tricky part for me was to create a client-id and an access token. Not tricky at all since it should just be a random series of letters and characters, but not special characters. I used my Raspberry PI to create the sequence instead of finding one out by myself. It’s looks like this: ZZrkT3Gpr05ApEizc1xkDYieYGYgciYxSMeQScgVX2SjZFW4lGmDIi2c (but 20 characters more)
Now it works… NOT!
Another few hours of struggling before I realized that even though I change the keys on both ends the only way to get google to update the key in that end is to press the button “TEST DRAFT” once again. It’s like putting the app to pre-production. Before that it still uses the old settings.
Enable Testapp on GH
The last step to get it working is to open your Google Assistant app on your phone. Choose settings under your GH device and choose home automation. Press the plus sign to add another home automation app. Now you can see a new app here [test] yourapp.name .
Enable that app. If you have done everything right it will start work immediately. If you have troubles with “cant update config file”, you probably does not have the SSL working. If it says “invalid device id”, you probably have different keys in google actions and Home assistant. Or you have forgot to press “TEST DRAFT” again after a change.