mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-17 14:26:51 +00:00
change service call description (#12647)
* Update persistent_notification.markdown Based on this topic - https://community.home-assistant.io/t/changing-input-number-doesnt-work/183335 I think it's better to have notes about templates in the service data description rather than separately (so easy to miss it) I also added an example with templates just to give users a practical idea as this "This will allow you to use the current state of Home Assistant in your notifications" sounds very abstract ;) * Update source/_integrations/persistent_notification.markdown Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update source/_integrations/persistent_notification.markdown Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * some nitpicking Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
parent
1b8a196e27
commit
9dbf58fc3a
@ -22,13 +22,11 @@ The service `persistent_notification.create` takes in `message`, `title`, and `n
|
||||
|
||||
| Service data attribute | Optional | Description |
|
||||
| ---------------------- | -------- | ----------- |
|
||||
| `message` | no | Body of the notification.
|
||||
| `title` | yes | Title of the notification.
|
||||
| `message` | no | Body of the notification. Accepts [templates](/topics/templating/).
|
||||
| `title` | yes | Title of the notification. Accepts [templates](/topics/templating/).
|
||||
| `notification_id` | yes | If `notification_id` is given, it will overwrite the notification if there already was a notification with that ID.
|
||||
|
||||
The `persistent_notification` integration supports specifying [templates](/topics/templating/) for both the `message` and the `title`. This will allow you to use the current state of Home Assistant in your notifications.
|
||||
|
||||
In an [action](/getting-started/automation-action/) of your [automation setup](/getting-started/automation/) it could look like this with a customized subject.
|
||||
Here is how an [action](/getting-started/automation-action/) of your [automation setup](/getting-started/automation/) with static content could look like.
|
||||
|
||||
```yaml
|
||||
action:
|
||||
@ -38,6 +36,21 @@ action:
|
||||
title: "Custom subject"
|
||||
```
|
||||
|
||||
If you want to show some runtime information, you have to use [templates](/topics/templating/ inside `data_template`.
|
||||
|
||||
{% raw %}
|
||||
|
||||
```yaml
|
||||
action:
|
||||
service: persistent_notification.create
|
||||
data_template:
|
||||
title: >
|
||||
Thermostat is {{ state_attr('climate.thermostat', 'hvac_action') }}
|
||||
message: "Temperature {{ state_attr('climate.thermostat', 'current_temperature') }}"
|
||||
```
|
||||
|
||||
{% endraw %}
|
||||
|
||||
The service `persistent_notification.dismiss` requires a `notification_id`.
|
||||
|
||||
| Service data attribute | Optional | Description |
|
||||
|
Loading…
x
Reference in New Issue
Block a user