mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Add message template support for alert component (#6859)
* Add problem text to alert message if available * Revert "Add problem text to alert message if available" This reverts commit 78ba3a59a736db98d49feac0a0d5cf9381c16489. * Revert "Added info about templates (#6554)" as no template support is available for name or done_message. This reverts commit dfda4b3324e4e6dbbc82a300b0f295d8c0b0a0d0. * Add message template support for alert component documentation
This commit is contained in:
parent
9e892da6e9
commit
93f22e689a
@ -51,15 +51,9 @@ alert:
|
||||
|
||||
{% configuration %}
|
||||
name:
|
||||
description: The friendly name of the alert. This can include a [template][template].
|
||||
description: The friendly name of the alert.
|
||||
required: true
|
||||
type: string
|
||||
done_message:
|
||||
description: >
|
||||
A message sent after an alert transitions from `on` to `off`. Is only sent
|
||||
if an alert notification was sent for transitioning from `off` to `on`. This can include a [template][template].
|
||||
required: false
|
||||
type: string
|
||||
entity_id:
|
||||
description: The ID of the entity to watch.
|
||||
required: true
|
||||
@ -87,6 +81,19 @@ skip_first:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
message:
|
||||
description: >
|
||||
A message to be sent after an alert transitions from `of` to `on`
|
||||
with [template][template] support.
|
||||
required: false
|
||||
type: template
|
||||
done_message:
|
||||
description: >
|
||||
A message sent after an alert transitions from `on` to `off` with
|
||||
[template][template] support. Is only sent if an alert notification
|
||||
was sent for transitioning from `off` to `on`.
|
||||
required: false
|
||||
type: template
|
||||
notifiers:
|
||||
description: "List of `notification` components to use for alerts."
|
||||
required: true
|
||||
@ -192,4 +199,29 @@ following notification.
|
||||
For example, if the garage door opens at 2:00, a notification will be
|
||||
sent at 2:15, 2:45, 3:45, 4:45, etc., continuing every 60 minutes.
|
||||
|
||||
### {% linkable_title Message Templates %}
|
||||
|
||||
It may be desirable to have the alert notifications include information
|
||||
about the state of the entity.
|
||||
The following will show for a plant how to include the problem `attribute`
|
||||
of the entity.
|
||||
|
||||
```yaml
|
||||
# Example configuration.yaml entry
|
||||
office_plant:
|
||||
name: Plant in office needs help
|
||||
entity_id: plant.plant_office
|
||||
state: 'problem'
|
||||
repeat: 30
|
||||
can_acknowledge: True
|
||||
skip_first: True
|
||||
message: "Plant {{ states.plant.plant_office }} needs help ({{ state_attr('plant.plant_office', 'problem') }})"
|
||||
done_message: Plant in office is fine
|
||||
notifiers:
|
||||
- ryans_phone
|
||||
- kristens_phone
|
||||
```
|
||||
|
||||
The resulting message could be `Plant Officeplant needs help (moisture low)`.
|
||||
|
||||
[template]: /docs/configuration/templating/
|
||||
|
Loading…
x
Reference in New Issue
Block a user