Add documenation for nfandroidtv config flow (#18025)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Robert Hillis 2021-07-28 07:09:20 -04:00 committed by GitHub
parent b0880426ef
commit 799bcc523b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,97 +1,75 @@
--- ---
title: Notifications for Android TV / FireTV title: Notifications for Android TV / Fire TV
description: Notifications for Android TV / FireTV description: Notifications for Android TV / Fire TV
ha_category: ha_category:
- Notifications - Notifications
ha_release: 0.32 ha_release: 0.32
ha_config_flow: true
ha_domain: nfandroidtv ha_domain: nfandroidtv
ha_iot_class: Local Push ha_iot_class: Local Push
ha_platforms: ha_platforms:
- notify - notify
ha_codeowners:
- '@tkdrob'
--- ---
Notification platform for [Notifications for Android TV](https://play.google.com/store/apps/details?id=de.cyberdream.androidtv.notifications.google) and [Notifications for FireTV](https://play.google.com/store/apps/details?id=de.cyberdream.firenotifications.google). You can use this plarform to send notifications to your Android TV device. An overlay with the message content will appear for a configurable amount of seconds and then disapper again. Sending images (e.g., security cam) is supported too. Notification integration for [Notifications for Android TV](https://play.google.com/store/apps/details?id=de.cyberdream.androidtv.notifications.google) and [Notifications for Fire TV](https://www.amazon.com/Christian-Fees-Notifications-for-Fire/dp/B00OESCXEK). You can use this integration to send notifications to your Android TV device. An overlay with the message content will appear for a configurable amount of seconds and then disappear again. Sending images (e.g., security cam) is supported too.
The notifications are in the global scope of your Android TV device. They will be displayed regardless of which application is running. The notifications are in the global scope of your Android TV device. They will be displayed regardless of which application is running.
When setting this up be aware, that there are two apps: one for your smartphone to send notifications (not required for this platform) and one for your Android TV device to receive the notifications. The app available in the store of your Android TV device is the one that is needed to display notifications sent from Home Assistant. The In-App purchases only apply to the client for Android smartphones, so there isn't any limit when pushing notifications from Home Assistant. When setting this up be aware, that there are two apps: one for your smartphone to send notifications (not required for this platform) and one for your Android TV device to receive the notifications. The app available in the store of your Android TV device is the one that is needed to display notifications sent from Home Assistant. The In-App purchases only apply to the client for Android smartphones, so there isn't any limit when pushing notifications from Home Assistant.
To enable the notification platform, add the following to your `configuration.yaml` file: {% include integrations/config_flow.md %}
```yaml ## Services
# Example configuration.yaml entry
notify: The following options can be specified inside the data field for the notify service call:
- platform: nfandroidtv
name: Kitchen ### Service `notify.[name_of_your_tv]`
host: 192.168.1.12
```
{% configuration %} {% 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
default: notify
type: string
host:
description: IP address of the Android TV / FireTV device.
required: true
type: string
duration: duration:
description: The duration in seconds for which the notification will be displayed. description: The duration in seconds for which the notification will be displayed.
required: false
default: 5 default: 5
type: integer type: integer
fontsize: fontsize:
description: "Has to be one of: `small`, `medium`, `large` or `max`." description: "Has to be one of: `small`, `medium`, `large` or `max`."
required: false
default: medium default: medium
type: string type: string
position: position:
description: "Has to be one of: `bottom-right`, `bottom-left`, `top-right`, `top-left` or `center`." description: "Has to be one of: `bottom-right`, `bottom-left`, `top-right`, `top-left` or `center`."
required: false
default: bottom-right default: bottom-right
type: string type: string
color: color:
description: "Has to be one of: `grey`, `black`, `indigo`, `green`, `red`, `cyan`, `teal`, `amber` or `pink`." description: "Has to be one of: `grey`, `black`, `indigo`, `green`, `red`, `cyan`, `teal`, `amber` or `pink`."
required: false
default: grey default: grey
type: string type: string
transparency: transparency:
description: "Has to be one of: `0%`, `25%`, `50%`, `75%` or `100%`." description: "Has to be one of: `0%`, `25%`, `50%`, `75%` or `100%`."
required: false
default: 25% default: 25%
type: string type: string
timeout: timeout:
description: The timeout in seconds for trying to send the notification to the device. description: The timeout in seconds for trying to send the notification to the device.
required: false
default: 5 default: 5
type: integer type: integer
interrupt: interrupt:
description: If set to true, 1, on etc., the notification is interactive and can be dismissed or selected to display more details. Depending on the running app (e.g., Netflix), this may stop playback. description: If set to true, 1, on etc., the notification is interactive and can be dismissed or selected to display more details. Depending on the running app (e.g., Netflix), this may stop playback.
required: false
default: false default: false
type: boolean type: boolean
{% endconfiguration %} {% endconfiguration %}
The configuration will be used to configure the default values for the notification for the host specified by the IP. However, you can override most of the settings by passing them with the data-attribute when calling the service. This is a fully customized YAML you can use inside `data` to test how the final notification will look like:
This is a fully customized JSON you can use to test how the final notification will look like:
```json ```yaml
{ fontsize: "large"
"message": "Messagetext", position: "center"
"title": "My Notification", duration: 2
"data":{ transparency: "0%"
"fontsize": "large", color: "red"
"position":"center", interrupt: 1
"duration":2,
"transparency":"0%",
"color": "red",
"interrupt": 1
}
}
``` ```
### Service data for sending images ## Service data for sending images
The following attributes can be placed inside `data` to send images. The following attributes can be placed inside `data` to send images.
@ -102,37 +80,23 @@ The following attributes can be placed inside `data` to send images.
| `url` | yes | URL of an image file. Is placed inside `file`. | `url` | yes | URL of an image file. Is placed inside `file`.
| `username` | yes | Username if the URL requires authentication. Is placed inside `file`. | `username` | yes | Username if the URL requires authentication. Is placed inside `file`.
| `password` | yes | Password if the URL requires authentication. Is placed inside `file`. | `password` | yes | Password if the URL requires authentication. Is placed inside `file`.
| `auth` | yes | If set to `digest` HTTP-Digest-Authentication is used. If missing, HTTP-BASIC-Authentication is used. Is placed inside `file`. | `auth` | yes | If set to `digest` HTTP-Digest-Authentication is used. If missing, HTTP-BASIC-Authentication is used and is placed inside `file`.
Example for posting file from URL: Example for posting file from URL:
```json ```yaml
{ file:
"message":"Messagetext", url: "http://[url to image file]"
"title":"My Notification", username: "optional user, if necessary"
"data":{ password: "optional password, if necessary"
"file":{ auth: "digest"
"url":"http://[url to image file]",
"username":"optional user, if necessary",
"password":"optional password, if necessary",
"auth":"digest"
}
}
}
``` ```
Example for posting file from local path: Example for posting file from local path:
```json ```yaml
{ file:
"message":"Messagetext", path: "/path/to/file.ext"
"title":"My Notification",
"data":{
"file":{
"path":"/path/to/file.ext"
}
}
}
``` ```
Please note that `path` is validated against the `allowlist_external_dirs` in the `configuration.yaml`. Please note that `path` is validated against the `allowlist_external_dirs` in the `configuration.yaml`.