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:
(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.
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 .
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
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
Just to verify, you try below?
No result?
Check to see if messages being received by browser but not displayed
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
This is best done from desktop browser.
Connection state: <should be connected>
Registered App IDs: <your HA site should appear hear>
Last checkin: <strangely mine work but date is expired by 3 day due to PC sleeping; I close and reopen browser for update>
Next checkin: <mine expired by 1day, close /reopen refrshed>
Do you see any log entry?
FIREFOX
Is in devtools.
Should see message received or error
Send message and you should see receipt by browser or error.
I don’t see anything when call notify service
Do you see any log entry?
There isn’t any log entry in HA
Is the duckdns showing in “registered apps ids” your HA site?
Did you deenroll devices after change to VAPID (Turn OFF push in HA web frontend for each device then TurnON again)?
- if you do this you will see the HA device disappear from “registered apps” in the devices browser when turn Off then reappear when back ON.
-i would expect that if site is showing here you should at least see attempts to deliver messages even if not successful.
The instructions for changing over, “start at step 4” etc, definitely work which suggests you have something wrong elsewhere. I swapped mine over yesterday and it all worked immediately after restarting HA.
YES
YES
HA device dissappear when I turn off notifications, an reappears OK when I turn on it again.
When I send a test notification from services in HA I’ve got no error logs (or any log at all)
Neiter in chrome://gcm-internals
To discard this I try to stop HA, modify my VAPID keys to non valid ones, start HA, no error show in HA, but when try to enable push notifications on frontend, I clearly see the error:
Failed to execute ‘subscribe’ on ‘PushManager’: The provided applicationServerKey is not valid.
So that rules out that VAPID is configured incorrectly.
Again, when setting it up it took 48 hours to start working, it did it for two days, and then again the notifications stopped appearing, nothing was modified in the HA configuration
Post issue in git and see if you get reply.
Could be HA issue?
You did verify your server (docker container) time is accurate?
I’m running in virtual enviroment, and already check Time, is ok.
I noticed that the following messages appear in chrome: // gcm-internals:
This tells you something?
Just that push seem to be working for you browser.
Honestly this may be HA code issue but I am not dev so truely I not know.
You have done all troubleshooting step and all seem correct so time to escalate beyond forum.
This or farily similar issue has occured for a few user.
At a minimum the cause need to be found and documented as it is frustrating so best to submit issue to git so maybe someone with better knowledge of component function can assist or provide guidance.
After it was working, did you restart HA?
I assume you try restart after it stop working?