Setting volume on SONOS speaker in automation

Hello

I have an automation i use for waking up.
I would like my SONOS speaker to play a tune from spotify.

The problem is i can’t seem to adjust the volume.

service: media_player.play_media
target:
  entity_id: media_player.sovevaerelse
data:
  media_content_id: FV:2/14
  media_content_type: favorite_item_id
metadata:
  title: First Light
  thumbnail: https
  media_class: track
  children_media_class: null
  navigateIds:
    - {}
    - media_content_type: favorites
      media_content_id: ""
    - media_content_type: favorites_folder
      media_content_id: object.item.audioItem.musicTrack

When i add

volume_level: 0.1

under data i get an error:

 extra keys not allowed @ data['volume_level']. Got None 

All is fine when i remove the volume adjustment.
Any ideas?

There’s a service call dedicated to setting the volume level.

media_player.volume_set

Simply set the volume with media_player.volume_set prior to calling media_player.play_media.

Thank you.

1 Like

hi, I had the same issue - thanks now no more error messages but the volume is not changing even when I set it to 1

any ida?

volume_level: 1
media_player.volume_set
service: media_player.play_media
target:
entity_id: media_player.sonos_roam

data:
media_content_id: FV:2/16
media_content_type: favorite_item_id

metadata:
title: Sound Of The Police
thumbnail: >-
https://mosaic.scdn.co
media_class: playlist
children_media_class: null
navigateIds:
- {}
- media_content_type: favorites
media_content_id: “”
- media_content_type: favorites_folder
media_content_id: object.container.playlistContainer

media_player.volume_set is a service call. You appear to have used it like an additional option for media_player.play_media.

thank you now it is working