Add sonos master indicators

This commit is contained in:
2020-05-01 19:08:07 +03:00
parent 50123f8726
commit 05f46d25cd
3 changed files with 28 additions and 4 deletions

View File

@@ -114,21 +114,27 @@
service_data:
playlist: "Retro"
- type: custom:button-card
template: xs
template:
- xs
- with_state_indicator
entity: script.sonos_join_bedroom
name: Bedroom
icon: mdi:speaker-multiple
tap_action:
action: toggle
variables:
state_indicator_id: binary_sensor.sonos_is_bedroom_master
- type: custom:button-card
template:
- xs
- with_state_background
- with_state_indicator
entity: script.sonos_join_tv
icon: mdi:speaker-multiple
name: TV
tap_action:
action: toggle
variables:
state_indicator_id: binary_sensor.sonos_is_living_room_master
- type: horizontal-stack
cards:

View File

@@ -292,19 +292,27 @@
- type: horizontal-stack
cards:
- type: custom:button-card
template: default
template:
- small
- with_state_indicator
entity: script.sonos_join_bedroom
name: Sonos from Bedroom
icon: mdi:speaker-multiple
tap_action:
action: toggle
variables:
state_indicator_id: binary_sensor.sonos_is_bedroom_master
- type: custom:button-card
template: default
template:
- small
- with_state_indicator
entity: script.sonos_join_tv
icon: mdi:speaker-multiple
name: Sonos from TV
tap_action:
action: toggle
variables:
state_indicator_id: binary_sensor.sonos_is_living_room_master
- type: custom:decluttering-card
template: sonos_media_player

View File

@@ -28,6 +28,16 @@ binary_sensor:
{% else %}
False
{% endif %}
sonos_is_bedroom_master:
friendly_name: Sonos is Bedroom master
value_template: >-
{% set group = state_attr('media_player.master_bedroom', 'sonos_group') %}
{{ group|length > 1 and group[0] == 'media_player.master_bedroom' }}
sonos_is_living_room_master:
friendly_name: Sonos is Living room master
value_template: >-
{% set group = state_attr('media_player.master_bedroom', 'sonos_group') %}
{{ group|length > 1 and group[0] == 'media_player.living_room' }}
script:
sonos_join_bedroom: