Can't get work HTML5 Push Notifications - VAPID

Hi there, I’m running HTML5 push notifications with HA since 2 years without a problem.
With new VAPID setup I can’t get work, and I try everything!
I follow every steps from https://www.home-assistant.io/components/html5/ but when call the service nothing happens, there is nothing in HA LOG, any ideas?

this may or may not help you

Thanks for your answer, I already read that post, and follow all suggestions. But there is no solution, just “wait a few days”?
I have exactly the same configuration, even try to erase my google cloud project and setup everything again. Same result. ?

You showing no message received?
You try device that was never registered?

I am wondering if there is some cert that is not expired and temporarily creates issue when switch over.

Honestly I think switch over creating this issue and unfortunately troubleshooting is a little difficult. If using docker, maybe try default install with only VAPID configured

There is no message received, and I alredy try multiple devices, I am running HA in python virtual enviroment. As say, worked fine with previous GCM credentials, I just change to VAPID, and it won’t work.
It seems that messages are not sent from HA.

I have it working here. Can you show your config?

Thank you David, here is it:

notify:
  - platform: html5
    name: notificaciones_push
    vapid_pub_key: !secret vapid_pub_key
    vapid_prv_key: !secret vapid_prv_key
    vapid_email: !secret vapid_email

Secrets:

vapid_pub_key: 'MYVAPIDKEY'
vapid_prv_key: 'MYPRIVKEY'
vapid_email: MYEMAIL

From Firebase:

Also try to put the keys without quotes, same result.
If it helps, google assistant works fine.
I’m running latest version of HA, 0.97.2

I use secrets as well… my keys are not in quotes in there. Are yours?

Does it create a notify.notifications_push service? Mine does and I can call it with a json message like this {“message”:“test”}
image

Thank you David, I already try both, with and without quotes, same result.
And already try with test message from services:

When I click on call service button, nothing happens.
In previous versions of HA, and usign previous GCM method, it looked like a sign informing that the notification was sent, not now.
Nor does any record appear regarding the sending of the notification in the HA LOG.

Regards.-

So if no error in log, HA considers it’s sent it. Do you have any other notify ID’s you can test? You also might have notifications turned off in chrome…

I performed the following steps:

  • Stop HA and remove html5_push_registrations.conf
  • In chrome of my android device, remove the cache and delete permissions from the HA URL
  • Start HA and register the device again (I call it just “device”), the entry is created in html5_push_registrations.conf correctly:
{
    "device": {
        "browser": "chrome",
        "subscription": {
            "endpoint": "https://fcm.googleapis.com/fcm/send/XXXXXXXXXXXXXXXX",
            "expirationTime": null,
            "keys": {
                "auth": "XXXXXXXXXXXXXXXXX",
                "p256dh": "XXXXXXXXXXXXXXXXXXXXXXX"
            }
        }
    }
}
  • Restart HA, the added device entry appears in the list of services:
    image
    (I called “notificaciones_push” to notify service in configuration.yaml)
  • I send the test notification for the added device, or for all devices in general, without results, the notification is not sent, or there is nothing to indicate that it was made.

image

I found this method to test pywebpush:
From homeassistant instalation folder, go to virtual enviroment with source bin/activate, then we can use pywebpush natively:

(homeassistant) chon@localhost:~/homeassistant$ pywebpush --data mensaje.data --info subscription.info
ERROR: WebPushException: Push failed: 401 Unauthorized

where mensaje.data:

{"message":"Hola"}

and subscription.info was a part of the registred values in html5_push_registrations.conf:

{
 "endpoint": "https://fcm.googleapis.com/fcm/send/XXXXXXXXXXXXXXX"
 "keys": {
          "auth": "XXXXXXXXX",
          "p256dh": "XXXXXXXXXX"
         }
}

So, as you can see, i get ERROR: WebPushException: Push failed: 401 Unauthorized
HA problem? Firebase? Pywebpush?

I’m stuck

“Unauthorized”. I expect you use incorrect authentication details or some problem with authentication

Honestly, firebase and pywebpush are stable and last place I would consider issue occur. Problem here would affect not just HA but many application and website I think.

HA work no problem for others so likely not issue. Also most case only one device have issue. I think “cannot send any device” is rare and likely authentication issue

I agree, the only issue is that it still doesn’t work :sweat_smile:.
It doesn’t happen only with one device, no others registered devices receives notifications.
I already tried 3 Android smartphones and 2 Windows PCs.
Again, if the registration of the device is correct in html5_push_registrations.conf, I discard it is a problem of the project in Firebase, or authentication.
Do you know if there is a way to view the HA log at the time you send the notification?
In previous versions you could make a debug.
Maybe some HA developer can?
I can’t belive that I’m the only with this problem! Previous GCM credential worked fine for 2 years.

You may misunderstand.

GCM OK but VAPID NG,
All device NG with VAPID
I think HA and Firebase OK but your credentials are bad.

Maybe try generate new Vapid credentials.
Below link had 403 but possibly similar cause as yours

Also possible some other magical weirdness since person with same error you have say it work without change after several days.

Also, What version HA?

Make sure server has correct time set. Docker time may not match server if using docker so may need to verify that.

EDIT
Actually based on below 401 may be HA issue but I think incorrect time set in server may cause same so check that first

Yesterday I activated my home alarm system and… voilá!
A push notification appears on my phone (an automation programmed previously).
So, apparently, like good wine, the migration from GCM to VAPID takes time to mature :joy:
Now seriously, unfortunately I can not determine if the problem is HA, or Google servers, but I check this:

  • To migrate from GCM to VAPID, just follow these steps.
  • If doesn’t work, Wait at least 48 hours, believe me, don’t touch any more (insane fix)

Regards.-

Notifications stopped working after 2 days, nothing was changed in the settings.
I’m lost. Ideas?

Which browser?
Ha version?

I try Chrome and Firefox on PC, just Chrome on Android.
My HA version is 0.97.2