
* Updated Configuration Variables sections Squashed commit of the following: commit a95d114183553ad3850e6ca2d688d622388ee666 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Mon Jul 30 20:08:02 2018 +0200 Clean some things up commit db63a37dc97ad7735b78b7078b09343a9e9d1981 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Mon Jul 30 18:28:20 2018 +0200 Revert "The rest for this PR" This reverts commit bb1b2f9a2f289e79198142f481305a301084ae29. commit df90512482f45195e2da06e08fa7d537df0be710 Merge: deef4fd4d4 e4ed00d287 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Mon Jul 30 17:05:27 2018 +0200 Merge remote-tracking branch 'upstream/current' into patch-1 commit deef4fd4d4379407fd668be1947c66ed3e87eff5 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sun Jul 29 12:40:01 2018 +0200 Fix Liquid error commit 74369fbbc8e5a302e6e7b8d26bfac6150d731232 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sun Jul 29 12:37:03 2018 +0200 Update Configuration Variables sections commit 6e50eaa013e8ff240763b52557b5f74f8d620568 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sun Jul 29 11:52:51 2018 +0200 Fix empty keys commit 7e4852e4738a55cebd17ec71d4a8fb217ae10ac3 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sun Jul 29 11:41:46 2018 +0200 Update binary_sensor.netatmo.markdown commit e1d83df83eedbb446c412ea97829d0970579438c Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sun Jul 29 11:28:39 2018 +0200 More updated Configuration Variables sections commit 66cbe391812488ec930ce8150cfc409950a02253 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 22:00:25 2018 +0200 Fix Liquid Exception sensor.speedtest commit bb1b2f9a2f289e79198142f481305a301084ae29 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 21:54:34 2018 +0200 The rest for this PR - Update components with new Configuration Variables section to have YAML block syntax - Fix wrong capitalised booleans commit 5e67726eb71b414e88b654128d193c892a6ae148 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 20:43:52 2018 +0200 Try multiline string in Cast Trying out a multiline string in a {% configuration %}-block. commit b8d34e9a8e8abfa1885a54a198b323b9de12d0c3 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 20:41:39 2018 +0200 Lint fixes etc. All default True/False capital letters have been fixed. Tried to reduce lines to 80 characters or less where possible. commit 88228b293ddef2630653c5636d2b75606106742b Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:32:46 2018 +0200 Update notify.webostv.markdown commit 7204c1d637beeabefb4141faddd334b29da92bea Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:15:18 2018 +0200 Fix capital letter commit 6e1b3db87b07c916df0d34983d333ad1d9faf1fc Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:14:05 2018 +0200 Update media_player.webostv.markdown commit 89ee23565abab1dc7113f83a1cd680bcd26e430a Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:08:59 2018 +0200 Update http.markdown commit 418f5cb7cd4e98592bfe6902276af881e0dac47b Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:02:19 2018 +0200 Fix capital letter commit d5264c3c4f9b468b2f7b9b1eba786d108e1b88ef Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:01:39 2018 +0200 Fix capital letter commit e4cd51271d1881adf8160497cddb638b285e505e Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:01:08 2018 +0200 Update sensor.iota.markdown commit c18b25fddc062b35d9160a02df3377f152231020 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 16:01:01 2018 +0200 Fix capital letter commit 79a78f284a2280d1f2c8d007c072fbe8ce6655c8 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:56:22 2018 +0200 Update Configuration Variables section commit 0db5228080573b21f5570ce56e60e67d1004e0f1 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:54:47 2018 +0200 Update Configuration Variables section commit d5d26f16117a9cc74349dd77f98fdce53d7ca1cd Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:54:14 2018 +0200 Update Configuration Variables section commit ab3f04511edbcc25a7f5f7e514b6a092a3cfcb68 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:52:50 2018 +0200 Update Configuration Variables section commit 37b2d1831d65c584be95daf49ea90022227984f7 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:51:29 2018 +0200 Update Configuration Variables section commit 39b3ecd7079dbf13576cd5306507b5f86c3ea9db Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:50:53 2018 +0200 Update Configuration Variables section commit 823ea87d3a9da8dee2cb786bd1f64a6492537e80 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:50:11 2018 +0200 Update Configuration Variables section commit 6560a2bac06e2292f912f96143ce6e688f900280 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:49:53 2018 +0200 Update Configuration Variables section commit cc97df289b09bdb52123b775af6545eba8608cc1 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:47:23 2018 +0200 Update Configuration Variables section commit fdc881eb7a33f0ab1e4a8a5749c05c07df2ab7fd Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:46:55 2018 +0200 Update Configuration Variables section commit 81e292c3e92a834c04ef577d2b1ab867d8d9db79 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:46:16 2018 +0200 Update Configuration Variables section commit 05d3481d1165ee89b3dc9a0342f1c2041c06e8ca Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:45:25 2018 +0200 Update Configuration Variables section commit ef34f8c2f4eb17183fa0d7de8da90cca02f355ea Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:41:08 2018 +0200 Update Configuration Variables section commit 49f69a36e46585d14396f284b0b8a016add8efe9 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:16:27 2018 +0200 Update Configuration Variables section commit 14732eeee06cc20f78af99035d8fbde02b7e2778 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:14:58 2018 +0200 Update Configuration Variables section commit e0f8578628d298730a258f3597c00d8d47748cc4 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:11:56 2018 +0200 Update media_player.samsungtv.markdown commit 8be3c95f8e3acb39c73843816e43b66c3f1f9945 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:10:45 2018 +0200 Update Configuration Variables section commit 53b6672521dc6fb69a7ad25ac56def6a2e2bcdf4 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:10:40 2018 +0200 Update media_player.webostv.markdown commit 421e90392af3704ef1a2577ce9d35f3d7459b71e Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 15:03:33 2018 +0200 Update Configuration Variables section commit 7f142fd359b693e4af872bdf1ecd6e98b82f694f Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:59:54 2018 +0200 webOS brand fix + filename clarification commit 1f1051bcbc55ff96da69493823ac8d4676e3a738 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:52:29 2018 +0200 Update sensor.yr.markdown commit 8be62f4a620d624b27bb130ab8d2a09c66016b08 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:52:05 2018 +0200 Update Configuration Variables section commit 69c615b295dd86c0bba46154587c25ea7e0bfd27 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:50:57 2018 +0200 Update notify.webostv.markdown commit 4b1175e5653f217d2d5c332ef25f4f540a2052e1 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:50:30 2018 +0200 Update notify.html5.markdown commit 4ba06dd29db58b96e1cbfb149c00037f6b4be5c3 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:49:59 2018 +0200 Update image_processing.openalpr_local.markdown commit ec919d57810e5a1e82908c297222bfc64492da8b Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:49:18 2018 +0200 Update image_processing.microsoft_face_detect.markdown commit da657b579fefb26061a52e1d06ff97ae8f08eefa Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:42:46 2018 +0200 Update Configuration Variables section commit 3b066ba22bfa409011faebd9a52a3187614bd444 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:40:33 2018 +0200 Update Configuration Variables section commit 360c5422d783bc940962a93e41f82950570210ab Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 14:38:54 2018 +0200 Update Configuration Variables section commit 7965ff8c7131bd646bea648c27a4eae861d1dc6d Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:51:12 2018 +0200 Update Configuration Variables section commit 48d20dd4fa39d76e294f32b99de6e3d1b9eaf419 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:48:33 2018 +0200 Update Configuration Variables section commit 4c6efe7218c3e098f3091dbd05f9b76b1fd59882 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:40:33 2018 +0200 Update Configuration Variables section commit 8c45d8309ebfbe57c2a08332890da4f5b08231ea Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:35:19 2018 +0200 Update Configuration Variables section commit bbfa64af6fa049553460524f3a983c4e803da15a Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:33:14 2018 +0200 Newline commit f0577bb456c09b027cb11341e2a95b2bbab444aa Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:32:54 2018 +0200 Fix typo commit 65f73ced0cfc453f77ee75d30e4a3ec788abba65 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:19:23 2018 +0200 Update notify.webostv.markdown commit 1a11c971bb409bbafebc04174f8dda3e32c711ce Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:18:44 2018 +0200 Update notify.html5.markdown commit 46532335451a593bab6fa6e9953c880537d5713c Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:18:04 2018 +0200 Update image_processing.openalpr_local.markdown commit ce9ca3453b33aa966f9f6716cd1e9330f3e3f458 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Sat Jul 28 13:15:05 2018 +0200 Update Configuration Variables section commit 6ae8a408894ba6c51b8c4cb545acc6405059bafa Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Thu Jul 26 22:58:55 2018 +0200 Update Configuration Variables section commit c4bed222338ca3be5e471352579fb8e71254d5d4 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Thu Jul 26 22:56:35 2018 +0200 Update Configuration Variables section commit 9fe09afd30a1e67a9c5f0ac887630c26de694814 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:46:23 2018 +0200 Update Configuration Variables section commit 8efc72f10db4bf10bcaecc5c84d7f88263b710ae Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:44:08 2018 +0200 Update image_processing.openalpr_cloud.markdown commit 52046e50645d7adb4d0a4cadc4151de54b7354aa Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:43:52 2018 +0200 Update Configuration Variables section commit c7a9296ae3e7d3ef545117b17bd95513a0168c4b Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:27:08 2018 +0200 Update image_processing.microsoft_face_detect.markdown commit 3b37dc0e11ac5344670225119ae6bbc9fff04af4 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:20:26 2018 +0200 Update Configuration Variables section commit 870cd41fef2b1c1c139642a291e9aaae14ae5c4c Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:18:38 2018 +0200 Update image_processing.microsoft_face_identify.markdown commit 0f76212b24b425282a99483c6efaad2abdbd3cf0 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:17:09 2018 +0200 Update Configuration Variables section commit 73513b9e4e26263eb4d8b5fb86cf6326c3319b8c Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:13:26 2018 +0200 Update image_processing.microsoft_face_detect.markdown commit c171a080b3bac291d05bcc4c4760b0d9529159d3 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 23:01:06 2018 +0200 Update image_processing.microsoft_face_detect.markdown commit 294a37f5847a227c33d5c9696f21a8bbe2288d83 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 21:46:14 2018 +0200 Update image_processing.microsoft_face_detect.markdown commit 9f4c3fad9e9ade578f205104bdac3d649c9d86fc Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 21:21:17 2018 +0200 Update image_processing.microsoft_face_detect.markdown commit 11579aa61b08adbb1e599177eda54b579fc9b593 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 21:13:30 2018 +0200 Update camera.mjpeg.markdown commit e93f5db4b6bd94d8cb5b46a61c76d86c31f00c8f Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 19:34:36 2018 +0200 Update Configuration Variables section commit 383b9ace663573473bdab467cd8697f7e330cda5 Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 17:49:38 2018 +0200 Remove leftover line commit 7e2e72f78f2ae4603a5c9968372b453dc956a79b Author: Jorim Tielemans <tielemans.jorim@gmail.com> Date: Wed Jul 25 17:46:55 2018 +0200 Update Configuration Variables section * Remove encapsulation Double quotes were visible in the frontend. * Remove empty default value * 🚑 Correcting types * ✏️ Removes double italic
14 KiB
layout, title, description, date, sidebar, comments, sharing, footer, logo, ha_category, ha_release
layout | title | description | date | sidebar | comments | sharing | footer | logo | ha_category | ha_release |
---|---|---|---|---|---|---|---|---|---|---|
page | Push Notifications | Instructions on how to use the HTML5 push notifications platform from Home Assistant. | 2016-08-17 21:58 | true | false | true | true | html5.png | Notifications | 0.27 |
The html5
notification platform enables you to receive push notifications to
Chrome or Firefox, no matter where you are in the world. html5
also supports
Chrome and Firefox on Android, which enables native-app-like integrations
without actually needing a native app.
HTML5 push notifications **do not** work on iOS.
To enable this platform,
add the following lines to your configuration.yaml
file:
# Example configuration.yaml entry
notify:
- platform: html5
name: NOTIFIER_NAME
gcm_api_key: 'gcm-server-key'
gcm_sender_id: 'gcm-sender-id'
{% configuration %}
name:
description: Setting the optional parameter name
allows multiple notifiers to be created. The notifier will bind to the service notify.NOTIFIER_NAME
.
required: false
type: string
default: notify
gcm_api_key:
description: The API Server key provided to you by Google for Google Cloud Messaging (GCM). Required to push to Chrome.
required: true
type: string
gcm_sender_id:
description: The sender ID provided to you by Google for Google Cloud Messaging (GCM). Required to push to Chrome.
required: true
type: string
{% endconfiguration %}
{% linkable_title Getting ready for Chrome %}
- Make sure you can access your Home Assistant installation from outside your network over https (see docs).
- Create a new project at https://console.cloud.google.com/home/dashboard.
- Go to https://console.cloud.google.com/apis/credentials/domainverification and verify your domain via Google Webmaster Central / Search Console - instructions.
- With the domain verified, go to https://console.firebase.google.com, select import Google project, and select the project you created.
- Then, click the cogwheel on top left and select "Project settings".
- Select 'Cloud Messaging' tab, listed beneath Project Credentials will be your 152 character 'Server Key' and 12 digit ID 'Sender ID' you need for configuring this component.
{% linkable_title Verify your domain %}
Follow these steps to verify domain ownership with Google Webmaster Central / Search Console:
- Enter your domain and add '/local' at the end, ie. https://example.com:8123/local
- Select HTML file verification and download the google*.html file.
- Create a directory named "www" in your Home Assistant configuration directory (/config share from Samba add-on).
- Place the downloaded google*.html file in the "www" directory.
- RESTART Home Assistant - this is important!
- Verify the file can be accessed in the browser, ie. https://example.com:8123/local/google123456789.html (change filename) - you should see a plain text message saying "google-site-verification: ..." - if you see "404: Not Found" or something else, retry the above steps.
- Go back to Google Webmaster Central / Search Console and proceed with the verification.
{% linkable_title Requirements %}
The html5
platform can only function if all of the following requirements are met:
- You are using Chrome and/or Firefox on any desktop platform, ChromeOS or Android.
- Your Home Assistant instance is exposed to the world.
- If using a proxy, HTTP basic authentication must be off for registering or unregistering for push notifications. It can be re-enabled afterwards.
- If you don't run Hass.io:
pywebpush
must be installed.libffi-dev
,libpython-dev
, andlibssl-dev
must be installed prior topywebpush
(i.e.pywebpush
probably won't automatically install). - You have configured SSL for your Home Assistant. It doesn't need to be configured in Home Assistant though, i.e. you can be running NGINX in front of Home Assistant and this will still work. The certificate must be trustworthy (i.e. not self signed).
- You are willing to accept the notification permission in your browser.
{% linkable_title Setting up %}
Assuming you have already added the platform to your configuration:
- Open Home Assistant in Chrome or Firefox.
- Load profile page by clicking on the badge next to the Home Assistant title in the sidebar. Assuming you have met all the requirements above then you should see a new slider for Push Notifications. If the slider is greyed out, ensure you are viewing Home Assistant via its external HTTPS address. If the slider is not visible, ensure you are not in the user configuration (Sidebar, Configuration, Users, View User).
- Slide it to the on position.
- Within a few seconds you should be prompted to allow notifications from Home Assistant.
- Assuming you accept, that's all there is to it!
- (Optional, but highly recommended!) Open the
html5_push_registrations.conf
file in your configuration directory. You will see a new entry for the browser you just added. Rename it fromunnamed device
to a name of your choice, which will make it easier to identify later. Do not change anything else in this file! You need to restart Home Assistant after making any changes to the file.
{% linkable_title Testing %}
Assuming the previous test completed successfully and your browser was registered, you can test the notification as follows:
- Open Home Assistant in Chrome or Firefox.
- Open the sidebar and click the Services button at the bottom (shaped like a remote control), located below the Developer Tools.
- From the Services dropdown, search for your HTML5 notify service (E.G. notify.NOTIFIER_NAME) and select it.
- In the Service Data text box enter: {"message":"hello world"}, then press the CALL SERVICE button.
- If everything worked you should see a popup notification.
{% linkable_title Usage %}
The html5
platform accepts a standard notify payload. However, there are also
some special features built in which you can control in the payload.
Any JSON examples below can be converted to YAML for automations.
{% linkable_title Actions %}
Chrome supports notification actions, which are configurable buttons that arrive with the notification and can cause actions on Home Assistant to happen when pressed. You can send up to 2 actions.
{
"message": "Anne has arrived home",
"data": {
"actions": [
{
"action": "open",
"icon": "/static/icons/favicon-192x192.png",
"title": "Open Home Assistant"
},
{
"action": "open_door",
"title": "Open door"
}
]
}
}
{% linkable_title Data %}
Any parameters that you pass in the notify payload that aren't valid for use in
the HTML5 notification (actions
, badge
, body
, dir
, icon
, image
,
lang
, renotify
, requireInteraction
, tag
, timestamp
, vibrate
) will be
sent back to you in the callback events.
{
"title": "Front door",
"message": "The front door is open",
"data": {
"my-custom-parameter": "front-door-open"
}
}
{% linkable_title Tag %}
By default, every notification sent has a randomly generated UUID (v4) set as
its tag or unique identifier. The tag is unique to the notification, not to
a specific target. If you pass your own tag in the notify payload you can
replace the notification by sending another notification with the same tag.
You can provide a tag
like so:
{
"title": "Front door",
"message": "The front door is open",
"data": {
"tag": "front-door-notification"
}
}
Example of adding a tag to your notification. This won't create new notification if there already exists one with the same tag.
- alias: Push/update notification of sensor state with tag
trigger:
- platform: state
entity_id: sensor.sensor
action:
service: notify.html5
data_template:
message: "Last known sensor state is {% raw %}{{ states('sensor.sensor') }}{% endraw %}."
data:
data:
tag: 'notification-about-sensor'
{% linkable_title Targets %}
If you do not provide a target
parameter in the notify payload a notification
will be sent to all registered targets as listed in
html5_push_registrations.conf
. You can provide a target
parameter like so:
{
"title": "Front door",
"message": "The front door is open",
"target": "unnamed device"
}
target
can also be a string array of targets like so:
{
"title": "Front door",
"message": "The front door is open",
"target": ["unnamed device", "unnamed device 2"]
}
{% linkable_title Overrides %}
You can pass any of the parameters listed
here
in the data
dictionary. Please note, Chrome specifies that the maximum size
for an icon is 320px by 320px, the maximum badge
size is 96px by 96px and the
maximum icon size for an action button is 128px by 128px.
{% linkable_title URL %}
You can provide a URL to open when the notification is clicked by putting url
in the data dictionary like so:
{
"title": "Front door",
"message": "The front door is open",
"data": {
"url": "https://google.com"
}
}
If no URL or actions are provided, interacting with a notification will open
your Home Assistant in the browser. You can use relative URLs to refer to Home
Assistant, i.e. /map
would turn into https://192.168.1.2:8123/map
.
{% linkable_title Automating notification events %}
During the lifespan of a single push notification, Home Assistant will emit a few different events to the event bus which you can use to write automations against.
Common event payload parameters are:
Parameter | Description |
---|---|
action |
The action key that you set when sending the notification of the action clicked. Only appears in the clicked event. |
data |
The data dictionary you originally passed in the notify payload, minus any parameters that were added to the HTML5 notification (actions , badge , body , dir , icon , image , lang , renotify , requireInteraction , tag , timestamp , vibrate ). |
tag |
The unique identifier of the notification. Can be overridden when sending a notification to allow for replacing existing notifications. |
target |
The target that this notification callback describes. |
type |
The type of event callback received. Can be received , clicked or closed . |
You can use the target
parameter to write automations against a single
target
. For more granularity,
use action
and target
together to write automations which will do specific
things based on what target clicked an action.
{% linkable_title received event %}
You will receive an event named html5_notification.received
when the
notification is received on the device.
- alias: HTML5 push notification received and displayed on device
trigger:
platform: event
event_type: html5_notification.received
{% linkable_title clicked event %}
You will receive an event named html5_notification.clicked
when the
notification or a notification action button is clicked.
The action button clicked is available as action
in the event_data
.
- alias: HTML5 push notification clicked
trigger:
platform: event
event_type: html5_notification.clicked
or
- alias: HTML5 push notification action button clicked
trigger:
platform: event
event_type: html5_notification.clicked
event_data:
action: open_door
{% linkable_title closed event %}
You will receive an event named html5_notification.closed
when the
notification is closed.
- alias: HTML5 push notification clicked
trigger:
platform: event
event_type: html5_notification.closed
{% linkable_title Making notifications work with NGINX proxy %}
If you use NGINX as a proxy with authentication in front of your Home Assistant instance, you may have trouble with receiving events back to Home Assistant. It's because of authentication token that cannot be passed through the proxy.
To solve the issue put additional location into your nginx site's configuration:
location /api/notify.html5/callback {
if ($http_authorization = "") { return 403; }
allow all;
proxy_pass http://localhost:8123;
proxy_set_header Host $host;
proxy_redirect http:// https://;
}
This rule check if request have Authorization
HTTP header and bypass the
htpasswd (if you use one).
If you still have the problem, even with mentioned rule, try to add this code:
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;