Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions source/_components/alert.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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') }})"
Copy link
Copy Markdown
Contributor

@tjorim tjorim Nov 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this example missing the {% raw %} tags?

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/