hi,
im trying to set up a script that will give a weather update and then play a radio station.
both scripts work yet when combined i only get the radio station triggered
morning:
sequence:
- service: tts.google_say
data_template:
entity_id: media_player.googlehome8448
message: >
Good morning. It's currently {{states.sensor.dark_sky_summary.state}} and {{states.sensor.dark_sky_temperature.state|round}} degrees in Derby. Today will be {{states.sensor.dark_sky_hourly_summary.state|replace(".", "")}}, with a high of {{states.sensor.dark_sky_daily_high_temperature.state|round}} degrees.
- service: media_player.play_media
entity_id: media_player.googlehome8448
data:
media_content_id: http://vis.media-ice.musicradio.com/RadioXUKMP3
media_content_type: audio/mp4
Try adding a delay after the tts to give it chance to be read - can’t quite get it working (it gives way too much detail when reading out the temp) but the tts followed by music does work with a delay
morning:
alias: Good Morning Nottinghamshire!
sequence:
- service: tts.google_say
data_template:
entity_id: media_player.kevs_home_mini
message: >
Good morning. It's currently {{states.sensor.yr_temperature|round}} degrees in Nottingham.
- alias: Pause a Bit
delay:
# supports seconds, milliseconds, minutes, hours
seconds: 15
- service: media_player.play_media
entity_id: media_player.kevs_home_mini
data:
media_content_id: http://20853.live.streamtheworld.com:3690/JACK_3_OXFORDSHIRE_HIAAC_SC
media_content_type: audio/mp4
BTW - how do you trigger from Google Assistant? Can’t quite suss that one.?
Not sure why the delay isn’t working for you, but the following works for me:-
The Initial delay is needed because it goes to a state of idle for about a second white starting the TTS, but by keeping that short and then having the wait_template means that the audio starts playing soon after the text has been spoken (this stream always takes forever to start, so the wait time has been minimised.
morning:
alias: Good Morning Nottinghamshire!
sequence:
- service: tts.google_say
data_template:
entity_id: media_player.kevs_home_mini
message: >
Good morning. It's currently {{states.sensor.yr_temperature.state|round}} degrees in Nottingham.
- alias: Pause a Bit
delay:
seconds: 2
- wait_template: "{{ is_state('media_player.kevs_home_mini', 'idle') }}"
- service: media_player.play_media
entity_id: media_player.kevs_home_mini
data:
media_content_id: http://20853.live.streamtheworld.com:3690/JACK_3_OXFORDSHIRE_HIAAC_SC
media_content_type: audio/mp4