irwan.io

Tutorials for noobs… from a noob.

HTML5 Notifications

In pursuit of SET UP LET’S ENCRYPT FOR HOME-ASSISTANT WITH YOUR (SUB)DOMAIN, we now can have HTML5 push notifications with Home Assistant.

Ready, set… go!

Google cloud platform

Create new project at Google Cloud Platform.

https://console.cloud.google.com/home/dashboard

Create a Project name like Home-Assistant

After that, go to Domain verification.

https://console.cloud.google.com/apis/credentials/domainverification

Now add your domain like example.com instead of sub.example.com. The reason for this is, if you are verified for a domain, you are automatically verified for all subdomains of that domain, as well as all sites and subsites.

 

After you add your domain, you have to verify that you are the owner of this domain. Take Me There!

 

Select your domain name provider and choose Add a TXT record first! In this example i chose TransIP.nl.

Then follow the steps to add a TXT record at your domain name provider.

 

When that is done go back to the verification tool and verify. It might take a while before the DNS settings are applied.

Login with your domain name provider credentials.

If all goes well…

Firebase

When verification finally is done…

Go ahead to https://console.firebase.google.com

Add new project.

 

Import your project Home-Assistant in the drop down menu and choose country/ region.

After it’s imported, click on the gear wheel icon in the upper left to go to the project settings and then open the second tab “Cloud Messaging”.

Here you will find your Server key and Sender ID which you need to use in your configuration.yaml.

Home Assistant

With above being said, add the notify component to your configuration.yaml:

Then restart Home-Assistant service.

According to the Home Assistant documentation https://home-assistant.io/components/notify.html5/ we need to install pwebpush and prior to that libffi-devlibpython-dev, and libssl-dev too…

But….. I didn’t have to do that! Maybe it’s because i am on v0.60, maybe it was updated during the certbot installation for Let’s Encrpt because i did saw those libs passing by in the terminal. Maybe i was just lucky…?

Once Home Assistant restarted, grab your mobile phone or device you would like to receive push notifications and go to your Home Assistant.

Enable Push Notifications in Configuration/ General.

You will be prompt to allow notifications on Chrome. Allow it!

Congrats! You now can have Push Notifications!

Before we continue playing with notifications…Head to your Home Assistant config folder and and find a newly created file html5_push_registrations.conf. In this file edit the unnamed device field to the device name that suits you. This way it’s easier to select which device a notification gets send to.

So now you can setup some automation’s with notifications!

have fun!
irwan.io

Next Post

Previous Post

Leave a Reply

© 2019 irwan.io

Theme by Anders Norén