Local Push notifications?

Hi!

I’m just learning this whole home assistant thing, and wanted to try out the push notifications.
Searching everywhere it seems the html5 push notifications is what I need to use (https://www.home-assistant.io/components/html5/)

But, what I don’t understand is why do I have to configure anything with Google to have LOCAL push notifications?
I mean I have a browser window open, I can give the browser permission to show notifications, and the website I’m viewing just pushes it to the browser. There is no need for any 3rd party to route the notification through.

Is this cannot be done? Or am I missing something?

Thanks.

Ok, so let me reply to my own question. I don’t know what the original intent was to make the Google route mandatory, but I’ve modified the code and now it works without Google as a simple local push notification both on desktop and on Android in Firefox.

Apply this simple patch to this version of notify.py: https://github.com/home-assistant/home-assistant/blob/c07227a53f59f6645d14854cf4b7cbd53770271e/homeassistant/components/html5/notify.py

@@ -182,9 +182,10 @@
     def websocket_appkey(hass, connection, msg):
         connection.send_message(websocket_api.result_message(msg["id"], vapid_pub_key))

-    hass.components.websocket_api.async_register_command(
-        WS_TYPE_APPKEY, websocket_appkey, SCHEMA_WS_APPKEY
-    )
+    if vapid_pub_key:
+        hass.components.websocket_api.async_register_command(
+            WS_TYPE_APPKEY, websocket_appkey, SCHEMA_WS_APPKEY
+        )

     hass.http.register_view(HTML5PushRegistrationView(registrations, json_path))
     hass.http.register_view(HTML5PushCallbackView(registrations))

and remove all the:

vapid_pub_key: YOUR_PUBLIC_KEY
vapid_prv_key: YOUR_PRIVATE_KEY
vapid_email: YOUR_EMAIL
gcm_api_key: YOUR_API_KEY
gcm_sender_id: YOUR_SENDER_ID

options from the notify settings, and that’s all!

Note, that I only tested this on Windows desktop and on Android with Firefox browser, and with the Testing method described here: https://www.home-assistant.io/components/html5/

EDIT:
Unfortunately it seems this is still not local. In this case it is using mozilla’s push services (https://updates.push.services.mozilla.com)
and then I still don’t understand why it not using just a simple javascript notify api, like this:
https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API

I also wondered, but implemented the whole Google thing (Stupid cow that I am). And then realize that the whole point of choosing Home Assistant was to own my data and not give data to others like Google!

Dont know exactly how but it seems possible to make this a custom component right?

Thanks a lot!

It probably is, since this is the original component with one more line of code added, and fixing the indentation for that.
But what would be better is to have the developer of the html5 push modify the the original code. Although that would probably require a bit more work since I don’t know if this breaks Chrome or not.

If you know an official way to talk to component developers please let me know and I’ll talk to them about this patch.

I had assumed Google was used as browser needed some pinned cert.
If your saying this is not needed and you figured out the patch…sir…You Are My Hero!!!

So unfortunately it seems my method is still not local only. It uses mozilla’s push services.
But at least the added benefit is that you don’t have to configure any parameter and don’t have to use google.

But my main goal was to use it locally only. It seems that would require more work maybe on the frontend side too. :confused: