Adjust automation to plural triggers/conditions/actions keys (#34825)

This commit is contained in:
Franck Nijhof 2024-09-24 20:23:58 +02:00 committed by GitHub
parent e090d64fa3
commit 96e00f69a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
199 changed files with 976 additions and 976 deletions

View File

@ -14,10 +14,10 @@ You can also perform the action to activate [a scene](/integrations/scene/) whic
```yaml
automation:
# Change the light in the kitchen and living room to 150 brightness and color red.
trigger:
triggers:
- platform: sun
event: sunset
action:
actions:
- action: light.turn_on
target:
entity_id:
@ -29,13 +29,13 @@ automation:
automation 2:
# Notify me on my mobile phone of an event
trigger:
triggers:
- platform: sun
event: sunset
offset: -00:30
variables:
notification_action: notify.paulus_iphone
action:
actions:
# Actions are scripts so can also be a list of actions
- action: "{{ notification_action }}"
data:
@ -53,11 +53,11 @@ Conditions can also be part of an action. You can combine multiple actions and c
```yaml
automation:
- alias: "Office at evening"
trigger:
triggers:
- platform: state
entity_id: sensor.office_occupancy
to: "on"
action:
actions:
- action: notify.notify
data:
message: "Testing conditional actions"

View File

@ -16,11 +16,11 @@ Example of using condition:
```yaml
automation:
- alias: "Turn on office lights"
trigger:
triggers:
- platform: state
entity_id: sensor.office_motion_sensor
to: "on"
condition:
conditions:
- or:
- condition: numeric_state
entity_id: sun.sun
@ -29,7 +29,7 @@ automation:
- condition: numeric_state
entity_id: sensor.office_lux_sensor
below: 10
action:
actions:
- action: scene.turn_on
target:
entity_id: scene.office_lights
@ -44,12 +44,12 @@ The `condition` option of an automation, also accepts a single condition templat
```yaml
automation:
- alias: "Turn on office lights"
trigger:
triggers:
- platform: state
entity_id: sensor.office_motion_sensor
to: "on"
condition: "{{ state_attr('sun.sun', 'elevation') < 4 }}"
action:
actions:
- action: scene.turn_on
target:
entity_id: scene.office_lights

View File

@ -31,9 +31,9 @@ Some automations you only want to run every 5 minutes. This can be achieved usin
automation:
- mode: single
max_exceeded: silent
trigger:
triggers:
- ...
action:
actions:
- ...
- delay: 300 # seconds (=5 minutes)
```
@ -46,8 +46,8 @@ Sometimes an automation is doing an action on a device that does not support mul
automation:
- mode: queued
max: 25
trigger:
triggers:
- ...
action:
actions:
- ...
```

View File

@ -201,11 +201,11 @@ These are the properties available for a [Zone trigger](/docs/automation/trigger
```yaml
# Example configuration.yaml entries
automation:
trigger:
triggers:
- platform: state
entity_id: device_tracker.paulus
id: paulus_device
action:
actions:
- action: notify.notify
data:
message: >
@ -215,17 +215,17 @@ automation:
This was triggered by {{ trigger.id }}
automation 2:
trigger:
triggers:
- platform: mqtt
topic: "/notify/+"
action:
actions:
action: >
notify.{{ trigger.topic.split('/')[-1] }}
data:
message: "{{ trigger.payload }}"
automation 3:
trigger:
triggers:
# Multiple entities for which you want to perform the same action.
- platform: state
entity_id:
@ -235,14 +235,14 @@ automation 3:
to: "on"
# Trigger when someone leaves one of those lights on for 10 minutes.
for: "00:10:00"
action:
actions:
- action: light.turn_off
target:
# Turn off whichever entity triggered the automation.
entity_id: "{{ trigger.entity_id }}"
automation 4:
trigger:
triggers:
# When an NFC tag is scanned by Home Assistant...
- platform: event
event_type: tag_scanned
@ -251,11 +251,11 @@ automation 4:
user_id:
- 06cbf6deafc54cf0b2ffa49552a396ba
- 2df8a2a6e0be4d5d962aad2d39ed4c9c
condition:
conditions:
# Check NFC tag (ID) is the one by the front door
- condition: template
value_template: "{{ trigger.event.data.tag_id == '8b6d6755-b4d5-4c23-818b-cf224d221ab7'}}"
action:
actions:
# Turn off various lights
- action: light.turn_off
target:

View File

@ -46,7 +46,7 @@ This video tutorial explains how trigger IDs work.
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: "MY_CUSTOM_EVENT"
id: "custom_event"
@ -74,7 +74,7 @@ The second variant is setting variables that are available when attaching a trig
automation:
trigger_variables:
my_event: example_event
trigger:
triggers:
- platform: event
# Able to use `trigger_variables`
event_type: "{{ my_event }}"
@ -93,7 +93,7 @@ Events can be fired by integrations or via the API. There is no limitation to th
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: "MY_CUSTOM_EVENT"
# optional
@ -111,7 +111,7 @@ event that contain no, or similar, data and contexts.
```yaml
automation:
trigger:
triggers:
- platform: event
event_type:
- automation_reloaded
@ -132,7 +132,7 @@ automation:
sub_event: ABC
node: ac
value: on
trigger:
triggers:
- platform: event
event_type: "{{ 'MY_CUSTOM_EVENT_' ~ sub_event }}"
```
@ -145,7 +145,7 @@ Fires when Home Assistant starts up or shuts down.
```yaml
automation:
trigger:
triggers:
- platform: homeassistant
# Event can also be 'shutdown'
event: start
@ -161,7 +161,7 @@ Fires when a specific message is received on given MQTT topic. Optionally can ma
```yaml
automation:
trigger:
triggers:
- platform: mqtt
topic: "living_room/switch/ac"
# Optional
@ -176,7 +176,7 @@ The trigger in the example below will trigger only when the message received on
```yaml
automation:
trigger:
triggers:
- platform: mqtt
topic: "living_room/switch/ac"
payload: "on"
@ -199,7 +199,7 @@ automation:
room: "living_room"
node: "ac"
value: "on"
trigger:
triggers:
- platform: mqtt
topic: "{{ room ~ '/switch/' ~ node}}"
# Optional
@ -222,7 +222,7 @@ If the current state of your entity is `50` and you set the threshold to `below:
```yaml
automation:
trigger:
triggers:
- platform: numeric_state
entity_id: sensor.temperature
# If given, will trigger when the value of the given attribute for the given entity changes..
@ -247,7 +247,7 @@ When the `attribute` option is specified the trigger is compared to the given `a
```yaml
automation:
trigger:
triggers:
- platform: numeric_state
entity_id: climate.kitchen
attribute: current_temperature
@ -264,7 +264,7 @@ The state of the entity can be referenced like this:
```yaml
automation:
trigger:
triggers:
- platform: numeric_state
entity_id: sensor.temperature
value_template: "{{ state.state | float * 9 / 5 + 32 }}"
@ -279,7 +279,7 @@ Attributes of the entity can be referenced like this:
```yaml
automation:
trigger:
triggers:
- platform: numeric_state
entity_id: climate.kitchen
value_template: "{{ state.attributes.current_temperature - state.attributes.temperature_set_point }}"
@ -299,7 +299,7 @@ However, the comparison will only be made when the entity specified in the trigg
```yaml
automation:
trigger:
triggers:
- platform: numeric_state
entity_id: sensor.outside_temperature
# Other entity ids can be specified for above and/or below thresholds
@ -312,7 +312,7 @@ The `for:` can also be specified as `HH:MM:SS` like this:
```yaml
automation:
trigger:
triggers:
- platform: numeric_state
entity_id: sensor.temperature
# At least one of the following required
@ -331,7 +331,7 @@ You can also use templates in the `for` option.
```yaml
automation:
trigger:
triggers:
- platform: numeric_state
entity_id:
- sensor.temperature_1
@ -340,7 +340,7 @@ automation:
for:
minutes: "{{ states('input_number.high_temp_min')|int }}"
seconds: "{{ states('input_number.high_temp_sec')|int }}"
action:
actions:
- action: persistent_notification.create
data:
message: >
@ -378,7 +378,7 @@ This automation triggers if either Paulus or Anne-Therese are home for one minut
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id:
- device_tracker.paulus
@ -398,7 +398,7 @@ It's possible to give a list of `from` states or `to` states:
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: vacuum.test
from:
@ -411,7 +411,7 @@ If you want to trigger on all state changes, but not on attribute changes, you c
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: vacuum.test
to:
@ -421,7 +421,7 @@ If you want to trigger on all state changes *except* specific ones, use `not_fro
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: vacuum.test
not_from:
@ -442,7 +442,7 @@ For example, this trigger only fires when the boiler has been heating for 10 min
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: climate.living_room
attribute: hvac_action
@ -454,7 +454,7 @@ This trigger fires whenever the boiler's `hvac_action` attribute changes:
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: climate.living_room
attribute: hvac_action
@ -469,7 +469,7 @@ state for 30 seconds:
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: light.office
# Must stay "on" for 30 seconds
@ -488,7 +488,7 @@ the time specified, but doesn't care about "playing" or "paused".
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: media_player.kitchen
# Not "off" for 30 minutes
@ -504,7 +504,7 @@ same for `for` the time specified, regardless of the current state value.
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id: media_player.kitchen
# The media player remained in its current state for 1 hour
@ -517,7 +517,7 @@ You can also use templates in the `for` option.
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id:
- device_tracker.paulus
@ -526,7 +526,7 @@ automation:
for:
minutes: "{{ states('input_number.lock_min')|int }}"
seconds: "{{ states('input_number.lock_sec')|int }}"
action:
actions:
- action: lock.lock
target:
entity_id: lock.my_place
@ -556,7 +556,7 @@ Since the duration of twilight is different throughout the year, it is recommend
```yaml
automation:
trigger:
triggers:
- platform: sun
# Possible values: sunset, sunrise
event: sunset
@ -573,13 +573,13 @@ Sometimes you may want more granular control over an automation than simply suns
```yaml
automation:
- alias: "Exterior Lighting on when dark outside"
trigger:
triggers:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
# Can be a positive or negative number
below: -4.0
action:
actions:
- action: switch.turn_on
target:
entity_id: switch.exterior_lighting
@ -607,7 +607,7 @@ scanned using the Home Assistant Companion mobile application.
```yaml
automation:
trigger:
triggers:
- platform: tag
tag_id: A7-6B-90-5F
```
@ -617,7 +617,7 @@ device/scanner by setting the `device_id`:
```yaml
automation:
trigger:
triggers:
- platform: tag
tag_id: A7-6B-90-5F
device_id: 0e19cd3cf2b311ea88f469a7512c307d
@ -627,7 +627,7 @@ Or trigger on multiple possible devices for multiple tags:
```yaml
automation:
trigger:
triggers:
- platform: tag
tag_id:
- "A7-6B-90-5F"
@ -649,7 +649,7 @@ With template triggers you can also evaluate attribute changes by using is_state
```yaml
automation:
trigger:
triggers:
- platform: template
value_template: "{% if is_state('device_tracker.paulus', 'home') %}true{% endif %}"
@ -665,7 +665,7 @@ You can also use templates in the `for` option.
```yaml
automation:
trigger:
triggers:
- platform: template
value_template: "{{ is_state('device_tracker.paulus', 'home') }}"
for:
@ -694,7 +694,7 @@ A string that represents a time to fire on each day. Can be specified as `HH:MM`
```yaml
automation:
- trigger:
- triggers:
- platform: time
# Military time format. This trigger will fire at 3:32 PM
at: "15:32:00"
@ -714,11 +714,11 @@ The entity ID of an [input datetime](/integrations/input_datetime/).
```yaml
automation:
- trigger:
- triggers:
- platform: state
entity_id: binary_sensor.motion
to: "on"
action:
actions:
- action: climate.turn_on
target:
entity_id: climate.office
@ -729,10 +729,10 @@ automation:
datetime: >
{{ (now().timestamp() + 2*60*60)
| timestamp_custom('%Y-%m-%d %H:%M:%S') }}
- trigger:
- triggers:
- platform: time
at: input_datetime.turn_off_ac
action:
actions:
- action: climate.turn_off
target:
entity_id: climate.office
@ -746,10 +746,10 @@ The Entity ID of a [sensor](/integrations/sensor/) with the "timestamp" device c
```yaml
automation:
- trigger:
- triggers:
- platform: time
at: sensor.phone_next_alarm
action:
actions:
- action: light.turn_on
target:
entity_id: light.bedroom
@ -763,12 +763,12 @@ For example, this trigger fires 5 minutes before the phone alarm goes off.
```yaml
automation:
- trigger:
- triggers:
- platform: time
at:
entity_id: sensor.phone_next_alarm
offset: -00:05:00
action:
actions:
- service: light.turn_on
target:
entity_id: light.bedroom
@ -784,7 +784,7 @@ Multiple times can be provided in a list. All formats can be intermixed.
```yaml
automation:
trigger:
triggers:
- platform: time
at:
- input_datetime.leave_for_work
@ -799,20 +799,20 @@ With the time pattern trigger, you can match if the hour, minute or second of th
```yaml
automation:
trigger:
triggers:
- platform: time_pattern
# Matches every hour at 5 minutes past whole
minutes: 5
automation 2:
trigger:
triggers:
- platform: time_pattern
# Trigger once per minute during the hour of 3
hours: "3"
minutes: "*"
automation 3:
trigger:
triggers:
- platform: time_pattern
# You can also match on interval. This will match every 5 minutes
minutes: "/5"
@ -828,7 +828,7 @@ Persistent notification triggers are fired when a `persistent_notification` is `
```yaml
automation:
trigger:
triggers:
- platform: persistent_notification
update_type:
- added
@ -844,7 +844,7 @@ Webhook trigger fires when a web request is made to the webhook endpoint: `/api/
```yaml
automation:
trigger:
triggers:
- platform: webhook
webhook_id: "some_hook_id"
allowed_methods:
@ -892,7 +892,7 @@ Zone trigger fires when an entity is entering or leaving the zone. The entity ca
```yaml
automation:
trigger:
triggers:
- platform: zone
entity_id: person.paulus
zone: zone.home
@ -911,7 +911,7 @@ This isn't for use with `device_tracker` entities. For those look above at the `
```yaml
automation:
trigger:
triggers:
- platform: geo_location
source: nsw_rural_fire_service_feed
zone: zone.bushfire_alert_zone
@ -938,7 +938,7 @@ An optional time offset can be given to have it fire a set time before or after
```yaml
automation:
trigger:
triggers:
- platform: calendar
# Possible values: start, end
event: start
@ -959,7 +959,7 @@ Sentences are allowed to use some basic [template syntax](https://developers.hom
```yaml
automation:
trigger:
triggers:
- platform: conversation
command:
- "[it's ]party time"
@ -1002,7 +1002,7 @@ It is possible to specify multiple triggers for the same rule. To do so just pre
```yaml
automation:
trigger:
triggers:
# first trigger
- platform: time_pattern
minutes: 5
@ -1017,7 +1017,7 @@ It is possible to specify multiple entities for the same trigger. To do so add m
```yaml
automation:
trigger:
triggers:
- platform: state
entity_id:
- sensor.one
@ -1033,7 +1033,7 @@ To do so, add `enabled: false` to the trigger. For example:
```yaml
# Example script with a disabled trigger
automation:
trigger:
triggers:
# This trigger will not trigger, as it is disabled.
# This automation does not run when the sun is set.
- enabled: false
@ -1066,7 +1066,7 @@ blueprint:
trigger_variables:
_enable_number: !input input_number
trigger:
triggers:
- platform: sun
event_type: sunrise
enabled: !input input_boolean
@ -1094,7 +1094,7 @@ blueprint:
selector:
trigger:
trigger:
triggers:
- platform: event
event_type: manual_event
- triggers: !input usertrigger

View File

@ -15,7 +15,7 @@ automation: !include automations.yaml
# Labeled automation block
automation kitchen:
- trigger:
- triggers:
- platform: ...
```
@ -52,7 +52,7 @@ trace:
default: 5
required: false
variables:
description: "Variables that will be available inside your templates, both in `condition` and `action`."
description: "Variables that will be available inside your templates, both in `conditions` and `actions`."
required: false
default: {}
type: map
@ -84,7 +84,7 @@ max_exceeded:
required: false
type: string
default: warning
trigger:
triggers:
description: "The trigger(s) which will start the automation. Multiple triggers can be added and the automation will start when any of these triggers trigger."
required: true
type: list
@ -102,11 +102,11 @@ trigger:
PARAMETER_NAME:
description: "The value of the variable. Any YAML is valid. Templates can also be used to pass a value to the variable."
type: any
condition:
conditions:
description: Conditions that have to be `true` to start the automation. By default all conditions listed have to be `true`, you can use [logical conditions](/docs/scripts/conditions/#logical-conditions) to change this default behavior.
required: false
type: list
action:
actions:
description: "The sequence of actions to be performed in the script."
required: true
type: list
@ -138,7 +138,7 @@ automation my_lights:
# Turns on lights 1 hour before sunset if people are home
# and if people get home between 16:00-23:00
- alias: "Rule 1 Light on in the evening"
trigger:
triggers:
# Prefix the first line of each trigger configuration
# with a '-' to enter multiple
- platform: sun
@ -147,7 +147,7 @@ automation my_lights:
- platform: state
entity_id: all
to: "home"
condition:
conditions:
# Prefix the first line of each condition configuration
# with a '-'' to enter multiple
- condition: state
@ -156,7 +156,7 @@ automation my_lights:
- condition: time
after: "16:00:00"
before: "23:00:00"
action:
actions:
# With a single service entry, we don't need a '-' before service - though you can if you want to
- action: homeassistant.turn_on
target:
@ -164,26 +164,26 @@ automation my_lights:
# Turn off lights when everybody leaves the house
- alias: "Rule 2 - Away Mode"
trigger:
triggers:
- platform: state
entity_id: all
to: "not_home"
action:
actions:
- action: light.turn_off
target:
entity_id: all
# Notify when Paulus leaves the house in the evening
- alias: "Leave Home notification"
trigger:
triggers:
- platform: zone
event: leave
zone: zone.home
entity_id: device_tracker.paulus
condition:
conditions:
- condition: time
after: "20:00"
action:
actions:
- action: notify.notify
data:
message: "Paulus left the house"
@ -191,12 +191,12 @@ automation my_lights:
# Send a notification via Pushover with the event of a Xiaomi cube. Custom event from the Xiaomi integration.
- alias: "Xiaomi Cube Action"
initial_state: false
trigger:
triggers:
- platform: event
event_type: cube_action
event_data:
entity_id: binary_sensor.cube_158d000103a3de
action:
actions:
- action: notify.pushover
data:
title: "Cube event detected"
@ -217,7 +217,7 @@ At startup, automations by default restore their last state of when Home Assista
automation:
- alias: "Automation Name"
initial_state: false
trigger:
triggers:
- platform: ...
```
@ -230,7 +230,7 @@ automation:
- alias: "Automation Name"
trace:
stored_traces: 10
trigger:
triggers:
- platform: ...
```
@ -244,18 +244,18 @@ If you want to migrate your manual automations to use the editor, you'll have to
# Example automations.yaml entry. Note, automations.yaml is always a list!
- id: my_unique_id # <-- Required for editor to work, for automations created with the editor the id will be automatically generated.
alias: "Hello world"
trigger:
triggers:
- platform: state
entity_id: sun.sun
from: below_horizon
to: above_horizon
condition:
conditions:
- condition: numeric_state
entity_id: sensor.temperature
above: 17
below: 25
value_template: "{{ float(state.state) + 2 }}"
action:
actions:
- action: light.turn_on
```

View File

@ -267,13 +267,13 @@ blueprint:
mode: restart
max_exceeded: silent
trigger:
triggers:
- platform: state
entity_id: !input motion_entity
from: "off"
to: "on"
action:
actions:
- action: light.turn_on
target: !input light_target
- wait_for_trigger:

View File

@ -1381,7 +1381,7 @@ Targets are meant to be used with the `target` property of an action in
a script sequence. For example:
```yaml
action:
actions:
- action: light.turn_on
target: !input lights
```

View File

@ -44,11 +44,11 @@ The automation we're going to use in this tutorial controls a light based on a m
{% raw %}
```yaml
trigger:
triggers:
platform: state
entity_id: binary_sensor.motion_kitchen
action:
actions:
action: >
{% if trigger.to_state.state == "on" %}
light.turn_on
@ -91,7 +91,7 @@ Now we have to decide what steps we want to make configurable. We want to make i
Configurable parts in blueprints are called [inputs](/docs/blueprint/schema/#blueprint-inputs). To make the motion sensor entity configurable, we're replacing the entity ID with a custom YAML tag `!input`. This YAML tag has to be combined with the name of the input:
```yaml
trigger:
triggers:
platform: state
entity_id: !input motion_sensor
```
@ -103,7 +103,7 @@ Inputs are not limited to strings. They can contain complex objects too. So in t
{% raw %}
```yaml
action:
actions:
action: >
{% if trigger.to_state.state == "on" %}
light.turn_on
@ -233,11 +233,11 @@ blueprint:
entity:
- domain: light
trigger:
triggers:
- platform: state
entity_id: !input motion_sensor
action:
actions:
- action: >
{% if trigger.to_state.state == "on" %}
light.turn_on

View File

@ -267,20 +267,20 @@ These work recursively. As an example using `!include_dir_list automation`, will
```yaml
automation:
- alias: "Automation 1"
trigger:
triggers:
platform: state
entity_id: device_tracker.iphone
to: "home"
action:
actions:
action: light.turn_on
target:
entity_id: light.entryway
- alias: "Automation 2"
trigger:
triggers:
platform: state
entity_id: device_tracker.iphone
from: "home"
action:
actions:
action: light.turn_off
target:
entity_id: light.entryway
@ -298,11 +298,11 @@ automation: !include_dir_list automation/presence/
```yaml
alias: "Automation 1"
trigger:
triggers:
platform: state
entity_id: device_tracker.iphone
to: "home"
action:
actions:
action: light.turn_on
target:
entity_id: light.entryway
@ -312,11 +312,11 @@ action:
```yaml
alias: "Automation 2"
trigger:
triggers:
platform: state
entity_id: device_tracker.iphone
from: "home"
action:
actions:
action: light.turn_off
target:
entity_id: light.entryway
@ -333,7 +333,7 @@ It is important to note that each file must contain only **one** entry when usin
alexa:
intents:
LocateIntent:
action:
actions:
action: notify.pushover
data:
message: "Your location has been queried via Alexa."
@ -371,7 +371,7 @@ alexa:
```yaml
{% raw %}
action:
actions:
action: notify.pushover
data:
message: "Your location has been queried via Alexa."
@ -408,20 +408,20 @@ speech:
```yaml
automation:
- alias: "Automation 1"
trigger:
triggers:
- platform: state
entity_id: device_tracker.iphone
to: "home"
action:
actions:
- action: light.turn_on
target:
entity_id: light.entryway
- alias: "Automation 2"
trigger:
triggers:
- platform: state
entity_id: device_tracker.iphone
from: "home"
action:
actions:
- action: light.turn_off
target:
entity_id: light.entryway
@ -439,20 +439,20 @@ automation: !include_dir_merge_list automation/
```yaml
- alias: "Automation 1"
trigger:
triggers:
- platform: state
entity_id: device_tracker.iphone
to: "home"
action:
actions:
- action: light.turn_on
target:
entity_id: light.entryway
- alias: "Automation 2"
trigger:
triggers:
- platform: state
entity_id: device_tracker.iphone
from: "home"
action:
actions:
- action: light.turn_off
target:
entity_id: light.entryway

View File

@ -57,12 +57,12 @@ Scenes can be activated using the action `scene.turn_on` (there is no 'scene.tur
```yaml
# Example automation
automation:
trigger:
triggers:
platform: state
entity_id: device_tracker.sweetheart
from: "not_home"
to: "home"
action:
actions:
action: scene.turn_on
target:
entity_id: scene.romantic
@ -75,12 +75,12 @@ With the `scene.apply` action you are able to apply a scene without first defini
```yaml
# Example automation
automation:
trigger:
triggers:
platform: state
entity_id: device_tracker.sweetheart
from: "not_home"
to: "home"
action:
actions:
action: scene.apply
data:
entities:
@ -104,12 +104,12 @@ light will transition to the scene in 2.5 seconds.
```yaml
# Example automation
automation:
trigger:
triggers:
platform: state
entity_id: device_tracker.sweetheart
from: "not_home"
to: "home"
action:
actions:
action: scene.turn_on
target:
entity_id: scene.romantic

View File

@ -146,7 +146,7 @@ The `condition` {% term action %} only stops executing the current sequence bloc
```yaml
- alias: "Check if Paulus ishome AND temperature is below 20"
condition:
conditions:
- condition: state
entity_id: "device_tracker.paulus"
state: "home"
@ -360,11 +360,11 @@ The following {% term automation %} example shows how to raise a custom event ca
```yaml
- alias: "Fire Event"
trigger:
triggers:
- platform: state
entity_id: switch.kitchen
to: "on"
action:
actions:
- event: event_light_state_changed
event_data:
state: "on"
@ -376,10 +376,10 @@ The following {% term automation %} example shows how to capture the custom even
```yaml
- alias: "Capture Event"
trigger:
triggers:
- platform: event
event_type: event_light_state_changed
action:
actions:
- action: notify.notify
data:
message: "kitchen light is turned {{ trigger.event.data.state }}"
@ -524,16 +524,16 @@ _until_ the condition(s) evaluate to true.
```yaml
automation:
- trigger:
- triggers:
- platform: state
entity_id: binary_sensor.xyz
to: "on"
condition:
conditions:
- condition: state
entity_id: binary_sensor.something
state: "off"
mode: single
action:
actions:
- alias: "Repeat the sequence UNTIL the conditions are true"
repeat:
sequence:
@ -621,12 +621,12 @@ The `choose` {% term action %} can be used like an "if/then/elseif/then.../else"
```yaml
# Example with "if", "elif" and "else"
automation:
- trigger:
- triggers:
- platform: state
entity_id: input_boolean.simulate
to: "on"
mode: restart
action:
actions:
- choose:
# IF morning
- conditions:
@ -664,10 +664,10 @@ For example:
```yaml
automation:
- trigger:
- triggers:
- platform: state
entity_id: input_select.home_mode
action:
actions:
- choose:
- conditions: >
{{ trigger.to_state.state == 'Home' and
@ -706,12 +706,12 @@ When the sun goes below the horizon, the `porch` and `garden` lights must turn o
# Example with "if" and "if"
automation:
- alias: "Turn lights on when the sun gets dim and if some room is occupied"
trigger:
triggers:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: 4
action:
actions:
# This must always apply
- action: light.turn_on
data:
@ -770,11 +770,11 @@ groups themselves. In total, four actions are executed, one after the other.
```yaml
automation:
- trigger:
- triggers:
- platform: state
entity_id: binary_sensor.motion
to: "on"
action:
actions:
- alias: "Turn on devices"
sequence:
- action: light.turn_on
@ -807,11 +807,11 @@ The following example shows sending messages out at the same time (in parallel):
```yaml
automation:
- trigger:
- triggers:
- platform: state
entity_id: binary_sensor.motion
to: "on"
action:
actions:
- parallel:
- action: notify.person1
data:
@ -966,7 +966,7 @@ blueprint:
selector:
boolean:
action:
actions:
- delay: 0:35
enabled: !input input_boolean
```

View File

@ -19,7 +19,7 @@ All conditions support an optional `alias`.
Test multiple conditions in one condition statement. Passes if all embedded conditions are true.
```yaml
condition:
conditions:
alias: "Paulus home AND temperature below 20"
condition: and
conditions:
@ -36,7 +36,7 @@ If you do not want to combine AND and OR conditions, you can list them sequentia
The following configuration works the same as the one listed above:
```yaml
condition:
conditions:
- condition: state
entity_id: "device_tracker.paulus"
state: "home"
@ -50,7 +50,7 @@ Currently you need to format your conditions like this to be able to edit them u
The AND condition also has a shorthand form. The following configuration works the same as the ones listed above:
```yaml
condition:
conditions:
alias: "Paulus home AND temperature below 20"
and:
- condition: state
@ -66,7 +66,7 @@ condition:
Test multiple conditions in one condition statement. Passes if any embedded condition is true.
```yaml
condition:
conditions:
alias: "Paulus home OR temperature below 20"
condition: or
conditions:
@ -81,7 +81,7 @@ condition:
The OR condition also has a shorthand form. The following configuration works the same as the one listed above:
```yaml
condition:
conditions:
alias: "Paulus home OR temperature below 20"
or:
- condition: state
@ -98,7 +98,7 @@ Test multiple AND and OR conditions in one condition statement. Passes if any em
This allows you to mix several AND and OR conditions together.
```yaml
condition:
conditions:
condition: and
conditions:
- condition: state
@ -117,7 +117,7 @@ condition:
Or in shorthand form:
```yaml
condition:
conditions:
and:
- condition: state
entity_id: "device_tracker.paulus"
@ -136,7 +136,7 @@ condition:
Test multiple conditions in one condition statement. Passes if all embedded conditions are **not** true.
```yaml
condition:
conditions:
alias: "Paulus not home AND alarm not disarmed"
condition: not
conditions:
@ -151,7 +151,7 @@ condition:
The NOT condition also has a shorthand form. The following configuration works the same as the one listed above:
```yaml
condition:
conditions:
alias: "Paulus not home AND alarm not disarmed"
not:
- condition: state
@ -169,7 +169,7 @@ This type of condition attempts to parse the state of the specified entity or th
If both `below` and `above` are specified, both tests have to pass.
```yaml
condition:
conditions:
alias: "Temperature between 17 and 25 degrees"
condition: numeric_state
entity_id: sensor.temperature
@ -182,7 +182,7 @@ You can optionally use a `value_template` to process the value of the state befo
{% raw %}
```yaml
condition:
conditions:
condition: numeric_state
entity_id: sensor.temperature
above: 17
@ -197,7 +197,7 @@ It is also possible to test the condition against multiple entities at once.
The condition will pass if **all** entities match the thresholds.
```yaml
condition:
conditions:
condition: numeric_state
entity_id:
- sensor.kitchen_temperature
@ -209,7 +209,7 @@ Alternatively, the condition can test against a state attribute.
The condition will pass if the attribute value of the entity matches the thresholds.
```yaml
condition:
conditions:
condition: numeric_state
entity_id: climate.living_room_thermostat
attribute: temperature
@ -222,7 +222,7 @@ that contain a numeric value, can be used in the `above` and `below`
options to make the condition more dynamic.
```yaml
condition:
conditions:
condition: numeric_state
entity_id: climate.living_room_thermostat
attribute: temperature
@ -235,7 +235,7 @@ condition:
Tests if an entity has a specified state.
```yaml
condition:
conditions:
alias: "Paulus not home for an hour and a bit"
condition: state
entity_id: device_tracker.paulus
@ -251,7 +251,7 @@ It is also possible to test the condition against multiple entities at once.
The condition will pass if **all** entities match the state.
```yaml
condition:
conditions:
condition: state
entity_id:
- light.kitchen
@ -263,7 +263,7 @@ Instead of matching all, it is also possible if one of the entities matches.
In the following example the condition will pass if **any** entity matches the state.
```yaml
condition:
conditions:
condition: state
entity_id:
- binary_sensor.motion_sensor_left
@ -276,7 +276,7 @@ Testing if an entity is matching a set of possible conditions;
The condition will pass if the entity matches one of the states given.
```yaml
condition:
conditions:
condition: state
entity_id: alarm_control_panel.home
state:
@ -288,7 +288,7 @@ Or, combine multiple entities with multiple states. In the following example,
both media players need to be either paused or playing for the condition to pass.
```yaml
condition:
conditions:
condition: state
entity_id:
- media_player.living_room
@ -302,7 +302,7 @@ Alternatively, the condition can test against a state attribute.
The condition will pass if the attribute matches the given state.
```yaml
condition:
conditions:
condition: state
entity_id: climate.living_room_thermostat
attribute: fan_mode
@ -314,7 +314,7 @@ entities). The condition will pass if the state of the entity matches the state
of the given helper entity.
```yaml
condition:
conditions:
condition: state
entity_id: alarm_control_panel.home
state: input_select.guest_mode
@ -325,7 +325,7 @@ You can also use templates in the `for` option.
{% raw %}
```yaml
condition:
conditions:
condition: state
entity_id: device_tracker.paulus
state: "home"
@ -345,7 +345,7 @@ The `for` template(s) will be evaluated when the condition is tested.
The sun state can be used to test if the sun has set or risen.
```yaml
condition:
conditions:
alias: "Sun up"
condition: state # 'day' condition: from sunrise until sunset
entity_id: sun.sun
@ -353,7 +353,7 @@ condition:
```
```yaml
condition:
conditions:
alias: "Sun down"
condition: state # from sunset until sunrise
entity_id: sun.sun
@ -370,7 +370,7 @@ For an in-depth explanation of sun elevation, see [sun elevation trigger][sun_el
{% raw %}
```yaml
condition:
conditions:
condition: and # 'twilight' condition: dusk and dawn, in typical locations
conditions:
- condition: template
@ -384,7 +384,7 @@ condition:
{% raw %}
```yaml
condition:
conditions:
condition: template # 'night' condition: from dusk to dawn, in typical locations
value_template: "{{ state_attr('sun.sun', 'elevation') < -6 }}"
```
@ -405,7 +405,7 @@ The sunset/sunrise conditions do not work in locations inside the polar circles,
This is an example of 1 hour offset before sunset:
```yaml
condition:
conditions:
condition: sun
after: sunset
after_offset: "-01:00:00"
@ -414,7 +414,7 @@ condition:
This is 'when dark' - equivalent to a state condition on `sun.sun` of `below_horizon`:
```yaml
condition:
conditions:
- condition: sun
after: sunset
before: sunrise
@ -423,7 +423,7 @@ condition:
This is 'when light' - equivalent to a state condition on `sun.sun` of `above_horizon`:
```yaml
condition:
conditions:
- condition: sun
after: sunrise
before: sunset
@ -440,7 +440,7 @@ The template condition tests if the [given template][template] renders a value e
{% raw %}
```yaml
condition:
conditions:
alias: "Iphone battery above 50%"
condition: template
value_template: "{{ (state_attr('device_tracker.iphone', 'battery_level')|int) > 50 }}"
@ -487,7 +487,7 @@ and [`not`](#not-condition) conditions:
{% raw %}
```yaml
condition:
conditions:
condition: or
conditions:
- "{{ is_state('device_tracker.iphone', 'away') }}"
@ -539,7 +539,7 @@ It's also supported in script or automation `condition` actions:
The time condition can test if it is after a specified time, before a specified time or if it is a certain day of the week.
```yaml
condition:
conditions:
alias: "Time 15~02"
condition: time
# At least one of the following is required.
@ -565,7 +565,7 @@ or another `sensor` entity containing a timestamp with the "timestamp" device
class, can be used instead.
```yaml
condition:
conditions:
- alias: "Example referencing a time helper"
condition: time
after: input_datetime.house_silent_hours_start
@ -586,20 +586,20 @@ date part is fully ignored.
The trigger condition can test if an automation was triggered by a certain trigger, identified by the trigger's `id`.
```yaml
condition:
conditions:
condition: trigger
id: event_trigger
```
For a trigger identified by its index, both a string and integer is allowed:
```yaml
condition:
conditions:
condition: trigger
id: "0"
```
```yaml
condition:
conditions:
condition: trigger
id: 0
```
@ -607,7 +607,7 @@ condition:
It is possible to give a list of triggers:
```yaml
condition:
conditions:
condition: trigger
id:
- event_1_trigger
@ -619,7 +619,7 @@ condition:
Zone conditions test if an entity is in a certain zone. For zone automation to work, you need to have set up a device tracker platform that supports reporting GPS coordinates.
```yaml
condition:
conditions:
alias: "Paulus at home"
condition: zone
entity_id: device_tracker.paulus
@ -630,7 +630,7 @@ It is also possible to test the condition against multiple entities at once.
The condition will pass if all entities are in the specified zone.
```yaml
condition:
conditions:
condition: zone
entity_id:
- device_tracker.frenck
@ -642,7 +642,7 @@ Testing if an entity is matching a set of possible zones;
The condition will pass if the entity is in one of the zones.
```yaml
condition:
conditions:
condition: zone
entity_id: device_tracker.paulus
state:
@ -655,7 +655,7 @@ both entities need to be either in the home or the work zone for the condition
to pass.
```yaml
condition:
conditions:
condition: zone
entity_id:
- device_tracker.frenck
@ -670,7 +670,7 @@ condition:
{% raw %}
```yaml
condition:
conditions:
- condition: numeric_state
entity_id: sun.sun
value_template: "{{ state.attributes.elevation }}"
@ -700,7 +700,7 @@ For example:
```yaml
# This condition will always pass, as it is disabled.
condition:
conditions:
enabled: false
condition: state
entity_id: sun.sun
@ -728,7 +728,7 @@ blueprint:
trigger_variables:
_enable_number: !input input_number
condition:
conditions:
- condition: state
entity_id: sun.sun
state: "above_horizon"

View File

@ -104,10 +104,10 @@ If there is an automation that handles that event, it will be automatically trig
```yaml
- alias: "Capture Event"
trigger:
triggers:
platform: event
event_type: event_light_state_changed
action:
actions:
- action: notify.notify
data:
message: "Light is turned {{ trigger.event.data.state }}"

View File

@ -285,12 +285,12 @@ but you will still receive the done message.
```yaml
- alias: "Telegram callback to stop alerts for garage door"
trigger:
triggers:
- platform: event
event_type: telegram_callback
event_data:
data: "/garage_acknowledge"
action:
actions:
- action: alert.turn_off
target:
entity_id: alert.garage_door

View File

@ -436,14 +436,14 @@ Using this {% term trigger %} in an {% term automation %} will allow you to dete
# Example automations.yaml entry
alias: Doorbell Pressed
description: "Trigger when Amcrest Button Press Event Fires"
trigger:
triggers:
- platform: event
event_type: amcrest
event_data:
event: "CallNoAnswered"
payload:
action: "Start"
action:
actions:
- type: flash
entity_id: light.living_room
domain: light

View File

@ -146,7 +146,7 @@ The `androidtv.adb_command` action allows you to send either keys or ADB shell c
In an [action](/getting-started/automation-action/) of your [automation setup](/getting-started/automation/) it could look like this:
```yaml
action:
actions:
action: androidtv.adb_command
target:
entity_id: media_player.androidtv_tv_living_room

View File

@ -147,14 +147,14 @@ Using the lock operation sensors, you can detect when a user operates a lock and
- id: "1583706446906"
alias: "joe_doe_front_door_operate"
description: John Doe locks or unlocks the Front Door
trigger:
triggers:
- entity_id: sensor.front_door_operator
platform: state
to: John Doe
condition:
conditions:
- condition: template
value_template: "{{ not state_attr('sensor.front_door_operator', 'remote') }}"
action:
actions:
- data: {}
entity_id: camera.inside
action: camera.turn_off

View File

@ -81,10 +81,10 @@ See the example below for how an automation trigger translates to a message on t
```yaml
automation:
- alias: "Sunset Service Bus message"
trigger:
triggers:
platform: sun
event: sunset
action:
actions:
action: notify.test_queue
data:
message: "Sun is going down"

View File

@ -51,10 +51,10 @@ at 3 AM:
```yaml
automation:
- alias: "Backup Home Assistant every night at 3 AM"
trigger:
triggers:
platform: time
at: "03:00:00"
action:
actions:
alias: "Create backup now"
action: backup.create
```

View File

@ -39,16 +39,16 @@ The requirement is that you have setup the [`xiaomi aqara` integration](/integra
```yaml
- alias: "If there is motion and it's dark turn on the gateway light"
trigger:
triggers:
platform: state
entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
from: "off"
to: "on"
condition:
conditions:
condition: numeric_state
entity_id: sensor.illumination_34ce00xxxx11
below: 300
action:
actions:
- action: light.turn_on
target:
entity_id: light.gateway_light_34ce00xxxx11
@ -58,14 +58,14 @@ The requirement is that you have setup the [`xiaomi aqara` integration](/integra
target:
entity_id: automation.MOTION_OFF
- alias: "If there no motion for 5 minutes turn off the gateway light"
trigger:
triggers:
platform: state
entity_id: binary_sensor.motion_sensor_158d000xxxxxc2
from: "on"
to: "off"
for:
minutes: 5
action:
actions:
- action: light.turn_off
target:
entity_id: light.gateway_light_34ce00xxxx11
@ -78,42 +78,42 @@ The requirement is that you have setup the [`xiaomi aqara` integration](/integra
```yaml
- alias: "If the window is open turn off the radiator"
trigger:
triggers:
platform: state
entity_id: binary_sensor.door_window_sensor_158d000xxxxxc2
from: "off"
to: "on"
action:
actions:
action: climate.set_operation_mode
target:
entity_id: climate.livingroom
data:
operation_mode: "Off"
- alias: "If the window is closed for 5 minutes turn on the radiator again"
trigger:
triggers:
platform: state
entity_id: binary_sensor.door_window_sensor_158d000xxxxxc2
from: "on"
to: "off"
for:
minutes: 5
action:
actions:
action: climate.set_operation_mode
target:
entity_id: climate.livingroom
data:
operation_mode: "Smart schedule"
- alias: "Notify if door is opened when away"
trigger:
triggers:
platform: state
entity_id: binary_sensor.door_window_sensor_15xxxxxxc9xx6b
from: "off"
to: "on"
condition:
conditions:
- condition: state
entity_id: group.family
state: "not_home"
action:
actions:
- action: notify.notify_person
data:
message: "The door has been opened"
@ -123,12 +123,12 @@ The requirement is that you have setup the [`xiaomi aqara` integration](/integra
```yaml
- alias: "Send notification on fire alarm"
trigger:
triggers:
platform: state
entity_id: binary_sensor.smoke_sensor_158d0001574899
from: "off"
to: "on"
action:
actions:
- action: notify.html5
data:
title: Fire alarm!
@ -146,12 +146,12 @@ The requirement is that you have setup the [`xiaomi aqara` integration](/integra
```yaml
- alias: "Send notification on gas alarm"
trigger:
triggers:
platform: state
entity_id: binary_sensor.natgas_sensor_158dxxxxxxxxxx
from: "off"
to: "on"
action:
actions:
- action: notify.html5
data:
title: Gas alarm!
@ -166,35 +166,35 @@ As indicated in the table on top of this page there are 3 versions of the button
```yaml
- alias: "Toggle dining light on single press"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d000xxxxxc2
click_type: single
action:
actions:
action: switch.toggle
target:
entity_id: switch.wall_switch_left_158d000xxxxx01
- alias: "Toggle couch light on double click"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d000xxxxxc2
click_type: double
action:
actions:
action: switch.toggle
target:
entity_id: switch.wall_switch_right_158d000xxxxx01
- alias: "Let a dog bark on long press"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d000xxxxxc2
click_type: long_click_press
action:
actions:
action: xiaomi_aqara.play_ringtone
data:
gw_mac: xxxxxxxxxxxx
@ -208,65 +208,65 @@ Available events are `flip90`, `flip180`, `move`, `tap_twice`, `shake_air`, `swi
```yaml
- alias: "Cube event flip90"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: flip90
action:
actions:
- action: light.turn_on
target:
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "springgreen"
- alias: "Cube event flip180"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: flip180
action:
actions:
- action: light.turn_on
target:
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "darkviolet"
- alias: "Cube event move"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: move
action:
actions:
- action: light.turn_on
target:
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "gold"
- alias: "Cube event tap_twice"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: tap_twice
action:
actions:
- action: light.turn_on
target:
entity_id: light.gateway_light_28xxxxxxxxxx
data:
color_name: "deepskyblue"
- alias: "Cube event shake_air"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.cube_action
event_data:
entity_id: binary_sensor.cube_15xxxxxxxxxxxx
action_type: shake_air
action:
actions:
- action: light.turn_on
target:
entity_id: light.gateway_light_28xxxxxxxxxx
@ -282,13 +282,13 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac
```yaml
- alias: "Decrease brightness of the gateway light"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.wall_switch_left_158xxxxxxxxx12
click_type: single
action:
actions:
action: light.turn_on
target:
entity_id: light.gateway_light_34xxxxxxxx13
@ -305,13 +305,13 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac
{% endif %}
- alias: "Increase brightness of the gateway light"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.wall_switch_right_158xxxxxxxxx12
click_type: single
action:
actions:
action: light.turn_on
target:
entity_id: light.gateway_light_34xxxxxxxx13
@ -328,13 +328,13 @@ The Aqara Wireless Switch is available as single-key and double-key version. Eac
{% endif %}
- alias: "Turn off the gateway light"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.wall_switch_both_158xxxxxxxxx12
click_type: both
action:
actions:
action: light.turn_off
target:
entity_id: light.gateway_light_34xxxxxxxx13
@ -348,24 +348,24 @@ This automation toggles the living room lamp on vibration/tilt.
```yaml
- alias: "Turn on Living Room Lamp on vibration"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.movement
event_data:
entity_id: binary_sensor.vibration_xxxx000000
movement_type: vibrate
action:
actions:
action: light.toggle
target:
entity_id: light.living_room_lamp
- alias: "Turn on Living Room Lamp on tilt"
trigger:
triggers:
platform: event
event_type: xiaomi_aqara.movement
event_data:
entity_id: binary_sensor.vibration_xxxx000000
movement_type: tilt
action:
actions:
action: light.toggle
target:
entity_id: light.living_room_lamp

View File

@ -135,11 +135,11 @@ Here, this example assumes your blink module is named `My Sync Module` and that
```yaml
- id: arm_blink_when_away
alias: "Arm Blink When Away"
trigger:
triggers:
platform: state
entity_id: all
to: "not_home"
action:
actions:
action: alarm_control_panel.alarm_arm_away
target:
entity_id: alarm_control_panel.blink_my_sync_module
@ -152,11 +152,11 @@ Similar to the previous example, this automation will disarm blink when arriving
```yaml
- id: disarm_blink_when_home
alias: "Disarm Blink When Home"
trigger:
triggers:
platform: state
entity_id: all
to: "home"
action:
actions:
action: alarm_control_panel.alarm_disarm
target:
entity_id: alarm_control_panel.blink_my_sync_module
@ -173,11 +173,11 @@ The following example assumes your camera's name (in the Blink app) is `My Camer
```yaml
- id: save_blink_video_on_motion
alias: "Save Blink Video on Motion"
trigger:
triggers:
platform: state
entity_id: binary_sensor.blink_my_camera_motion_detected
to: "on"
action:
actions:
- action: blink.save_video
target:
entity_id: camera.blink_my_camera
@ -202,10 +202,10 @@ The file name of the downloaded video file is not configurable.
```yaml
- id: save_recent_clips_from_my_camera
alias: "Save Recent Clips from My Camera"
trigger:
triggers:
- platform: time_pattern
minutes: /3
action:
actions:
- action: blink.save_recent_clips
target:
entity_id: camera.my_camera

View File

@ -79,7 +79,7 @@ The name of the action is `notify.bmw_connected_drive_<your_vehicle>`.
```yaml
...
action:
actions:
action: notify.bmw_connected_drive_<your_vehicle>
data:
message: The name of the POI # this is shown on the iDrive dashboard

View File

@ -57,7 +57,7 @@ The **Bring** integration offers an action to send push notifications to the Bri
```yaml
...
action:
actions:
action: bring.send_message
target:
entity_id: todo.bring_shoppinglist
@ -71,7 +71,7 @@ Note that for the notification type `urgent_message` the attribute `item` is **r
```yaml
...
action:
actions:
action: bring.send_message
target:
entity_id: todo.bring_shoppinglist

View File

@ -45,10 +45,10 @@ Because the {% term state %} of a button entity in Home Assistant is a timestamp
means we can use it in our automations. For example:
```yaml
trigger:
triggers:
- platform: state
entity_id: button.my_button
action:
actions:
- action: notify.frenck
data:
message: "My button has been pressed!"

View File

@ -63,7 +63,7 @@ An example of a calendar {% term trigger %} in YAML:
```yaml
automation:
- trigger:
- triggers:
- platform: calendar
# Possible values: start, end
event: start
@ -99,11 +99,11 @@ This example automation consists of:
```yaml
automation:
- alias: Calendar notification
trigger:
triggers:
- platform: calendar
event: start
entity_id: calendar.personal
action:
actions:
- action: persistent_notification.create
data:
message: >-
@ -126,17 +126,17 @@ This example consists of:
```yaml
automation:
- alias: Front Light Schedule
trigger:
triggers:
- platform: calendar
event: start
entity_id: calendar.device_automation
- platform: calendar
event: end
entity_id: calendar.device_automation
condition:
conditions:
- condition: template
value_template: "{{ 'Front Lights' in trigger.calendar_event.summary }}"
action:
actions:
- if:
- "{{ trigger.event == 'start' }}"
then:

View File

@ -74,7 +74,7 @@ Play a live stream from a camera to selected media player(s). Requires [`stream`
For example, the following action in an automation would send an `hls` live stream to your chromecast.
```yaml
action:
actions:
action: camera.play_stream
target:
entity_id: camera.yourcamera
@ -102,7 +102,7 @@ For example, the following action in an automation would take a recording from "
{% raw %}
```yaml
action:
actions:
action: camera.record
target:
entity_id: camera.yourcamera
@ -128,7 +128,7 @@ For example, the following action in an automation would take a snapshot from "y
{% raw %}
```yaml
action:
actions:
action: camera.snapshot
target:
entity_id: camera.yourcamera

View File

@ -65,10 +65,10 @@ Here are the automations for the above screenshot:
# Rich Text Example 1.
# Show a one line message with a red banner
- alias: "Notify On Build Failing"
trigger:
triggers:
- platform: webhook
webhook_id: build_failed
action:
actions:
action: notify.cisco_webex_teams_notify
data:
message: "<blockquote class=danger>Build 0.89.5 compile failed."
@ -78,10 +78,10 @@ Here are the automations for the above screenshot:
# Show a title and multi-line message with a yellow banner,
# with lists, a person mention and a link
- alias: "Notify On Build Unstable"
trigger:
triggers:
- platform: webhook
webhook_id: build_unstable
action:
actions:
action: notify.cisco_webex_teams_notify
data:
title: "<strong>Build 0.89.6 is unstable.</strong>"
@ -101,10 +101,10 @@ Here are the automations for the above screenshot:
# Show a title and multi-line message with a blue banner,
# with lists, a person mention and a link
- alias: "Notify On Build Passing"
trigger:
triggers:
- platform: webhook
webhook_id: build_passed
action:
actions:
action: notify.cisco_webex_teams_notify
data:
title: "<strong>✅ Version 0.89.7 passed all tests and deployed to production!</strong>"

View File

@ -61,10 +61,10 @@ ClickSend is a notify platform and thus can be controlled by calling the notify
```yaml
alias: "The sun has set"
trigger:
triggers:
- platform: sun
event: sunset
action:
actions:
- action: notify.clicksend_tts
data:
message: "The sun has set"

View File

@ -52,10 +52,10 @@ Turn auxiliary heater on/off for climate device
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_aux_heat
target:
entity_id: climate.kitchen
@ -78,10 +78,10 @@ reflecting a situation where the climate device is set to save energy. For examp
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_preset_mode
target:
entity_id: climate.kitchen
@ -106,10 +106,10 @@ Set target temperature of climate device
```yaml
### Set temperature to 24 in heat mode
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_temperature
target:
entity_id: climate.kitchen
@ -121,10 +121,10 @@ automation:
```yaml
### Set temperature range to 20 to 24 in heat_cool mode
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_temperature
target:
entity_id: climate.kitchen
@ -147,10 +147,10 @@ Set target humidity of climate device
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_humidity
target:
entity_id: climate.kitchen
@ -171,10 +171,10 @@ Set fan operation for climate device
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_fan_mode
target:
entity_id: climate.kitchen
@ -195,10 +195,10 @@ Set climate device's HVAC mode
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_hvac_mode
target:
entity_id: climate.kitchen
@ -219,10 +219,10 @@ Set swing operation mode for climate device
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: climate.set_swing_mode
target:
entity_id: climate.kitchen

View File

@ -54,11 +54,11 @@ Example usage in an {% term automation %}, taking the album art present on a Chr
#automation.yaml
- alias: "Chromecast to Shelf Lights"
trigger:
triggers:
- platform: state
entity_id: media_player.chromecast
action:
actions:
- action: color_extractor.turn_on
data_template:
color_extract_url: "{{ states.media_player.chromecast.attributes.entity_picture }}"
@ -71,11 +71,11 @@ With a nicer transition period of 5 seconds and setting brightness to 100% each
#automation.yaml
- alias: "Nicer Chromecast to Shelf Lights"
trigger:
triggers:
- platform: state
entity_id: media_player.chromecast
action:
actions:
- action: color_extractor.turn_on
data_template:
color_extract_url: "{{ states.media_player.chromecast.attributes.entity_picture }}"

View File

@ -149,12 +149,12 @@ system_log:
automation:
- id: 'errorcounterautomation'
alias: "Error Counting Automation"
trigger:
triggers:
platform: event
event_type: system_log_event
event_data:
level: ERROR
action:
actions:
action: counter.increment
target:
entity_id: counter.error_counter

View File

@ -75,10 +75,10 @@ Available actions: `cover.open_cover`, `cover.close_cover`, `cover.stop_cover`,
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: cover.open_cover
target:
entity_id: cover.demo
@ -97,10 +97,10 @@ Set cover position of one or multiple covers.
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: cover.set_cover_position
target:
entity_id: cover.demo
@ -121,10 +121,10 @@ Set cover tilt position of one or multiple covers.
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: cover.set_cover_tilt_position
target:
entity_id: cover.demo

View File

@ -291,11 +291,11 @@ script:
automation:
- alias: "Close covers at night"
trigger:
triggers:
- platform: sun
event: sunset
offset: "+00:30:00"
action:
actions:
- action: cover.set_cover_position
target:
entity_id: cover.cover_group

View File

@ -194,26 +194,26 @@ If you have a Zigbee remote that is not yet supported you can request support fo
automation:
- alias: "'Toggle lamp from dimmer'"
initial_state: "on"
trigger:
triggers:
- platform: event
event_type: deconz_event
event_data:
id: remote_control_1
event: 1002
action:
actions:
- action: light.toggle
target:
entity_id: light.lamp
- alias: "Increase brightness of lamp from dimmer"
initial_state: "on"
trigger:
triggers:
- platform: event
event_type: deconz_event
event_data:
id: remote_control_1
event: 2002
action:
actions:
- action: light.turn_on
target:
entity_id: light.lamp
@ -224,13 +224,13 @@ automation:
- alias: "Decrease brightness of lamp from dimmer"
initial_state: "on"
trigger:
triggers:
- platform: event
event_type: deconz_event
event_data:
id: remote_control_1
event: 3002
action:
actions:
- action: light.turn_on
target:
entity_id: light.lamp
@ -241,13 +241,13 @@ automation:
- alias: 'Turn lamp on when turning cube clockwise'
initial_state: "on"
trigger:
triggers:
- platform: event
event_type: deconz_event
event_data:
id: remote_control_1
gesture: 7
action:
actions:
- action: light.turn_on
target:
entity_id: light.lamp
@ -262,13 +262,13 @@ automation:
```yaml
automation:
- alias: "React to color wheel changes"
trigger:
triggers:
- platform: event
event_type: deconz_event
event_data:
id: tint_remote_1
event: 6002
action:
actions:
- action: light.turn_on
data:
xy_color:
@ -288,11 +288,11 @@ Note: Requires `on: true` to change color while the Philips Hue bulb is off. If
automation:
- alias: "Flash Hue Bulb with Doorbell Motion"
mode: single
trigger:
triggers:
- platform: state
entity_id: binary_sensor.doorbell_motion
to: "on"
action:
actions:
- action: deconz.configure
data:
entity: light.hue_lamp

View File

@ -22,12 +22,12 @@ Example:
```yaml
- id: "123456789"
alias: "Light turns off"
trigger:
triggers:
- platform: device
device_id: 7a92d5ee74014a0b86903fc669b0bcd6
domain: light
type: turn_off
entity_id: light.bowl
action:
actions:
- action: camera.turn_off
```

View File

@ -47,14 +47,14 @@ If you have a sensor session running, and once you have enabled the Dexcom integ
- id: '1234567890123'
alias: "overnight_low_kitchen_lights"
description: Turn on the lights in the kitchen if my blood sugar drops low overnight
trigger:
triggers:
- below: '65'
entity_id: sensor.dexcom_YOUR_USERNAME_glucose_value
platform: numeric_state
condition: time
after: "22:00:00"
before: "06:00:00"
action:
actions:
- action: light.turn_on
target:
entity_id: light.kitchen

View File

@ -108,7 +108,7 @@ intent_script:
TurnLights:
speech:
text: Turning {{ Room }} lights {{ OnOff }}
action:
actions:
- action: notify.pushbullet
data:
message: Someone asked via apiai to turn {{ Room }} lights {{ OnOff }}

View File

@ -215,11 +215,11 @@ image_processing:
```yaml
# Example advanced automations.yaml entry
- alias: "Doods scanning"
trigger:
triggers:
- platform: state
entity_id:
- binary_sensor.driveway
action:
actions:
- action: image_processing.scan
target:
entity_id: image_processing.doods_camera_driveway

View File

@ -104,10 +104,10 @@ The example automation below shows how to turn on a light when somebody presses
```yaml
- alias: "Doorbird Ring"
trigger:
triggers:
platform: event
event_type: doorbird_driveway_gate_somebody_pressed_the_button
action:
actions:
action: light.turn_on
target:
entity_id: light.side_entry_porch

View File

@ -76,10 +76,10 @@ This is a notify platform and thus can be controlled by calling the notify actio
# Example automation notification entry
automation:
- alias: "The sun has set"
trigger:
triggers:
platform: sun
event: sunset
action:
actions:
action: notify.dovado
data:
message: "The sun has set"

View File

@ -51,10 +51,10 @@ Along with the event the following payload parameters are available:
```yaml
- alias: "Download Failed Notification"
trigger:
triggers:
platform: event
event_type: downloader_download_failed
action:
actions:
action: persistent_notification.create
data:
message: "{{trigger.event.data.filename}} download failed"

View File

@ -167,10 +167,10 @@ You can use the response data in a template sensor that is updated every hour:
```yaml
template:
- trigger:
- triggers:
- platform: time_pattern
seconds: "*"
action:
actions:
- action: easyenergy.get_energy_usage_prices
response_variable: response
data:

View File

@ -82,11 +82,11 @@ a binary sensor (a doorbell) is triggered:
```yaml
- alias: Visual doorbell notification example
trigger:
triggers:
- platform: state
entity_id: binary_sensor.doorbell
to: "on"
action:
actions:
- action: elgato.identify
target:
entity_id: light.elgato_key_light

View File

@ -116,14 +116,14 @@ The following is an example implementation of an automation:
# Example automation
- id: amp_volume_up
alias: "Increase amplifier volume"
trigger:
triggers:
- platform: event
event_type: roku_command
event_data:
source_name: Home Assistant
type: keypress
key: Fwd
action:
actions:
- action: media_player.volume_up
target:
entity_id: media_player.amplifier

View File

@ -136,10 +136,10 @@ The response data can be added to a template sensor:
```yaml
template:
- trigger:
- triggers:
- platform: time_pattern
hours: "*"
action:
actions:
- action: energyzero.get_energy_prices
response_variable: prices
data:

View File

@ -111,13 +111,13 @@ Sample automation to switch lights on and off:
# Example automation to turn lights on/off on button release
automation:
- alias: "Hall light switches"
trigger:
triggers:
platform: event
event_type: button_pressed
event_data:
id: [0xYY, 0xYY, 0xYY, 0xYY]
pushed: 0
action:
actions:
action: "{% if trigger.event.data.onoff %} light.turn_on {% else %} light.turn_off {%endif %}"
target:
entity_id: "{% if trigger.event.data.which == 1 %} light.hall_left {% else %} light.hall_right {%endif %}"

View File

@ -45,10 +45,10 @@ In addition, the entity can have the following states:
Because the state of an event entity in Home Assistant is a timestamp, it means we can use it in our automations. For example:
```yaml
trigger:
triggers:
- platform: state
entity_id: event.doorbell
action:
actions:
- action: notify.frenck
data:
message: "Ding Dong! Someone is at the door!"
@ -63,10 +63,10 @@ This allows you, for example, to trigger a different action when the button on a
When combining that with the [choose action](/docs/scripts/#choose-a-group-of-actions) script, you can assign multiple different actions to a single event entity. In the following example, short- or long-pressing the button on the remote will trigger a different scene:
```yaml
trigger:
triggers:
- platform: state
entity_id: event.hue_remote_control
action:
actions:
- alias: "Choose an action based on the type of event"
choose:
- conditions:

View File

@ -129,7 +129,7 @@ This action call will set the operating `mode` of the system for a specified per
For **AutoWithEco**, the period of time is a `duration` is up to 24 hours.
```yaml
- action:
- actions:
- action: evohome.set_system_mode
data:
mode: AutoWithEco
@ -139,7 +139,7 @@ For **AutoWithEco**, the period of time is a `duration` is up to 24 hours.
For the other modes, such as **Away**, the duration is a `period` of days, where 1 day will revert at midnight tonight, and 2 days reverts at midnight tomorrow.
```yaml
- action:
- actions:
- action: evohome.set_system_mode
data:
mode: Away
@ -161,7 +161,7 @@ This action will immediately pull the latest state data from the vendor's server
This action will set the `setpoint` of a zone, as identified by its `entity_id`, for a specified period of time (**TemporaryOverride**). However, if no period of time is provided (c.f. a duration of 0, below), then the change is permanent (**PermanentOverride**).
```yaml
- action:
- actions:
- action: evohome.set_zone_override
target:
entity_id: climate.loungeroom
@ -172,7 +172,7 @@ This action will set the `setpoint` of a zone, as identified by its `entity_id`,
The `duration` can be up to 24 hours, after which the zone mode will revert to schedule (**FollowSchedule**). If the `duration` is 0 hours, then the change will be until the next setpoint.
```yaml
- action:
- actions:
- action: evohome.set_zone_override
target:
entity_id: climate.loungeroom

View File

@ -48,10 +48,10 @@ The phone number used in **target** should be registered with Facebook messenger
# Example automation notification entry
automation:
- alias: "Evening Greeting"
trigger:
triggers:
platform: sun
event: sunset
action:
actions:
action: notify.facebook
data:
message: "Good Evening"

View File

@ -50,10 +50,10 @@ Sets the speed percentage for fan device.
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: fan.set_percentage
target:
entity_id: fan.kitchen
@ -74,10 +74,10 @@ Sets a preset mode for the fan device. Available preset modes are defined by the
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: fan.set_preset_mode
target:
entity_id: fan.kitchen
@ -98,10 +98,10 @@ Sets the rotation for fan device.
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: fan.set_direction
target:
entity_id: fan.kitchen
@ -122,10 +122,10 @@ Sets the oscillation for fan device.
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: fan.oscillate
target:
entity_id: fan.kitchen
@ -156,10 +156,10 @@ Turn fan device off. This is only supported if the fan device supports being tur
```yaml
automation:
trigger:
triggers:
platform: time
at: "07:15:00"
action:
actions:
- action: fan.turn_off
target:
entity_id: fan.kitchen
@ -180,13 +180,13 @@ Increases the speed of the fan device.
```yaml
automation:
trigger:
triggers:
- platform: device
device_id: 097cd9f706a86e9163acb64ba7d630da
domain: lutron_caseta
type: press
subtype: raise
action:
actions:
- action: fan.increase_speed
target:
entity_id: fan.dining_room_fan_by_front_door
@ -205,13 +205,13 @@ Decreases the speed of the fan device.
```yaml
automation:
trigger:
triggers:
- platform: device
device_id: 097cd9f706a86e9163acb64ba7d630da
domain: lutron_caseta
type: press
subtype: lower
action:
actions:
- action: fan.decrease_speed
target:
entity_id: fan.dining_room_fan_by_front_door

View File

@ -29,10 +29,10 @@ Feedreader events can be used out of the box to trigger automation actions, e.g.
```yaml
automation:
- alias: "Trigger action when new element(s) in RSS feed"
trigger:
triggers:
platform: event
event_type: feedreader
action:
actions:
action: script.turn_on
target:
entity_id: script.my_action
@ -43,12 +43,12 @@ automation:
```yaml
automation:
- alias: "Send notification of RSS feed title when updated"
trigger:
triggers:
platform: event
event_type: feedreader
event_data:
feed_url: "https://hasspodcast.io/feed/podcast"
action:
actions:
action: persistent_notification.create
data:
title: "New HA Podcast available"

View File

@ -117,27 +117,27 @@ These are documented below.
```yaml
automation:
- alias: "Switch on a light when incident is received"
trigger:
triggers:
platform: state
entity_id: sensor.incidents
action:
actions:
action: light.turn_on
target:
entity_id: light.bedroom
- alias: "Play TTS incident details when incident is received"
trigger:
triggers:
platform: state
entity_id: sensor.incidents
attribute: message_to_speech_url
condition:
conditions:
- condition: not
conditions:
- condition: state
entity_id: sensor.incidents
attribute: message_to_speech_url
state: None
action:
actions:
- action: media_player.play_media
data_template:
entity_id: media_player.nest_hub_bedroom
@ -146,10 +146,10 @@ automation:
media_content_type: "audio/mp4"
- alias: "Send response acknowledgement when a button is pressed"
trigger:
triggers:
platform: state
entity_id: switch.response_button
action:
actions:
action: homeassistant.turn_on
target:
entity_id: switch.incident_response
@ -158,7 +158,7 @@ automation:
trigger:
platform: homeassistant
event: start
action:
actions:
action: cast.show_lovelace_view
data:
entity_id: media_player.nest_hub_bedroom

View File

@ -78,13 +78,13 @@ The flic integration fires `flic_click` events on the bus. You can capture the e
# Example configuration.yaml automation entry
automation:
- alias: "Turn on lights in the living room when flic is pressed once"
trigger:
triggers:
platform: event
event_type: flic_click
event_data:
button_name: flic_81e4ac74b6d2
click_type: single
action:
actions:
action: homeassistant.turn_on
target:
entity_id: group.lights_livingroom
@ -104,10 +104,10 @@ To help detect and debug flic button clicks, you can use this automation that se
```yaml
automation:
- alias: "FLIC Html5 notify on every click"
trigger:
triggers:
platform: event
event_type: flic_click
action:
actions:
- action: notify.html5
data:
title: "flic click"

View File

@ -49,10 +49,10 @@ Example of an automation that sends a Home Assistant notification of the most re
```yaml
alias: "Notify: flume"
trigger:
triggers:
- platform: time_pattern
minutes: /5
action:
actions:
- action: flume.list_notifications
data:
config_entry: 1234 # replace this with your config entry id

View File

@ -53,10 +53,10 @@ Automations can be triggered on file system events data using a template. The fo
#Send notification for new image (including the image itself)
automation:
 alias: "New file alert"
trigger:
triggers:
  platform: state
entity_id: event.created
action:
actions:
  action: notify.notify
  data:
    title: New image captured!

View File

@ -58,10 +58,10 @@ Foursquare check-in events can be used out of the box to trigger automation acti
```yaml
automation:
- alias: "Trigger action when you check into a venue."
trigger:
triggers:
platform: event
event_type: foursquare.push
action:
actions:
action: script.turn_on
target:
entity_id: script.my_action

View File

@ -116,10 +116,10 @@ fritz_box_reconnect:
```yaml
automation:
- alias: "Reconnect FRITZ!Box"
trigger:
triggers:
- platform: time
at: "05:00:00"
action:
actions:
- action: button.press
target:
entity_id: button.fritzbox_7530_reconnect
@ -131,11 +131,11 @@ automation:
```yaml
automation:
- alias: "Guests Wi-Fi Turned On -> Send Password To Phone"
trigger:
triggers:
- platform: state
entity_id: switch.fritzbox_7530_wifi_myssid
to: "on"
action:
actions:
- action: notify.notify
data:
title: "Guest Wi-Fi is enabled"

View File

@ -52,10 +52,10 @@ This example shows how to send notifications whenever the sensor's state changes
# Example configuration.yaml entry.
automation:
- alias: "Notify about phone state"
trigger:
triggers:
- platform: state
entity_id: sensor.phone
action:
actions:
- action: notify.notify
data:
title: "Phone"

View File

@ -49,12 +49,12 @@ In case your device (friendly name) is called *badezimmer*, an example automatio
```yaml
# Example configuration.yaml automation
alias: "Bathroom Motion Detected"
trigger:
triggers:
platform: state
entity_id: binary_sensor.motion_sensor_166d0001171111
from: "off"
to: "on"
action:
actions:
action: media_player.turn_on
target:
entity_id: "media_player.badezimmer"

View File

@ -91,11 +91,11 @@ Each such entity has a state attribute that will contain a list of any such issu
```yaml
- alias: "GeniusHub Error Alerts"
trigger:
triggers:
platform: numeric_state
entity_id: sensor.geniushub_errors
above: 0
action:
actions:
- action: notify.pushbullet_notifier
data:
title: "Genius Hub has errors"
@ -112,10 +112,10 @@ This alert may be useful to see if the CH is being turned on whilst you're on a
```yaml
- alias: "GeniusHub CH State Change Alert"
trigger:
triggers:
platform: state
entity_id: binary_sensor.dual_channel_receiver_2_1
action:
actions:
- action: notify.pushbullet_notifier
data:
title: "Warning: CH State Change!"

View File

@ -56,15 +56,15 @@ zone:
automation:
- alias: "Bush Fire Alert"
trigger:
triggers:
platform: geo_location
source: nsw_rural_fire_service_feed
zone: zone.bush_fire_alert_zone
event: enter
condition:
conditions:
condition: template
value_template: "{{ trigger.to_state.attributes.type == 'Bush Fire' }}"
action:
actions:
- action: persistent_notification.create
data:
message: "{{ trigger.to_state.name }} - {{ trigger.to_state.attributes.status }}"

View File

@ -128,10 +128,10 @@ This example uses the [Latest release](#latest-release) entity provided by this
{% raw %}
```yaml
trigger:
triggers:
- platform: state
entity_id: sensor.awesome_repository_latest_release
action:
actions:
- action: notify.notify
data:
title: "New github/repository release"
@ -150,10 +150,10 @@ This example uses the [Stars](#diagnostic-entities) diagnostic entity provided b
{% raw %}
```yaml
trigger:
triggers:
- platform: state
entity_id: sensor.awesome_repository_stars
action:
actions:
- action: notify.notify
data:
title: "New github/repository new star"

View File

@ -45,12 +45,12 @@ The integration will poll the inverter for new values every 10 seconds. If you w
```yaml
- alias: "Goodwe inverter data polling"
trigger:
triggers:
- platform: time_pattern
hours: "*"
minutes: "*"
seconds: "/30"
action:
actions:
- action: homeassistant.update_entity
target:
entity_id: sensor.ppv

View File

@ -70,10 +70,10 @@ You can use the `homeassistant.update_entity` action to update the sensor on-dem
- id: update_morning_commute_sensor
alias: "Commute - Update morning commute sensor"
initial_state: "on"
trigger:
triggers:
- platform: time_pattern
minutes: "/2"
condition:
conditions:
- condition: time
after: "08:00:00"
before: "11:00:00"
@ -84,7 +84,7 @@ You can use the `homeassistant.update_entity` action to update the sensor on-dem
- wed
- thu
- fri
action:
actions:
- action: homeassistant.update_entity
target:
entity_id: sensor.morning_commute

View File

@ -80,7 +80,7 @@ In the file 'harmony_REMOTENAME.conf' you can find the available activities, for
Using the activity name 'Watch TV', you can perform an action via automation to switch this activity on:
```yaml
action:
actions:
- action: remote.turn_on
target:
entity_id: remote.bed_room_hub
@ -205,24 +205,24 @@ The example below shows how to control an `input_boolean` switch using the Harmo
```yaml
automation:
- alias: "Watch TV started from harmony hub"
trigger:
triggers:
platform: state
entity_id: remote.family_room
condition:
conditions:
condition: template
value_template: '{{ trigger.to_state.attributes.current_activity == "Kodi" }}'
action:
actions:
action: input_boolean.turn_on
target:
entity_id: input_boolean.notify
- alias: "PowerOff started from harmony hub"
trigger:
triggers:
platform: state
entity_id: remote.family_room
condition:
conditions:
condition: template
value_template: '{{ trigger.to_state.attributes.current_activity == "PowerOff" }}'
action:
actions:
action: input_boolean.turn_off
target:
entity_id: input_boolean.notify

View File

@ -170,7 +170,7 @@ Use the `hdmi_cec.select_device` action with the name of the device from configu
So an Automation action using the example above would look something like this.
```yaml
action:
actions:
action: hdmi_cec.select_device
data:
device: Chromecast
@ -183,7 +183,7 @@ Use the `hdmi_cec.power_on` action (no arguments) to power on any devices that s
An Automation action using the example above would look something like this.
```yaml
action:
actions:
action: hdmi_cec.power_on
```
@ -194,7 +194,7 @@ Use the `hdmi_cec.standby` action (no arguments) to place in standby any devices
An Automation action using the example above would look something like this.
```yaml
action:
actions:
action: hdmi_cec.standby
```

View File

@ -71,10 +71,10 @@ automation:
- id: update_morning_commute_sensor
alias: "Commute - Update morning commute sensor"
initial_state: "on"
trigger:
triggers:
- platform: time_pattern
minutes: "/2"
condition:
conditions:
- condition: time
after: "08:00:00"
before: "11:00:00"
@ -85,7 +85,7 @@ automation:
- wed
- thu
- fri
action:
actions:
- action: homeassistant.update_entity
target:
entity_id: sensor.morning_commute

View File

@ -313,7 +313,7 @@ Update the location of the Home Assistant default zone (usually "Home").
#### Example
```yaml
action:
actions:
action: homeassistant.set_location
data:
latitude: 32.87336
@ -335,7 +335,7 @@ for example, a light and a switch can be toggled in a single action.
#### Example
```yaml
action:
actions:
action: homeassistant.toggle
target:
entity_id:
@ -357,7 +357,7 @@ for example, a light and a switch can be turned on in a single action.
#### Example
```yaml
action:
actions:
action: homeassistant.turn_on
target:
entity_id:
@ -379,7 +379,7 @@ for example, a light and a switch can be turned off in a single action.
#### Example
```yaml
action:
actions:
action: homeassistant.turn_off
target:
entity_id:
@ -398,7 +398,7 @@ Force one or more entities to update its data rather than wait for the next sche
#### Example
```yaml
action:
actions:
action: homeassistant.update_entity
target:
entity_id:

View File

@ -454,14 +454,14 @@ The key name will be available in the event data in the `key_name` field. Exampl
```yaml
automation:
trigger:
triggers:
platform: event
event_type: homekit_tv_remote_key_pressed
event_data:
key_name: arrow_right
# Send the arrow right key via a broadlink IR blaster
action:
actions:
action: broadlink.send
host: 192.168.1.55
packet: XXXXXXXX
@ -474,13 +474,13 @@ The HomeKit integration emits `homekit_state_change` events. These events can be
```yaml
# Example for handling a HomeKit event
automation:
trigger:
triggers:
- platform: event
event_type: homekit_state_change
event_data:
entity_id: cover.garage_door
action: open_cover
action:
actions:
- action: persistent_notification.create
data:
message: "The garage door got opened via HomeKit"

View File

@ -252,14 +252,14 @@ Here's an example of how to use these events for automations:
```yaml
automation:
trigger:
triggers:
platform: event
event_type: homematic.keypress
event_data:
name: "Kitchen Switch"
channel: 1
param: PRESS_SHORT
action:
actions:
action: switch.turn_on
target:
entity_id: switch.Kitchen_Ambience
@ -306,7 +306,7 @@ Simulate a button being pressed:
```yaml
...
action:
actions:
action: homematic.virtualkey
data:
address: "BidCoS-RF"
@ -318,7 +318,7 @@ Open KeyMatic:
```yaml
...
action:
actions:
action: homematic.virtualkey
data:
address: "LEQ1234567"
@ -330,7 +330,7 @@ Set boolean variable to true:
```yaml
...
action:
actions:
action: homematic.set_variable_value
target:
entity_id: homematic.ccu2
@ -348,7 +348,7 @@ Manually turn on a switch actor:
```yaml
...
action:
actions:
action: homematic.set_device_value
data:
address: "LEQ1234567"
@ -361,7 +361,7 @@ Manually set temperature on thermostat:
```yaml
...
action:
actions:
action: homematic.set_device_value
data:
address: "LEQ1234567"
@ -374,7 +374,7 @@ Manually set the active profile on thermostat:
```yaml
...
action:
actions:
action: homematic.set_device_value
data:
address: "LEQ1234567"
@ -388,7 +388,7 @@ Set the week program of a wall thermostat:
```yaml
...
action:
actions:
action: homematic.put_paramset
data:
interface: wireless
@ -402,7 +402,7 @@ Set the week program of a wall thermostat with explicit `rx_mode` (BidCos-RF onl
```yaml
...
action:
actions:
action: homematic.put_paramset
data:
interface: wireless
@ -423,7 +423,7 @@ Manually set lock on KeyMatic devices:
```yaml
...
action:
actions:
action: lock.lock
target:
entity_id: lock.leq1234567
@ -433,7 +433,7 @@ Manually set unlock on KeyMatic devices:
```yaml
...
action:
actions:
action: lock.unlock
target:
entity_id: lock.leq1234567
@ -488,11 +488,11 @@ template:
automation:
- alias: "Homematic Reconnect"
trigger:
triggers:
platform: state
entity_id: binary_sensor.homematic_is_sending_updates
to: "off"
action:
actions:
# Reconnect, if sensor has not been updated for over 10 minutes
action: homematic.reconnect
```
@ -534,10 +534,10 @@ automation:
```yaml
automation:
- alias: "Homematic CCU Reboot"
trigger:
triggers:
platform: state
entity_id: sensor.v_last_reboot
action:
actions:
action: homematic.reconnect
```

View File

@ -234,7 +234,7 @@ Activate eco mode with duration.
```yaml
...
action:
actions:
action: homematicip_cloud.activate_eco_mode_with_duration
data:
duration: 60
@ -245,7 +245,7 @@ Activate eco mode with period.
```yaml
...
action:
actions:
action: homematicip_cloud.activate_eco_mode_with_period
data:
endtime: 2019-09-17 18:00
@ -256,7 +256,7 @@ Activates the vacation mode until the given time.
```yaml
...
action:
actions:
action: homematicip_cloud.activate_vacation
data:
endtime: 2019-09-17 18:00
@ -268,7 +268,7 @@ Deactivates the eco mode immediately.
```yaml
...
action:
actions:
action: homematicip_cloud.deactivate_eco_mode
data:
accesspoint_id: 3014xxxxxxxxxxxxxxxxxxxx
@ -278,7 +278,7 @@ Deactivates the vacation mode immediately.
```yaml
...
action:
actions:
action: homematicip_cloud.deactivate_vacation
data:
accesspoint_id: 3014xxxxxxxxxxxxxxxxxxxx
@ -291,7 +291,7 @@ You can get the required index from the native Homematic IP App.
```yaml
...
action:
actions:
action: homematicip_cloud.set_active_climate_profile
target:
entity_id: climate.livingroom
@ -303,7 +303,7 @@ Dump the configuration of the Homematic IP Access Point(s).
```yaml
...
action:
actions:
action: homematicip_cloud.dump_hap_config
data:
anonymize: True
@ -313,7 +313,7 @@ Reset energy counter of measuring actuators.
```yaml
...
action:
actions:
action: homematicip_cloud.reset_energy_counter
target:
entity_id: switch.livingroom
@ -323,7 +323,7 @@ Enable (or disable) Cooling mode for the entire home. Disabling Cooling mode wil
```yaml
...
action:
actions:
action: homematicip_cloud.set_home_cooling_mode
data:
cooling: True

View File

@ -55,13 +55,13 @@ Due to the instability of the Honeywell total connect system, actions within aut
```yaml
alias: "No one home"
description: "Everyone has left home"
trigger:
triggers:
- platform: numeric_state
entity_id: zone.home
for:
minutes: 10
below: 1
action:
actions:
- repeat:
sequence:
- action: climate.set_temperature

View File

@ -107,10 +107,10 @@ Example of adding a tag to your notification. This won't create new notification
```yaml
- alias: "Push/update notification of sensor state with tag"
trigger:
triggers:
- platform: state
entity_id: sensor.sensor
action:
actions:
action: notify.html5
data:
message: "Last known sensor state is {{ states('sensor.sensor') }}."
@ -207,7 +207,7 @@ notification is received on the device.
```yaml
- alias: "HTML5 push notification received and displayed on device"
trigger:
triggers:
platform: event
event_type: html5_notification.received
```
@ -218,7 +218,7 @@ You will receive an event named `html5_notification.clicked` when the notificati
```yaml
- alias: "HTML5 push notification clicked"
trigger:
triggers:
platform: event
event_type: html5_notification.clicked
```
@ -227,7 +227,7 @@ or
```yaml
- alias: "HTML5 push notification action button clicked"
trigger:
triggers:
platform: event
event_type: html5_notification.clicked
event_data:
@ -240,7 +240,7 @@ You will receive an event named `html5_notification.closed` when the notificatio
```yaml
- alias: "HTML5 push notification clicked"
trigger:
triggers:
platform: event
event_type: html5_notification.closed
```

View File

@ -69,10 +69,10 @@ Set mode for the humidifier device. This action is only available if the device
```yaml
automation:
trigger:
triggers:
- platform: time
at: "07:15:00"
action:
actions:
- action: humidifier.set_mode
target:
entity_id: humidifier.bedroom
@ -93,10 +93,10 @@ Set target humidity of the humidifier device
```yaml
automation:
trigger:
triggers:
- platform: time
at: "07:15:00"
action:
actions:
- action: humidifier.set_humidity
target:
entity_id: humidifier.bedroom

View File

@ -224,10 +224,10 @@ Velocity controls the speed of the shade. The default speed from Hunter Douglas
``` yaml
alias: "Blinds closed at night"
trigger:
triggers:
platform: time
at: "18:00:00"
action:
actions:
- action: scene.turn_on
target:
entity_id: scene.10877
@ -241,10 +241,10 @@ This automation is not recommended for battery-powered shades.
alias: Force Update
description: 'Update the position of defined shades'
mode: single
trigger:
triggers:
- platform: time_pattern
hours: '1'
action:
actions:
- action: homeassistant.update_entity
target:
entity_id:

View File

@ -113,11 +113,11 @@ To start Hyperion with an effect, use the following automation:
automation:
- id: one
alias: "Turn Hyperion effect on when light goes on"
trigger:
triggers:
- platform: state
entity_id: light.hyperion
to: "on"
action:
actions:
- action: light.turn_on
target:
entity_id: light.hyperion
@ -129,7 +129,7 @@ To have the lights playing an effect when pausing, idle or turn off a media play
```yaml
- alias: "Set hyperion effect after playback"
trigger:
triggers:
- platform: state
entity_id: media_player.plex
to: "off"
@ -139,7 +139,7 @@ To have the lights playing an effect when pausing, idle or turn off a media play
- platform: state
entity_id: media_player.plex.plex
to: "idle"
action:
actions:
- action: light.turn_on
target:
entity_id: light.hyperion
@ -151,11 +151,11 @@ To capture the screen on a USB capture device, when playing something on a media
```yaml
- alias: "Set hyperion when playback starts"
trigger:
triggers:
- platform: state
entity_id: media_player.plex
to: "playing"
action:
actions:
- action: switch.turn_on
target:
entity_id: switch.[instance]_component_usb_capture
@ -165,17 +165,17 @@ To toggle the LED device together with the light entity in order to turn light o
```yaml
- alias: "Turn LED device on when Hyperion light is activated"
trigger:
triggers:
- platform: state
entity_id:
- light.hyperion
from: "off"
to: "on"
condition:
conditions:
- condition: state
entity_id: switch.[instance]_component_led_device
state: "off"
action:
actions:
- action: switch.turn_on
target:
entity_id: switch.[instance]_component_led_device

View File

@ -92,7 +92,7 @@ To get the Estimated distance sensor to work, in most cases, it has to be calibr
```yaml
alias: "The black trash can has left the building"
mode: single
trigger:
triggers:
- platform: state
entity_id: sensor.black_trash_bin_estimated_distance
to: "unavailable"
@ -107,7 +107,7 @@ trigger:
minutes: 5
seconds: 0
above: 20
action:
actions:
- action: notify.notify
data:
message: "The black trash can has left the building"

View File

@ -38,13 +38,13 @@ You then need to consume that incoming information with the following automation
automation:
- id: this_is_the_automation_id
alias: "The optional automation alias"
trigger:
triggers:
- platform: event
event_type: ifttt_webhook_received
event_data:
action: call_service # the same action 'name' you used in the Body section of the IFTTT recipe
condition: []
action:
conditions:
actions:
- action: '{{ trigger.event.data.service }}'
target:
entity_id: '{{ trigger.event.data.entity_id }}'
@ -143,10 +143,10 @@ Add the *Then That* action. The below example sends a notification to the IFTTT
# Example configuration.yaml Automation entry
automation:
alias: "Startup Notification"
trigger:
triggers:
platform: homeassistant
event: start
action:
actions:
action: ifttt.trigger
data: {"event":"TestHA_Trigger", "value1":"Hello World!"}
```
@ -161,10 +161,10 @@ IFTTT can also be used in scripts and with templates. Here is the above automati
# Example configuration.yaml Automation entry
automation:
alias: "Startup Notification"
trigger:
triggers:
platform: homeassistant
event: start
action:
actions:
action: script.ifttt_notify
data:
value1: "HA Status:"

View File

@ -34,7 +34,7 @@ The `found_plate` event is triggered after OpenALPR has found a new license plat
# Example configuration.yaml automation entry
automation:
- alias: "Open garage door"
trigger:
triggers:
platform: event
event_type: image_processing.found_plate
event_data:
@ -55,7 +55,7 @@ The `detect_face` event is triggered after a Face entity has found a face.
# Example configuration.yaml automation entry
automation:
- alias: "Known person in front of my door"
trigger:
triggers:
platform: event
event_type: image_processing.detect_face
event_data:
@ -78,11 +78,11 @@ sensor:
...
automation:
- alias: "Scan for faces when motion detected"
trigger:
triggers:
- platform: state
entity_id: sensor.door_motion_sensor
to: "on"
action:
actions:
- action: image_processing.scan
target:
entity_id: image_processing.door

View File

@ -145,7 +145,7 @@ Increasing the default maximum message size (2048 bytes) could have a negative i
```yaml
template:
- trigger:
- triggers:
- platform: event
event_type: "imap_content"
id: "custom_event"
@ -196,15 +196,15 @@ The example below filters the event trigger by `entry_id`, fetches the message a
```yaml
alias: imap fetch and seen example
description: Fetch and mark an incoming message as seen
trigger:
triggers:
- platform: event
event_type: imap_content
event_data:
entry_id: 91fadb3617c5a3ea692aeb62d92aa869
condition:
conditions:
- condition: template
value_template: "{{ trigger.event.data['sender'] == 'info@example.com' }}"
action:
actions:
- action: imap.fetch
data:
entry: 91fadb3617c5a3ea692aeb62d92aa869
@ -231,7 +231,7 @@ The following example shows the usage of the IMAP email content sensor to scan t
```yaml
template:
- trigger:
- triggers:
- platform: event
event_type: "imap_content"
id: "custom_event"
@ -269,7 +269,7 @@ Below is the template sensor which extracts the information from the body of the
```yaml
template:
- trigger:
- triggers:
- platform: event
event_type: "imap_content"
id: "custom_event"
@ -318,7 +318,7 @@ The example below will only set the state to the subject of the email of templat
```yaml
template:
- trigger:
- triggers:
- platform: event
event_type: "imap_content"
id: "custom_event"

View File

@ -48,11 +48,11 @@ To send an alert if the CV pressure is too low or too high, consider the followi
```yaml
- alias: "Low CV Pressure Alert"
trigger:
triggers:
platform: numeric_state
entity_id: sensor.cv_pressure
below: 1.0
action:
actions:
- action: notify.pushbullet_notifier
data:
title: "Warning: Low CH Pressure"

View File

@ -88,15 +88,15 @@ will only occur if the `input_boolean` is on.
```yaml
automation:
alias: "Arriving home"
trigger:
triggers:
- platform: state
entity_id: binary_sensor.motion_garage
to: "on"
condition:
conditions:
- condition: state
entity_id: input_boolean.notify_home
state: "on"
action:
actions:
- action: notify.pushbullet
data:
title: ""

View File

@ -67,10 +67,10 @@ Because the state of a input button entity in Home Assistant is a timestamp, it
means we can use it in our automations. For example:
```yaml
trigger:
triggers:
- platform: state
entity_id: input_button.my_button
action:
actions:
- action: notify.frenck
data:
message: "My button has been pressed!"

View File

@ -117,10 +117,10 @@ automation:
# Example configuration.yaml entry
# Turns on bedroom light at the time specified.
automation:
trigger:
triggers:
platform: time
at: input_datetime.bedroom_alarm_clock_time
action:
actions:
action: light.turn_on
target:
entity_id: light.bedroom

View File

@ -127,10 +127,10 @@ input_number:
step: 1
automation:
- alias: "Bedroom Light - Adjust Brightness"
trigger:
triggers:
platform: state
entity_id: input_number.bedroom_brightness
action:
actions:
- action: light.turn_on
target:
entity_id: light.bedroom
@ -166,11 +166,11 @@ input_number:
step: 1
automation:
- alias: "Bedroom Light - Custom"
trigger:
triggers:
platform: state
entity_id: input_select.scene_bedroom
to: CUSTOM
action:
actions:
- action: light.turn_on
target:
entity_id: light.bedroom
@ -199,10 +199,10 @@ input_number:
# It sets the value slider on the GUI. This slides also had its own automation when the value is changed.
automation:
- alias: "Set temp slider"
trigger:
triggers:
platform: mqtt
topic: "setTemperature"
action:
actions:
action: input_number.set_value
target:
entity_id: input_number.target_temp
@ -212,10 +212,10 @@ automation:
# This second automation script runs when the target temperature slider is moved.
# It publishes its value to the same MQTT topic it is also subscribed to.
- alias: "Temp slider moved"
trigger:
triggers:
platform: state
entity_id: input_number.target_temp
action:
actions:
action: mqtt.publish
data:
topic: "setTemperature"
@ -250,11 +250,11 @@ input_number:
automation:
- alias: "turn something off after x time after turning it on"
trigger:
triggers:
platform: state
entity_id: switch.something
to: "on"
action:
actions:
- delay: "00:{{ states('input_number.minutes') | int }}:{{ states('input_number.seconds') | int }}"
- action: switch.turn_off
target:

View File

@ -135,10 +135,10 @@ The following example shows the usage of the `input_select.select_option` action
# Example configuration.yaml entry
automation:
- alias: "example automation"
trigger:
triggers:
platform: event
event_type: MY_CUSTOM_EVENT
action:
actions:
- action: input_select.select_option
target:
entity_id: input_select.who_cooks
@ -152,10 +152,10 @@ To dynamically set the `input_select` options you can call `input_select.set_opt
# Example configuration.yaml entry
automation:
- alias: "example automation"
trigger:
triggers:
platform: event
event_type: MY_CUSTOM_EVENT
action:
actions:
- action: input_select.set_options
target:
entity_id: input_select.who_cooks
@ -185,11 +185,11 @@ input_select:
# This automation script runs when a value is received via MQTT on retained topic: thermostatMode
# It sets the value selector on the GUI. This selector also had its own automation when the value is changed.
- alias: "Set Thermostat Mode Selector"
trigger:
triggers:
platform: mqtt
topic: "thermostatMode"
# entity_id: input_select.thermostat_mode
action:
actions:
action: input_select.select_option
target:
entity_id: input_select.thermostat_mode
@ -199,10 +199,10 @@ input_select:
# This automation script runs when the thermostat mode selector is changed.
# It publishes its value to the same MQTT topic it is also subscribed to.
- alias: "Set Thermostat Mode"
trigger:
triggers:
platform: state
entity_id: input_select.thermostat_mode
action:
actions:
action: mqtt.publish
data:
topic: "thermostatMode"

View File

@ -129,10 +129,10 @@ input_text:
automation:
- alias: "Bedroom Light - Custom"
trigger:
triggers:
platform: state
entity_id: input_select.scene_bedroom
action:
actions:
- action: input_text.set_value
target:
entity_id: input_text.bedroom

View File

@ -134,7 +134,7 @@ automation:
# Trigger an Insteon scene 25
- id: trigger_scene_25_on
alias: "Turn on scene 25"
action:
actions:
- action: insteon.scene_on
group: 25
```
@ -157,17 +157,17 @@ automation:
# 4 or 8 button remote with button c pressed
- id: light_on
alias: "Turn a light on"
trigger:
triggers:
- platform: event
event_type: insteon.button_on
event_data:
address: 1a2b3c
button: c
condition:
conditions:
- condition: state
entity_id: light.some_light
state: "off"
action:
actions:
- action: light.turn_on
target:
entity_id: light.some_light
@ -175,16 +175,16 @@ automation:
# single button remote
- id: light_off
alias: "Turn a light off"
trigger:
triggers:
- platform: event
event_type: insteon.button_on
event_data:
address: 1a2b3c
condition:
conditions:
- condition: state
entity_id: light.some_light
state: "off"
action:
actions:
- action: light.turn_on
target:
entity_id: light.some_light

View File

@ -46,7 +46,7 @@ intent:
description: List of domains that the entity supports.
required: false
type: list
action:
actions:
description: Defines an action to run to intents.
required: false
type: action
@ -109,7 +109,7 @@ conversation:
intent_script:
EventCountToday:
action:
actions:
- action: calendar.get_events
target:
entity_id: calendar.my_calendar

View File

@ -92,7 +92,7 @@ A Home Assistant `isy994_control` event is emitted for every "control" event in
```yaml
automation:
- alias: "turn off living room on double tap lightswitch"
trigger:
triggers:
platform: event
event_type: isy994_control
event_data:
@ -102,7 +102,7 @@ automation:
formatted: "On"
uom: "100"
prec: "0"
action:
actions:
action: light.turn_off
target:
entity_id: light.lr_track_lights_rear

View File

@ -229,11 +229,11 @@ A typical automation might look like the example below, which turns up the light
```yaml
- alias: kaleidescape_theater_lights_up
trigger:
triggers:
- platform: state
entity_id: sensor.kaleidescape_theater_media_location
from: content
action:
actions:
- action: scene.turn_on
target:
entity_id: scene.theater_lights

View File

@ -93,7 +93,7 @@ And an automation rule to breathe life into it:
```yaml
automation:
alias: "Keyboard all lights on"
trigger:
triggers:
platform: event
event_type: keyboard_remote_command_received
event_data:
@ -101,7 +101,7 @@ automation:
key_code: 107 # inspect log to obtain desired keycode
type: key_down # only trigger on key_down events (optional)
action:
actions:
action: light.turn_on
target:
entity_id: light.all
@ -124,10 +124,10 @@ Here's an automation example that plays a sound through a media player whenever
```yaml
automation:
- alias: "Keyboard Connected"
trigger:
triggers:
platform: event
event_type: keyboard_remote_connected
action:
actions:
- action: media_player.play_media
target:
entity_id: media_player.speaker
@ -136,12 +136,12 @@ automation:
media_content_type: music
- alias: "Bluetooth Keyboard Disconnected"
trigger:
triggers:
platform: event
event_type: keyboard_remote_disconnected
event_data:
device_name: "00:58:56:4C:C0:91"
action:
actions:
- action: media_player.play_media
target:
entity_id: media_player.speaker

View File

@ -211,12 +211,12 @@ Example automation using these IR codes to toggle a Sonoff plug.
- id: "1583339338363"
alias: "Panasonic On"
description: Turn on sonoff s20 relay
trigger:
triggers:
- entity_id: sensor.kira_wireless
platform: state
to: PanaOne
condition: []
action:
conditions: []
actions:
- device_id: 3628b4f34df943b3b721ead954cf3ca7
domain: switch
entity_id: switch.plug2_relay
@ -224,12 +224,12 @@ Example automation using these IR codes to toggle a Sonoff plug.
- id: "1584035716024"
alias: "Panaxonic Off "
description: Turn off sonoff s20 relay
trigger:
triggers:
- entity_id: sensor.kira_wireless
platform: state
to: PanaTwo
condition: []
action:
conditions: []
actions:
- device_id: 3628b4f34df943b3b721ead954cf3ca7
domain: switch
entity_id: switch.plug2_relay

View File

@ -243,12 +243,12 @@ Example automation configuration
```yaml
- alias: Single group address trigger
description: ''
trigger:
triggers:
- platform: knx.telegram
destination: 1/2/3
group_value_read: false
outgoing: false
condition: "{{ trigger.value == 0 }}"
conditions: "{{ trigger.value == 0 }}"
action: []
mode: single
```
@ -259,7 +259,7 @@ Example trigger data
```yaml
variables:
trigger:
triggers:
id: "0"
idx: "0"
alias: null
@ -368,21 +368,21 @@ address:
```yaml
# Example automation to update a cover position after 10 seconds of movement initiation
automation:
- trigger:
- triggers:
- platform: knx.telegram
# Cover move trigger
destination: "0/4/20"
action:
actions:
- delay: 0:0:10
- action: knx.read
data:
# Cover position address
address: "0/4/21"
- trigger:
- triggers:
- platform: homeassistant
event: start
action:
actions:
# Register the group address to trigger a knx_event
- action: knx.event_register
data:
@ -595,7 +595,7 @@ Let's pretend you have a binary sensor with the name `Livingroom.Switch` and you
```yaml
# Example automation.yaml entry
automation:
- trigger:
- triggers:
platform: numeric_state
entity_id: binary_sensor.livingroom_switch
attribute: counter
@ -605,20 +605,20 @@ automation:
- condition: state
entity_id: binary_sensor.cover_abstell
state: "on"
action:
actions:
- entity_id: light.hue_color_lamp_1
action: light.turn_on
- trigger:
- triggers:
platform: numeric_state
entity_id: binary_sensor.livingroom_switch
attribute: counter
above: 1
below: 3
condition:
conditions:
- condition: state
entity_id: binary_sensor.cover_abstell
state: "on"
action:
actions:
- entity_id: light.hue_bloom_1
action: homeassistant.turn_on
- entity_id: light.hue_bloom_2

View File

@ -45,24 +45,24 @@ These automations can be configured through the UI (see [device triggers](/docs/
automation:
- id: kodi_turn_on
alias: "Kodi: turn on"
trigger:
triggers:
- platform: device
device_id: !secret kodi_device_id
domain: kodi
entity_id: media_player.kodi
type: turn_on
action:
actions:
- action: script.kodi_turn_on
- id: kodi_turn_off
alias: "Kodi: turn off"
trigger:
triggers:
- platform: device
device_id: !secret kodi_device_id
domain: kodi
entity_id: media_player.kodi
type: turn_off
action:
actions:
- action: script.kodi_turn_off
```
@ -434,12 +434,12 @@ A example of a automation to turn up/down the volume of a receiver using the eve
alias: Kodi keypress
mode: parallel
max: 10
trigger:
triggers:
- platform: event
event_type: kodi_keypress
event_data:
entity_id: media_player.kodi_livingroom
action:
actions:
- choose:
- conditions:
- condition: template

View File

@ -164,12 +164,12 @@ To add a notification sound, icon, cycles, or priority override,
```yaml
- alias: "Send notification on arrival at school"
trigger:
triggers:
platform: state
entity_id: device_tracker.tom_mobile
from: "not_home"
to: "school"
action:
actions:
action: notify.my_lametric
data:
message: "Tom has arrived at school!"

View File

@ -76,10 +76,10 @@ If you're comfortable with YAML, this code could be used:
```yaml
alias: "Heat Meter manual update"
trigger:
triggers:
- platform: time
at: "23:30:00"
action:
actions:
- action: homeassistant.update_entity
target:
entity_id: sensor.heat_meter_heat_usage_gj

View File

@ -162,11 +162,11 @@ Trigger on a transponder event and ensure that the received code is in the given
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: lcn_transponder
condition: "{{ trigger.event.data.code in ['aabbcc', 'ddeeff', '112233'] }}"
action:
actions:
...
```
@ -245,7 +245,7 @@ receiver hardware is connected to module 7 in segment 0.
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: lcn_transmitter
event_data:
@ -270,7 +270,7 @@ any hardware module.
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: lcn_transponder
event_data:
@ -292,7 +292,7 @@ any hardware module.
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: lcn_fingerprint
event_data:
@ -314,7 +314,7 @@ any hardware module.
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: lcn_codelock
event_data:
@ -337,7 +337,7 @@ key `a1`.
```yaml
automation:
trigger:
triggers:
- platform: event
event_type: lcn_send_keys
event_data:

View File

@ -39,10 +39,10 @@ wake_on_lan: # enables `wake_on_lan` integration
# Enables the `lg_netcast` media player
automation:
- alias: "Turn On Living Room TV with WakeOnLan"
trigger:
triggers:
- platform: lg_netcast.turn_on
entity_id: media_player.lg_netcast_smart_tv
action:
actions:
- action: wake_on_lan.send_magic_packet
data:
mac: AA-BB-CC-DD-EE-FF

Some files were not shown because too many files have changed in this diff Show More