Morning!
I'm using an ESPHome sendspin player in my bedroom. For my wake up routine, I have created a playlist in MA which plays a track and then a radio station. If I start the playlist from inside MA, it plays fine.
Inside home assistant I have 2 automations and one script (see below). The automations trigger the script based on if it's a workday or not. The script turns on some lights and then calls media_player.play_media with the playlist. The player then plays the track and starts the radio but stops playing after a short time (maybe 30s or so).
Automations:
alias: Wakeup workdays
description: ""
triggers:
- trigger: time
at: "05:50:00"
conditions:
- condition: state
entity_id: binary_sensor.workday_sensor
state:
- "on"
actions:
- action: script.wake_up
metadata: {}
data: {}
mode: single
alias: Wakeup free day
description: ""
triggers:
- trigger: time
at: "07:00:00"
conditions:
- condition: state
entity_id: binary_sensor.workday_sensor
state:
- "off"
actions:
- action: script.wake_up
metadata: {}
data: {}
mode: single
Script:
alias: Wake up
sequence:
- if:
- condition: state
entity_id: sun.sun
state:
- below_horizon
then:
- action: switch.turn_off
metadata: {}
target:
entity_id: switch.adaptive_lighting_sleep_mode_home
data: {}
- action: light.turn_on
metadata: {}
target:
entity_id: light.magic_areas_light_groups_bedroom_accent_lights
data: {}
- action: media_player.volume_set
metadata: {}
data:
volume_level: 0.25
target:
device_id: 74f854396f7001cafe782894ce6636a2
- action: media_player.play_media
target:
device_id: 74f854396f7001cafe782894ce6636a2
data:
media:
media_content_id: library://playlist/1
media_content_type: playlist
metadata:
title: Wakeup
thumbnail: null
media_class: playlist
children_media_class: track
navigateIds:
- {}
- media_content_type: music_assistant
media_content_id: playlists
- media_content_type: music
media_content_id: library://playlist/1
browse_entity_id: media_player.sendspin_bedroom
- if:
- condition: state
entity_id: input_select.mode
state: Absence
then:
- delay:
hours: 0
minutes: 30
seconds: 0
milliseconds: 0
- action: media_player.media_play_pause
metadata: {}
data: {}
target:
device_id: 74f854396f7001cafe782894ce6636a2
- action: light.turn_off
metadata: {}
data: {}
target:
entity_id:
- light.magic_areas_light_groups_bedroom_accent_lights
- light.magic_areas_light_groups_bedroom_overhead_lights
mode: single
icon: mdi:alarm