Guide: How to set up DuckDNS, SSL, and Chrome Push Notifications

Thank you for this! This post helped me get HTML5 notifications working. This would be great in the documents. One question I had with this is, will any future updates to the frontend of HA clear the meta tag?

If it will, I might try to figure out a way to have an automation on system start, check to see if it exists and if not, populate it. Not even sure where to start with that but it was just a thought. I might submit it as a feature request so the meta tag can be added as a new param for the component.

1 Like

Yes. The change would be overwritten on an upgrade. I made a feature request to have the ability to add meta info via YAML:

2 Likes

Not sure what I’m doing wrong. I get this error when trying to run the script.

debian@pine64:~/duckdns$ sudo ./duck.sh
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0Warning: Failed to create the file /root/duckdns/duck.log: No such file or
Warning: directory
curl: (23) Failed writing body (0 != 2)

1 Like

Thank you thank you thank you! I now have remote access enabled, with encryption!

One thing that held me up for a little bit, is that on item 14 of your first section, you included an apostrophe before cat.duck.log (or, neglected to close the formatting). Of course, this should be obvious to an experienced user, but may trip up a total neophyte such as myself.

Hi! When I install pywebpush according to your guide, it installs version 0.5.0 for me but then when I try running HA with the notify section added to my config.yaml, I get the following error in the log file:

2017-06-15 13:48:25 ERROR (MainThread) [homeassistant.setup] Not initializing notify.html5 because could not install dependency pywebpush==1.0.0

So I’m assuming a higher version is required? I’ve tried installing 1.0.5 (which seems to be the newest version), but it just installs 0.5.0 anyway.
What am I doing wrong?

edit: I just realized that there is more to the error than I initially saw:

2017-06-15 15:01:34 ERROR (Thread-7) [homeassistant.util.package] Unable to install package pywebpush==1.0.0: Exception:
Traceback (most recent call last):
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/commands/install.py", line 335, in run
    wb.build(autobuilding=True)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/download.py", line 809, in unpack_url
    unpack_file_url(link, location, download_dir, hashes=hashes)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/download.py", line 715, in unpack_file_url
    unpack_file(from_path, location, content_type, link)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/utils/__init__.py", line 599, in unpack_file
    flatten=not filename.endswith('.whl')
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/pip/utils/__init__.py", line 484, in unzip_file
    zip = zipfile.ZipFile(zipfp, allowZip64=True)
  File "/usr/lib/python3.4/zipfile.py", line 937, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.4/zipfile.py", line 978, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
2017-06-15 15:01:34 ERROR (MainThread) [homeassistant.setup] Not initializing notify.html5 because could not install dependency pywebpush==1.0.0
2017-06-15 15:01:34 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform notify.html5: Could not install all requirements.
2017-06-15 15:01:34 ERROR (MainThread) [homeassistant.components.notify] Unknown notification service specified

This worked for me after only installing pywebpush version 0.5.0 with the above guide:

(fresh install of Hassbian 1.23 to fix broken Z-wave & mosquitto after upgrades)

Got stuck at step nr 14: Check the script by typing `cat.duck.log

The command should actually be: cat duck.log (no “.” between cat and duck).

Tom

1 Like

I’m sorry to bother you guys again but I cannot install pywebpush because of permission issues. I’m using Hassbian (0.47):

(homeassistant) pi@hassbian:/srv/homeassistant/bin $ (homeassistant) pi@hassbian:/srv/homeassistant/bin $ pip install “https://github .com/web-push-libs/pywebpush/archive/e743dc92558fc62178d255c0018920d74fa778ed.zi p#pywebpush==0.5.0”

This is the output I get:

running install
running build
running build_py
creating build
creating build/lib
creating build/lib/pyelliptic
copying pyelliptic/openssl.py → build/lib/pyelliptic
copying pyelliptic/init.py → build/lib/pyelliptic
copying pyelliptic/cipher.py → build/lib/pyelliptic
copying pyelliptic/hash.py → build/lib/pyelliptic
running install_lib
creating /srv/homeassistant/lib/python3.4/site-packages/pyelliptic
error: could not create ‘/srv/homeassistant/lib/python3.4/site-packages/pyel liptic’: Permission denied

Does this happen even when you’ve stopped Home Assistant before installing?

Is your ha installed on the pi account? Usually it has its own user, which would mean that you are not running the commands correctly based on the screen dump you’ve posted.

Got stuck on Step 12.

Im on Ubuntu with a simple installation path of /user/.homeassistant/

Where is this /template/index.html? :confused:

I was able to install pywebpush with some info from another post. This works for Hassbian:

sudo su - # Make myself root
source /srv/homeassistant/bin/activate
pip install --upgrade setuptools #Required to fix http_ece errors
pip install https://github.com/web-push-libs/pywebpush/archive/1.0.1.zip

Btw, if you want to run a custom domain like assistant.mydomain.com (instead of YOURNAME.duckdns.org) you can do this by setting a CNAME DNS record at your custom domain. Note, that in this case you should use this domain with certbot.

Following the instructions but the SSH is Pi@hassbian. Tried sudo and switching to SU as root and HASS but continue to get error creating the log file and no OK or KO

On hassbian 0.49 the path is /srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/frontend/templates/index.html

I got stuck here, doesen’t verifies. I’ve rebooted, reopened the file and the changes are made, but they don’t apear in the page nor google verifies. What should I do?

It finally did. The port was the problem. It only verified when I DID NOT put the port:

https://MYHASSNAME.duckdns.org/

I got duck dns working but it will only work when I am off my network. How do I get it to work on my local network as well?

Does the HTML5 notification works for IOS ? Sorry for the newbie question lol i have running on android but it does not show in IOS chrome
Thank you