Hi!
I’m fairly new to HA and am trying to set up a universal media player to group my Sonos players into one media player.
I got it working nicely, with the exception of the is_volume_muted attribute of the new player.
The mute function will mute both sonos players, but the is_volume_muted attribute of the the universal medial player is not updated for some reason.
I tested the template first in the template editor and then added it as a sensor => works as expected in both cases.
sensor:
- platform: template
sensors:
sonos_muted:
value_template: >
{{ (state_attr('media_player.wohnzimmer','is_volume_muted')
and state_attr('media_player.esszimmer','is_volume_muted')) }}
However, when I try to add the template to the universal media player’s attribute definiton for it’s is_volume_muted attribute, the state of the attribute is not evaluated (i.e., stays false, even if both players are muted)
Here’s the template in the universal media player definiton I currently have:
attributes:
is_volume_muted: >
"{{ (state_attr('media_player.wohnzimmer','is_volume_muted')
and state_attr('media_player.esszimmer','is_volume_muted')) }}"
unique_id: sonos_all
And the full definition for completeness:
media_player:
- platform: universal
name: sonos_all
children:
- media_player.wohnzimmer
- media_player.esszimmer
commands:
volume_up:
service: media_player.volume_up
data:
entity_id:
- media_player.wohnzimmer
- media_player.esszimmer
volume_down:
service: media_player.volume_down
data:
entity_id:
- media_player.wohnzimmer
- media_player.esszimmer
volume_mute:
service: media_player.volume_mute
data_template:
entity_id:
- media_player.wohnzimmer
- media_player.esszimmer
is_volume_muted: '{{ is_volume_muted }}'
volume_set:
service: media_player.volume_set
data_template:
entity_id:
- media_player.wohnzimmer
- media_player.esszimmer
volume_level: '{{ volume_level }}'
media_play:
service: media_player.media_play
data_template:
entity_id:
- media_player.wohnzimmer
- media_player.esszimmer
media_content_type: '{{ media_content_type }}'
media_content_id: '{{ media_content_id }}'
attributes:
is_volume_muted: >
"{{ (state_attr('media_player.wohnzimmer','is_volume_muted')
and state_attr('media_player.esszimmer','is_volume_muted')) }}"
unique_id: sonos_all
It’s really a minor issue, but it keeps bugging me - any hints would be appreciated