alarm_triggered:
sequence:
- data:
data:
icon: https://goo.gl/xeetdy
vibration: 0,65,706,86,657,95,668,100"
message: "House alarm away!!!"
title: "Home Assistant"
service: notify.phones
- data:
entity_id: media_player.downstairs
volume_level: "1"
service: media_player.volume_set
- data_template:
entity_id: media_player.downstairs
message: -> 'Attention, the alarm has been triggered. The owner has been notified.'
service: media_player.alexa_tts
- data_template:
entity_id: media_player.upstairs
message: -> 'Attention, the alarm has been triggered. The owner has been notified.'
service: media_player.alexa_tts
- data:
entity_id: group.all_covers
service: cover.open_cover
- data:
entity_id: switch.counter_top
service: switch.turn_on
- data:
entity_id: switch.bedroom_light
service: switch.turn_on
- data:
entity_id: switch.dining_table
service: switch.turn_on
- data:
entity_id: switch.lr_ceiling_power
service: switch.turn_on
- data:
entity_id: switch.outside_light
service: switch.turn_on
- delay: 00:00:08
- data_template:
entity_id: media_player.downstairs
message: -> 'Attention, the alarm has been triggered. The owner has been notified.'
service: media_player.alexa_tts
- data_template:
entity_id: media_player.upstairs
message: -> 'Attention, the alarm has been triggered. The owner has been notified.'
service: media_player.alexa_tts
And my ‘welcome home’ script:
remco_home:
alias: Remco home
sequence:
- data:
entity_id: group.alarm
service: switch.turn_off
- data:
entity_id: switch.drapes_open
service: switch.turn_on
- wait_template: '{{ is_state(''sensor.broadlink_s1c_sliding_door'', ''open'') }}'
timeout: 00:30:00
- delay: 00:00:12
- data_template:
entity_id: media_player.downstairs
message: -> 'Hello Remco. Welcome home. Cherry is {% if is_state("device_tracker.zy223rkvxx",
"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
And when I unplug my cellphone from the charger in the morning:
remco_awake:
alias: Remco woke up
sequence:
- data:
entity_id: group.alarm
service: switch.turn_off
- data:
entity_id: switch.drapes_open
service: switch.turn_on
- 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
- wait_template: '{{ is_state(''sensor.broadlink_s1c_living_room_door'', ''open'')
}}'
timeout: 00:30:00
- delay: 00:00:05
- data_template:
entity_id: media_player.downstairs
message: -> 'Hello Remco. 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
Nice work!
I have imported the flow but getting messages about Home assistant connection failed with error: Connection to home assistant could not be established with config: DUMMY_URL
I have connected all of the server nodes, but not sure where to change the DUMMY URL and what it should be?
Found this thread and setting up was super easy, thanks to all the various contributors, so big thanks and have TTS working for various trigger activities now.
I’d like also to be able to a) stream radio and b) play local media files. Realising that b) is not yet possible, does anyone have examples of how to stream audio, initiated from HA? preferably through the media_player interface?
@inutilis@rclust@finity@Birdbrainuk
Try my version, here. I’ve never programmed in Python before so it’s not very efficient, but this should allow you to change the volume when the echo is in idle/standby, either by using the media_player.volume_set service call, or media_player.alexa_tts.
Note that when using the alexa_tss call, you’ll now need to specify the volume you want to set. Also note that when the echo is in standby, there will be an additional ~10 second delay before the TTS.
I need to replace the contents of the existing ‘alexa.py’ file with the contents from your repo.
Then from then on everything will work exactly the same except that on every TTS service call you will be required to specify the volume and there will be a 10 second delay while the echo device automatically plays a 10 second silent track and adjusts its volume to the selected volume?
And if you use the volume_set call then it will again automatically play a 10 second silent track while it adjusts the volume to the selected volume?
Basically, yes. It doesn’t play for ten seconds, but that’s just roughly how long it takes to queue up the song, play it, and then play the TTS message. This delay will only happen when the echo is in standby. One other thing… I have Prime Music Unlimited, so I’m honestly not sure if the song I chose is available for non-Unlimited members. Someone will just have to test it and see.
Has anyone been able to get alexa_tts working on a Multi-Room Audio group? I see the group in Home Assistant (media_player.downstairs) with all of the attributes, but the alexa_tts service call isn’t working.
Also thanks to @Justin_144 for the volume set code! I just updated to use your alexa.py file to set volume and it is working great.
Unfortunately the blank song doesn’t play unless you have Amazon Music Unlimited.
I tried another one and it comes up in the player but it doesn’t play. It just sits there with the song on the screen and I can’t do anything with the media player at all.
This is the message I used in the media_player.play_media service:
“Silence 5 Seconds” is the name of a song I found on amazon music for prime members (which I have).
If I tell Alexa to play the song “Silence 5 Seconds” by voice it immediately plays the correct song by the correct artist so Alexa knows the song I mean when I use voice control.
May be I’m not understanding how I designate a specific song in the service call but it worked (but told me it wasn’t included unless I had unlimited) when I tried it like this:
Well I think it is playing, but the thing you’re seeing with the media player is just what normally happens after a song ends. In my version of alexa.py, did you try changing the song to the “Silence 5 seconds” song (on line 507)? I briefly just tested it, and it seemed to work (the TTS calls with a “volume” value, that is). I’ll update my version in my repository to use the Silence 5 Seconds song.
If you can’t get it to work, try finding a silent track longer than 5 seconds (and let me know if you find one)