HTML5 notification VAPID migration not working

Hi everyone,
I have a few automations set in my home-assistant instance to send push notifications to my phone through the HTML5 notification component.

I originally used the GCM method which was working fine at the start. Since April though this has been deprecated.

Today I have followed the instruction the component page to update and use the VAPID method. I have retrieved new keys from the “web configuration” section on firebase, put the keys in my config (through a secrets.yaml file), deleted the html5 configuration file and re-enabled notifications on both my laptop Firefox browser and my mobile Android / Chrome brower.

When I call the service from the HA service (dev-service), nothing happens. I do not see any error message pop up either on the UI or in the HA log file and no push notification is received.

Do you have any idea ? Is there something I have missed in my upgrading process ?

P.S : I have also updated HA to 0.94.3

You can look to see if messages being received by browser.

CHROME
Browse to chrome://gcm-internals
Send message and you should see receipt by browser or error.
Be aware PC show more detailed info than mobile but both allow identify receiving OK or not

FIREFOX
Is in devtools.
Should see message received or error

If nothing shows then likely not sending So HA or VAPID misconfigured. If decrypt errors maybe try unregister device, clear html5_push_registrations.conf from HA, reboot and reregister device. If received but not showing in browser maybe unregister, clear cache may be enough.

1 Like

Thanks for the response. On mobile chrome I did not see anything in gcm-internals. On desktop Firefox I have seen nothing either in the dev tools.

I suggest nothing is sent from HA. The thing is I am not seeing any error or anything related to html5 notification in the home-assistant log file.

When in gcm-internals you sent yourself a message?

How did you send message?

I opened gcm-internals on my mobile chrome browser and called the html5 notify service from the HA ui with the smartphone as notify target.

Try chrome on PC

EDIT
In case of mobile I’ve experienced issue due to settings. I specifically believe auto setup on new device held settings and prevent message display. Anyway, if problem on mobile it’s best to confirm on PC to be sure

Okay, I have added my desktop Chrome to HA through the notification toggle.
I then restarted HA.

When I call the notify.html5_target service with “{“message”:“test”}” data, I do not see anything in the gcm-internals view.

Verify VAPID setup.
Not sure if HA shows error if it cannot connect due to wrong or bad keys.

If previously using GCM transferring to VAPID is straight forward. I would assume some minor config error. Maybe.start from beginning?

Disable push on devices and clear cache
Verify VAPID keys
Stop HA
Delete html5 config file
Restart HA
Enable push and test

I have now gone through the process you suggested.

When I toggled the push notification item again from chrome (to enable notifications), I noticed a couple of lines shown in gcm-internals like this : “Registration response received : SUCCESS”

However, when calling the service itself to generate a notification, nothing happens : no error message, no notification and no new message in gcm-internals.

sound like not sending from HA.

I’m having the exact same problem with 0.95.4 (Docker, PC). Working before with GCM, domain verified, followed VAPID method, can’t send notifications. No errors anywhere. Devices register OK, they appear in html5 config file, gcm-internals show Registration SUCCESS, nothing when notifications are sent.

Did you verify messages using browser tools mentioned previously.

The migration worked but some devices seem to hold the old keys or some other type issue. Browser or possible phone reset will correct. I would verify messages being received before that however

Gcm-internals don’t show any trace of message, fail or success. It does show notification registration traces. It also fails on a new phone (never visited my HA on it before).

More details: I had notifications setup using GCM on an old HA installation (Docker + Traefik reverse proxy with LetsEncrypt certificates). I hadn’t used it for a few months. Now I started from scratch on 0.95 and decided to set up notifications using the VAPID method.

I’ve tried following the instructions from point 4 (Reusing the original Google Cloud Project), went to firebase, edited the already imported project to add the Key pair under Web Configuration.

Pasted key pair under vapid_pub_key and vapid_prv_key.

I have done nothing about my domain as it was verified already (using the DNS method, check with google and says still valid).

One more detail: On Google Compute Platform Dashboard there are 3 charts showing Traffic, Errors, and Latency. Well, there seem to be some errors, but I can’t figure out how to see logs or check what the errors were).

So you can see the registration in gcm-internals but you don’t see messages?

Can you post html5 config?

This may not be HA issue, completely.
If you see registration but never see message I would guess the messages are not being sent.

How are you sending messages?
Currently you have no working device?

Since you not using this in a while maybe some other error. I think GCM still working so maybe rollback to that and retest.

So you can see the registration in gcm-internals but you don’t see messages?

Yes. With the VAPID setup I can see registration events in gcm-internals when I enable notifications in that browser. But I don’t see any log there when notifications are sent.

This is the relevant config for VAPID (Please tell me if you need more info):

notify:
  - platform: html5
    vapid_pub_key: myPubKeyFromFirebaseProject (No quotes or anything)
    vapid_prv_key: myPrvKeyFromFirebaseProject
    vapid_email: [email protected]

I’m sending messages by calling the service notify.notify with service data {“message”:“hello”}
Currently none of my devices get notifications, even a new phone I just enabled them in.

I tried rolling back to my GCM config:

notify:
  - platform: html5
    name: Home Assistant
    gcm_api_key: myGcmApiKey
    gcm_sender_id: myGcmSenderId

But it doesn’t work. When I try to enable notifications in a browser, I get a little notice at the bottom that says “Registration failed. Push service error”.
GCM Internal Registration Logs show an entry that says “Registration response received INVALID_SENDER”.

Update: The thing sorted itself out after a couple of days without any change in config. VAPID method works now.

That’s frustrating!!

Hey guys

I would like to share my experience with html5 notification with you.

When I first activated VAPID it worked flawlessly like out of the box. However it stopped working after a few month with my chrome browser and I had no Idea why. GCM-Internal showed registration success and it also seemed to receive all messages sent from HA.

Searching the Web lead me to google support thread Google Support Notification not showed

Jim Witherspoon explained how disabling “Enable native notifications.” in chrome://flags/ solved the Problem for him and so it did for me. After disabling the Feature and restarting Chrome my Notifications from HA showed up immediately.

It still seems to be workaround and I am looking to fix the Problem on Windows 10 side. Disabling native notification will not put the messages to the Windows Notification Center. So the problem seems to be related to windows and not chrome.

As soon as I have found a proper solution for this I will leave it here.

edit:

Ok lol. This was much easier than I expected. Went to Windows 10 Settings Notifications and Actions and (re)enabled to show messages from Apps and other sender. I set the previously disabled native notifications flag in Chrome back to default, restarted the browser and voila the Notifications are back again :smiley:

Regards,

Dom

1 Like