HTML5 Notifications stopped working with error

With the latest upgrade I’ve had my HTML5 notifications stop working.

Nothing with my configs was changed, except for upgrading hass.io to the latest builds, but nevertheless, I checked the setup for the HTML5 notifications and everything is the same.

The logs do show errors whenever a notification for HTML5 is triggered:

Logger: homeassistant.helpers.script.websocket_api_script
Source: components/html5/notify.py:573
First occurred: 3:06:17 PM (1 occurrences)
Last logged: 3:06:17 PM

websocket_api script: Error executing script. Unexpected error for call_service at pos 1: Missing 'sub' from claims. 'sub' is your admin email as a mailto: link.
Logger: homeassistant.components.websocket_api.http.connection
Source: components/html5/notify.py:573
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 3:06:17 PM (1 occurrences)
Last logged: 3:06:17 PM

[140223063684000] Error handling message: Unknown error

I also turned off notifications for the web browser/webapp and turned it back on to re-register notifications on my mobile with HA, but still the error.

Any help greatly appreciated!

1 Like

Hi @rtorch

This is a known issue as detailed in HTML5 notifications not working in 2021.4.0b5 · Issue #48766 · home-assistant/core · GitHub.

Currently waiting for the upstream component to be fixed to resolve the issue.

2 Likes

Thanks for info. Hope it gets fixed soon!

A temporary fix is to change the email address in your html5 config to another address without hyphens, this is working for me now with my personal gmail.

Which email address? the vap_id? I’m using Google and firebase, so I’m not sure this will work. I’ll give it a go though…

…Just tried it, and nothing occurred with receiving notifications, but no errors in the HA logs!

Strange thing just happened. Switched the vapid email back to the firebase one and html5 notify is now working, and no errors in the log. Very odd.

Yes I changed the vapid_email to my gmail address and it worked.

There was a PR waiting to fix the upstream issue that was causing this which has now been merged so that would likely be why the firebase email is working again.

Strange though, I just tried to change mine back to the firebase email and getting the same error still.

Actually, you use the Notification API to check for existing permissions exactly as you described. What makes Chrome for Android unique is that the Notification API currently doesn’t work to create the actual notification. But it does work to check for permissions and for requesting permission. Once you have permission, you then use the ServiceWorker API to actually cause a notification to be shown.