-
Notifications
You must be signed in to change notification settings - Fork 291
Automation examples
remcotim edited this page Mar 3, 2019
·
30 revisions
Send TTS message after a sensor change: (Be sure to use 'data_template:' when templating.)
scripts.yaml
doorbell:
alias: Doorbell
sequence:
- service: media_player.alexa_tts
data_template:
entity_id: media_player.downstairs
message: -> ' Ding-Dong. Someone is at the door.'
- service: media_player.alexa_tts
data_template:
entity_id: media_player.upstairs
message: -> ' Ding-Dong. Someone is at the door.'
automation.yaml
- id: washing_machine_finished
alias: Washing machine klaar
trigger:
- entity_id: sensor.washing_machine
platform: state
from: Washing
to: Not washing
action:
- service: media_player.alexa_tts
data_template:
entity_id: media_player.downstairs
message: -> 'Yo.. The washing machine is finished. Get off the couch.'
Templating also works in script/automation:
remco_home:
alias: Remco comes home
sequence:
- wait_template: '{{ is_state(''sensor.broadlink_s1c_sliding_door'', ''open'') }}'
timeout: 00:08:00
- delay: 00:00:12
- data_template:
entity_id: media_player.downstairs
message: -> 'Hello Remco. Welcome home. Cherry is {% if is_state("device_tracker.cherry",
"home") -%} also at home. {%- else -%} not at home. {%- endif %} The temperature
inside is {{ states("sensor.broadlink_sensor_temperature") }} degrees. And
outside it is {{ states("sensor.weather_temperature") }} degrees.'
service: media_player.alexa_tts
remco_woke_up:
sequence:
- data_template:
entity_id: media_player.upstairs
message: -> 'Hello Remco. Goodmorning. The temperature outside is {{ states("sensor.weather_temperature")
}} degrees. There will be {% if states("sensor.weather_precipitation") == '0.0' -%}
no rain today. {%- else -%} {{states("sensor.weather_precipitation")}} milimeter
of rain today, bring an umbrella. {%- endif %} Your first calendar item is;
{{ states("sensor.next_appoint_remco_message") }}, at {{ states("sensor.next_appoint_remco_tijd")
}}. Your Travel time to work is approximatly {{ states("sensor.waze_travel_time")
}} minutes if you take {{ states.sensor.waze_travel_time.attributes.route
}}. Have a nice day'
service: media_player.alexa_tts
First make a routine in the Alexa App.