oldmaker
(rosario moggia)
42
Hi.
I have tried your solution. But what is repeated is only the first mp3. The second is only played once.
This is my config:
- id: gg_food_waste
alias: gg_food_waste
trigger:
platform: time
at: '20:00:00'
condition:
condition: time
weekday:
- tue
- thu
- sat
action:
- repeat:
count: 2
sequence:
- data:
entity_id: media_player.gm_mini
volume_level: '0.3'
service: media_player.volume_set
- data:
entity_id: media_player.gm_mini
media_content_id: '/media/local/annunciazione.mp3'
media_content_type: audio/mp3
service: media_player.play_media
- wait_for_trigger:
- platform: state
entity_id: media_player.gm_mini
from: playing
to: idle
timeout:
seconds: 10
- data:
entity_id: media_player.gmini
media_content_id: '/media/local/conf_umido.mp3'
media_content_type: audio/mp3
service: media_player.play_media
mode: single
Any idea? Thanks
finity
43
the automation itself looks OK.
is there anything in the logs or in the automation trace to indicate why itās failing?
123
(Taras)
44
You are using repeat - count
with two iterations so hereās what that looks like. Steps 1-4 are the first iteration and steps 5-8 are the second one.
- Set volume
- Play annunciazione
- Wait for it to finish
- Play conf_umido
- Set volume
- Play annunciazione
- Wait for it to finish
- Play conf_umido
Notice how it waits for annunciazione to finish before it proceeds to play conf_umido.
In the second iteration, does it wait for conf_umido to finish playing before it proceeds to set volume and play annunciazione? No.
I suggest you fix that.
1 Like
finity
45
good catch. I missed the lack of delay on the second iteration to wait for the second audio to stop playing.
oldmaker
(rosario moggia)
46
Hi for all.
This works:
- id: gg_food_waste
alias: gg_food_waste
trigger:
platform: time
at: '12:37:00'
condition:
condition: time
weekday:
- sun
- thu
- sat
action:
- repeat:
count: 2
sequence:
- data:
entity_id: media_player.gm_mini
volume_level: '0.3'
service: media_player.volume_set
- data:
entity_id: media_player.gm_mini
media_content_id: '/media/local/annunciazione.mp3'
media_content_type: audio/mp3
service: media_player.play_media
- wait_for_trigger:
- platform: state
entity_id: media_player.gm_mini
from: playing
to: idle
timeout:
seconds: 10
- data:
entity_id: media_player.gm_mini
volume_level: '0.3'
service: media_player.volume_set
- data:
entity_id: media_player.gm_mini
media_content_id: '/media/local/conf_umido.mp3'
media_content_type: audio/mp3
service: media_player.play_media
- wait_for_trigger:
- platform: state
entity_id: media_player.gm_mini
from: playing
to: idle
timeout:
seconds: 10
mode: single
123
(Taras)
47
Hereās another way to do the same thing:
- id: gg_food_waste
alias: gg_food_waste
trigger:
- platform: time
at: '12:37:00'
condition:
- condition: time
weekday:
- sun
- thu
- sat
action:
- variables:
media: ['annunciazione','conf_umido']
- repeat:
count: 2
sequence:
- service: media_player.volume_set
target:
entity_id: media_player.gm_mini
data:
volume_level: '0.3'
- service: media_player.play_media
target:
entity_id: media_player.gm_mini
data:
media_content_id: '/media/local/{{ media[repeat.index-1] }}.mp3'
media_content_type: audio/mp3
- wait_for_trigger:
- platform: state
entity_id: media_player.gm_mini
from: playing
to: idle
timeout:
seconds: 10
mode: single
oldmaker
(rosario moggia)
48
Hi taras
This solution is very interesting.
The code is much more compact. When the files to be played are more than one, it is very useful.
Thanks
waank1
(Waank1)
49
Just commenting on an old post, there is a much easier way to do it now if anyone doesnāt know it, reply and I will explain.
nelzo
50
Trying to do something similar. Please explain.
waank1
(Waank1)
51
When you are writing your automation in actions, select repeat, select number of times do your task in in the task include a step to wait 90 seconds.