#Start playing Music Assistant playlist on specific volume at specific time on specific weekday

1 messages Β· Page 1 of 1 (latest)

frozen totem
#

Title says it all :).

I managed to set "play <playlist>" on <time>, but didn't find a way to set the <volume> or <weekday>.

The goal is to use Tidal playlists or radio stations as a morning alarm, so I don't want it to go off every day, and I don't want it to blast on high volume in case I didn't lower the volume of my speaker the day before.

frozen totem
#

The music will be played on a chromecast device

twin veldt
# frozen totem Title says it all :). I managed to set "play <playlist>" on <time>, but didn't...

something like this?

mode: single
triggers:
  - trigger: time
    at: "07:30:00"
conditions:
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
actions:
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.4
    target:
      entity_id: media_player.MEDIA_PLAYER_NAME_HERE
  - action: music_assistant.play_media
    metadata: {}
    data:
      media_id: YOUR_PLAYLIST_NAME_HERE
      media_type: playlist
    target:
      entity_id: media_player.MEDIA_PLAYER_NAME_HERE
#

obviously adjust
media_player.MEDIA_PLAYER_NAME_HERE
and
YOUR_PLAYLIST_NAME_HERE
and your timings

my example sets to 40% volume and triggers at 0730 and checks to see if its a weekday

#

can adapt as needed

frozen totem
#

Will give it a try, thank you

twin veldt
#

good luck

frozen totem
#

I've never actually added an automation in that way

#

Where do I save/enter it?

twin veldt
#

when you add automation in the top right you can switch to yaml mode

#

you can switch back to the visual editor after

frozen totem
#

Ahh πŸ‘Œ

twin veldt
#

easier to paste yaml then screenshots πŸ˜›

frozen totem
#

So, it somewhat works

#

It starts playing but adjusting the volume doesnt always work

#

Im actually playing on my android tv that needs to boot up first

#

So I think it tries to adjust the volume when it's still starting up

#

Android tv box is connected to the tv, which is connected to my soundbar

twin veldt
#

ah so your doing:
switch on
set volume
play

#

a lazy solution would be to stick a "wait" for a few seconds between switch on and volume set

#

you could have a "wait for availablity" but could also bund a 10 second timer in there and we done with it

frozen totem
#

Yeah pretty much

#

You got yaml for that? πŸ™ˆ

twin veldt
#

you can do it on the visual editor easily

#

then just drag it to the right place in the automation

frozen totem
#

I have 5 nvidia shields according to HA

twin veldt
#

another lazy solution might be to duplicate the set volume action after the play action. may mop it up there

twin veldt
frozen totem
twin veldt
#

will wake you up at least

#

its likely no sound would make it out before the command was sent

frozen totem
frozen totem
#

Identified the real shield from the logs πŸ‘

twin veldt
#

when you expose it to music assistant it will generate its own player to use for the one you select then will apear in the dropdown box on the visual editor

frozen totem
#

Yes, but that one doesnt have an on/off switch

#

The actual device does, and thats the one I need

twin veldt
#

for switching it on yes but for the playing you want to use the music assistant one

frozen totem
#

Ye

#

I named the MA one differently

twin veldt
#

getting there anyhow

frozen totem
#

It's not letting me pick actions

#

Could you put in yaml please? For some reason that does work

twin veldt
#

can you post the yaml you have currently

#

based on my example from earlier something like this is what you want

#
mode: single
triggers:
  - trigger: time
    at: "07:30:00"
conditions:
  - condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
actions:
  - action: media_player.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: media_player.MEDIA_PLAYER_NAME_HERE
  - delay:
      hours: 0
      minutes: 0
      seconds: 10
      milliseconds: 0
  - action: media_player.volume_set
    metadata: {}
    data:
      volume_level: 0.4
    target:
      entity_id: media_player.MEDIA_PLAYER_NAME_HERE
  - action: music_assistant.play_media
    metadata: {}
    data:
      media_id: YOUR_PLAYLIST_NAME_HERE
      media_type: playlist
    target:
      entity_id: media_player.MEDIA_PLAYER_NAME_HERE
#

its the same except it sends a turn on command to the media player and then waits 10 seconds before setting volume and sending play

#

can adapt as needed

frozen totem
#

Great, thanks!

gray socket
#

This thread made me remember an automation that I set up years ago. Its sole purpose is to set an Echo Dot's volume level to a "default" level; this happens daily.
I went to Automations to see how I set it up but couldn't find it. Knowing that this action still happens, I opened the Alexa app and found it in Routines.
I started automating with Alexa back in 2019 when I bought my first Echo Dot. The Routine has been enabled for nearly five years...

#

@frozen totem You might consider incorporating another angle for the automation. When media_player.MEDIA_PLAYER_NAME_HERE's state changes from Unavailable to Available then set the volume level. This could be a "standalone" option to ensure the device always starts at the level you want.
You may also consider revising the above example to wait for the entity to become available instead of the 10-second delay.

twin veldt
#

yeah waiting for availability is the fancy (and probably correct) way of doing it but as it was said that sometimes it did seem to load quick enough to accept the volume change it might lead to intermittent behaviour (yeah yeah you put in a timeout). but given its purpose here is an alarm clock. sticking a 10 second delay on it to be sure is simple and effective

#

i have a script that resets my alexa's and voice-pe's to normal volume too. its main puspoe is being called after emergancy alerts are issued at max volume all over the house

#

for example if someone tries messing with the EV charger on the driveway the whole house alarms inside and out and yells about unauthorised access attempt. whilst all the lights start flashing. its designed more to scare people off more then anything else

#

that reminds me... i need to update that with the new bulbs that got put in recently

frozen totem
#

yeah, so after testing some more looks like changing the volume doesn't work at all

#

either with time delay or with waiting on status from the android tv

#

I should probably get a real speaker anyway

gray socket
#

Hmm. Interesting. I just tried two media_player entities and their volume did not work either. media_player.xbox_plex and media_player.xbox. Everything else seems to work for them. I'm sure their probably just integration issues. (Plex and Xbox)
You mentioned you're using Nvidia Shields. Maybe @distant trellis might know a workaround. I think he runs Shields.

frozen totem
#

Why is this marked as resolved now?

#

I'd like to know if there's a workaround please @distant trellis πŸ™‚

twin veldt
#

you may have to set volume on both the "real" device entity AND the "music assistant" entity for the media players.
theres also sopme settings within music assistant for the player with volume controls. you might need to play with them?

frozen totem