Hi everyone,
I’ve created several automations that trigger alerts when Frigate detects a person. These automations, like the below one, send a voice message and display an image on my Google media player in the kitchen.
The issue I’m facing is that, after the alert is played, the media player doesn’t resume whatever was playing before (e.g., music or radio). I’d like to avoid interrupting the current playback permanently.
I believe the right approach would be to:
- Save the current state of the media player before the alert (e.g., what was playing and its type).
- Play the alert message and image.
- Restore the previous playback once the alert is finished.
However, I’m not sure how to implement this properly in YAML. I tried using media_player.media_seek, but it seems my device doesn’t support it.
Has anyone solved this issue or found a workaround to resume playback after an alert?
Thanks in advance!
actions:
- choose:
- conditions:
- condition: trigger
id:
- cancello
sequence:
- data:
volume_level: 0.7
target:
entity_id: media_player.cucina
action: media_player.volume_set
- data:
cache: false
entity_id: media_player.cucina
message: Attenzione, un intruso è stato avvistato al cancello
action: tts.cloud_say
- delay:
hours: 0
minutes: 0
seconds: 4
milliseconds: 0
- data:
media_content_id: >
{{ "http://192.168.1.130:8123" +
state_attr("image.cancello_person", "entity_picture") }}
media_content_type: image/jpeg
target:
entity_id: media_player.cucina
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- data: {}
target:
entity_id: media_player.cucina
action: media_player.turn_off
- data: {}
action: tts.clear_cache