HLML5 notifications

I cannot set up html 5 notifications. I’ve got error:

Tue Apr 16 2019 15:13:16 GMT+0200 (czas środkowoeuropejski letni)
Push failed: <Response [403]>: 
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 403 (Forbidden)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>403.</b> <ins>That’s an error.</ins>
  <p>  <ins>That’s all we know.</ins>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/websocket_api/commands.py", line 122, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1160, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/notify/__init__.py", line 117, in async_notify_message
    await notify_service.async_send_message(**kwargs)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/html5/notify.py", line 467, in send_message
    self._push_message(payload, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/html5/notify.py", line 504, in _push_message
    vapid_claims=self._vapid_claims
  File "/usr/local/lib/python3.7/site-packages/pywebpush/__init__.py", line 384, in webpush
    result, result.text))
pywebpush.WebPushException: Push failed: <Response [403]>: 
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 403 (Forbidden)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>403.</b> <ins>That’s an error.</ins>
  <p>  <ins>That’s all we know.</ins>

configuration.yaml:

notify:
  - platform: html5
    name: arekgoogle
    vapid_pub_key: XXXXXXXXXXXXXXXXXXXXX
    vapid_prv_key: XXXXXXXXXXXXXX
    vapid_email: [email protected]

Previously I used GCM and it working fine. now I generated in existing project new keys for VAPID and notifications gone :frowning:

Any sugestions?

1 Like

You’re not alone it was working from me but I’ve updated and done quite a lot of changes that I no longer know what broke it… Following this thread

Did you delete html5_push_registrations.conf and re-enable notifications in your browser(s)?

Basically I was sitting here in front of my computer calling the HTML5 service, I see no notifications on my phone… I start to get annoyed.
I try to connect to HA on my phone and I get some DNS error issue on Chrome (I was on 4G), so I connected to my WiFi and baaam I can connect now. Hurray!
Now I thought I broke remote access/DuckDNS or something as I kept seeing some DNS error on Chrome and I just updated to 91.4 a couple of hours ago… banging my head against the desk, I was about to rollback… I completely moved on from the HTML5 notification issue as I thought it was actually somewhere else, probably my remote access or the new update.
So I restarted my Homeassistant… I go to the toilet while it restarts… I connect to my WiFi and there I am looking in the forum for similar issues, and wrote on this thread… I disconnect from the WiFi and keep hitting refresh, nada, not working. I switch tabs to the the forum and guess what? I can’t connect to the forum at all. Turns out my mobile carrier had internet issues over 4G, so while it shows connected I didn’t actually have any internet… :flushed:

Yes I did but didn’t help.
Still I’ve got 403 error.

You were able to find your vapid_prv_key OK?

Its location isn’t very apparent and I’ve seen several posts from people having trouble finding it.

Yes I found priv_key behind three dots :slight_smile: and copied it into configuration.yaml directly.
But maybe I should enclose it in some quotes?

Hmm. No, mine is working without quotes.

I seem to remember getting a 403 error at one point when making changes to either my base_url: or something in my auth_providers: sections, but I don’t remember any details. :confused:

I’m having this same issue. Mine was working initially after i changed to VAPID, but stopped working. Then I played with it, cheking out if the keys had changed or anything like that. Updated HA, rebooted and did several things, suddenly it works again. But that last a few days, now I keep getting:

Fri Apr 26 2019 12:06:50 GMT+0200 (sentraleuropeisk sommertid)

Error while executing automation automation.fondskonto_oppdateringer. Unknown error for call_service at pos 1:

Traceback (most recent call last): File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/automation/__init__.py", line 380, in action await script_obj.async_run(variables, context) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 131, in async_run await self._handle_action(action, variables, context) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 210, in _handle_action action, variables, context) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 299, in _async_call_service context=context File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 88, in async_call_from_config domain, service_name, service_data, blocking=blocking, context=context) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call self._execute_service(handler, service_call)) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service await handler.func(service_call) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/notify/__init__.py", line 117, in async_notify_message await notify_service.async_send_message(**kwargs) File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/html5/notify.py", line 467, in send_message self._push_message(payload, **kwargs) File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/html5/notify.py", line 504, in _push_message vapid_claims=self._vapid_claims File "/srv/homeassistant/lib/python3.6/site-packages/pywebpush/__init__.py", line 384, in webpush result, result.text)) pywebpush.WebPushException: Push failed: &lt;Response [403]&gt;: &lt;!DOCTYPE html&gt; &lt;html lang=en&gt; &lt;meta charset=utf-8&gt; &lt;meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"&gt; &lt;title&gt;Error 403 (Forbidden)!!1&lt;/title&gt; &lt;style&gt; *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* &gt; body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px} &lt;/style&gt; &lt;a href=//www.google.com/&gt;&lt;span id=logo aria-label=Google&gt;&lt;/span&gt;&lt;/a&gt; &lt;p&gt;&lt;b&gt;403.&lt;/b&gt; &lt;ins&gt;That’s an error.&lt;/ins&gt; &lt;p&gt; &lt;ins&gt;That’s all we know.&lt;/ins&gt;