HTML5 Push Notification Setup, Cloud Messaging Verification

Good Morning, afternoon, evening to all!

I’m currently attempting to setup HTML5 push notifications.

I have a working lets encrypt installation serving my hass site at eg. https://blahblah.duckdns.org

to enable verification in google cloud messaging i need to verify the domain two options available to me are a meta tag in the home page or adding a verification file to the root directory of hass’s web server.

is there a simple way to serve the verification file directly or add a tag to the head section before the first section

like this;

       <html>
          <head>
             <meta name="google-site-verification" content="fbfdgbvbdg__7wfbsdfbvfkAdEYobLfBQfgesrgher" />
             <title> My title </title>
          </head> 
       <body>
          page contents
       </body>
    </html>

BTW thanks to everyone working on home assistant!

I’m unsure how it’s working internally but checking the component I see the verification content is one of the parameters you need to include so I understand somehow in the implementation a meta will be written with your code.

have you tested it?

looking forward for your results to implement it here :slight_smile:

No excuse not to try it then!

I’ll give it a go Monday night.

Unfortunately I’ve been distracted by writing a c-bus plugin, I’ll get back to this in a few weeks, thanks for your help!

no problem,

I have been doing some testing … it’s easy to configure just include this:

- name: HTML5
  platform: html5
  gcm_api_key: 'Api Key provided in the Google page when you create it'
  gcm_sender_id: 'This is the Project # ID'

I’ve somehow been able to fire 1 notification by adding it in a testing script:

  cams_send_notification:
    alias: "Send Testing Notification"
    sequence: 
      - service: notify.html5
        data:
          title: "Title of the Notification"
          message: 'Content'

But now I’m having another issue.

When a browser is registered an entry shows in the file ‘html5_push_registrations.conf’ as per the config. The problem comes when the browser unregister. The file gets completely empty which is not making JSON very happy and you see errors like this in the log:

16-09-09 13:03:58 homeassistant.components.notify.html5: Saving config file failed: b'browserKEYID==' is not JSON serializable

So, no longer works and you can’t register a new one.

if you stop the service, remove the file and register a new browser it works. Little bit unstable …

if you have time later and you can check would be great to learn if you have the same experience.

good luck!!!

Sorry if this is a lame question. The link in the component page appears to be broken, how do I gen the api key/id?

Thanks,
Devan

I am also having issues following the instructions. I have issued a PR for the how to host the verification file however @drmcinnes

i must admit i gave up on it and moved on to easier things like c-bus intergration.

1 Like

Perhaps, this could help you:

Hey drmcinnes
How is your C-Bus plugin coming along? Would love to test and/or contribute.
Cheers
RR

anyone know if it is possible to make my phone vibrate when receiving a HTML5 push notification?

It vibrates by default if it is a new notification. If you look at the HTML 5 page there is a link to what is valid in the data payload and there is a field which allows you to adjust the vibration pattern.

If your phone doesn’t vibrate it is either do to a system setting or you repeated a notification with the same tag before it was dismissed.

Hi - sorry to resurrect, but how did you get on the the c-bus integration?

On hold thanks to huge amounts of work travel, hopefully next month… but I said that six months ago!

:slight_smile:
FWIW I am controlling my system using mqtt and cgateweb. Seems pretty stable so far.

Hey, Did you end up writing the c-bus plugin?