我是用播放器播放tts的状态,控制下一段播报内容,即使等待播放器状态为空闲(上一段tts播放结束),再执行下一段tts的播放
action:
- service: sonos.snapshot
data:
entity_id: media_player.sonos_one
- service: media_player.volume_set
data:
volume_level: 0.6
target:
entity_id:
- media_player.sonos_one_dlna
- service: tts.edge_tts_say
data:
entity_id: media_player.sonos_one_dlna
message: 现在是古诗词时间:
cache: true
options:
voice: zh-CN-XiaoxiaoNeural
rate: +0%
volume: +00%
- delay:
hours: 0
minutes: 0
seconds: 3
milliseconds: 0
- service: tts.edge_tts_say
data:
entity_id: media_player.sonos_one_dlna
message: >-
{{ state_attr('sensor.short_part_of_poem','origin')['title'] }}。作者{{
state_attr('sensor.short_part_of_poem','origin')['dynasty'] }} • {{
state_attr('sensor.short_part_of_poem','origin')['author'] }}。
options:
voice: zh-CN-XiaoyiNeural
rate: "-10%"
volume: +00%
- wait_for_trigger:
- platform: state
entity_id:
- media_player.sonos_one_dlna
to: idle
for:
hours: 0
minutes: 0
seconds: 2
continue_on_timeout: false
- service: tts.edge_tts_say
data:
entity_id: media_player.sonos_one_dlna
message: "{{ state_attr('sensor.short_part_of_poem','origin')['content'] }}"
options:
voice: zh-CN-XiaoyiNeural
rate: "-20%"
volume: +00%
- wait_for_trigger:
- platform: state
entity_id:
- media_player.sonos_one_dlna
to: idle
for:
hours: 0
minutes: 0
seconds: 3
continue_on_timeout: false
- service: sonos.restore
data:
entity_id: media_player.sonos_one
|