The crux of my question is can I leave the state out of a scene if I only want to change attributes and not the state of a device?
I don’t seem to be able to, at least with the media_player.
I am trying to set a series of volume profiles for multiple speakers (ie Sonos, Bose in my case). i.e Low / Medium / High volume scenes.
I have been trying to do this with scene. But I cannot remove the state: playing from the scene and just set the volume. I am only showing 3 speakers here, I actually have 6 and I they may not all be playing.
Here is the scene, as soon as I remove state: playing the configuration wont compile. and the configuration check yields
Invalid config for [scene]: State for media_player.soundtouch_kitchen should be a string for dictionary value @ data[‘states’][0][‘entities’]. Got None. (See /config/configuration.yaml, line 59).
- id: "1613852807869"
name: Bose Volume Low
entities:
media_player.soundtouch_kitchen:
volume_level: 0.15
state: playing
media_player.soundtouch_kitchen_bar:
volume_level: 0.22
state: playing
media_player.soundtouch_lounge:
volume_level: 0.20
state: playing
Here’s the script that does provide a solution. It works well even for devices that a off.
Script also sets an Input number to track the volume preset in the frontend.
soundtouch_volume_low:
alias: Bose Volume Low
sequence:
- service: media_player.volume_set
data:
entity_id: media_player.soundtouch_kitchen
volume_level: 0.15
- service: media_player.volume_set
data:
entity_id: media_player.soundtouch_kitchen_bar
volume_level: 0.22
- service: media_player.volume_set
data:
entity_id: media_player.soundtouch_lounge
volume_level: 0.2
- service: input_number.set_value
data:
entity_id: input_number.group_volume
value: 1