Skip speakers that are unavailable for volume reset, fixes #177
This commit is contained in:
@ -322,6 +322,8 @@ script:
|
|||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.studio_quiet
|
entity_id: input_boolean.studio_quiet
|
||||||
state: 'off'
|
state: 'off'
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states('media_player.basement_echo_dot') not in ['unavailable','unknown'] }}"
|
||||||
then:
|
then:
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
@ -355,6 +357,8 @@ script:
|
|||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.studio_quiet
|
entity_id: input_boolean.studio_quiet
|
||||||
state: 'off'
|
state: 'off'
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states('media_player.basement_google_speaker') not in ['unavailable','unknown'] }}"
|
||||||
then:
|
then:
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
@ -399,31 +403,37 @@ script:
|
|||||||
# Living Room Echo Dot
|
# Living Room Echo Dot
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
value_template: >
|
value_template: "{{ states('media_player.living_room_echo_dot') not in ['unavailable','unknown'] }}"
|
||||||
{% set current = state_attr('media_player.living_room_echo_dot','volume_level') | float %}
|
|
||||||
{% set night = states('input_number.living_room_echo_dot_night_volume') | float %}
|
|
||||||
{% set day = states('input_number.living_room_echo_dot_day_volume') | float %}
|
|
||||||
{% if is_state('input_boolean.give_me_darkness','on') %}
|
|
||||||
{{ current != night }}
|
|
||||||
{% else %}
|
|
||||||
{{ current != day }}
|
|
||||||
{% endif %}
|
|
||||||
then:
|
then:
|
||||||
- service: media_player.volume_set
|
- if:
|
||||||
target:
|
- condition: template
|
||||||
entity_id: media_player.living_room_echo_dot
|
value_template: >
|
||||||
data:
|
{% set current = state_attr('media_player.living_room_echo_dot','volume_level') | float %}
|
||||||
volume_level: >
|
{% set night = states('input_number.living_room_echo_dot_night_volume') | float %}
|
||||||
|
{% set day = states('input_number.living_room_echo_dot_day_volume') | float %}
|
||||||
{% if is_state('input_boolean.give_me_darkness','on') %}
|
{% if is_state('input_boolean.give_me_darkness','on') %}
|
||||||
{{ states('input_number.living_room_echo_dot_night_volume') }}
|
{{ current != night }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ states('input_number.living_room_echo_dot_day_volume') }}
|
{{ current != day }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
then:
|
||||||
|
- service: media_player.volume_set
|
||||||
|
target:
|
||||||
|
entity_id: media_player.living_room_echo_dot
|
||||||
|
data:
|
||||||
|
volume_level: >
|
||||||
|
{% if is_state('input_boolean.give_me_darkness','on') %}
|
||||||
|
{{ states('input_number.living_room_echo_dot_night_volume') }}
|
||||||
|
{% else %}
|
||||||
|
{{ states('input_number.living_room_echo_dot_day_volume') }}
|
||||||
|
{% endif %}
|
||||||
# Master Bedroom Echo Dot
|
# Master Bedroom Echo Dot
|
||||||
- if:
|
- if:
|
||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.master_bedroom_sleeping
|
entity_id: input_boolean.master_bedroom_sleeping
|
||||||
state: 'off'
|
state: 'off'
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states('media_player.master_bedroom_echo_dot') not in ['unavailable','unknown'] }}"
|
||||||
then:
|
then:
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
@ -457,6 +467,8 @@ script:
|
|||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.kallen_sleeping
|
entity_id: input_boolean.kallen_sleeping
|
||||||
state: 'off'
|
state: 'off'
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states('media_player.kallen_bedroom_google_speaker') not in ['unavailable','unknown'] }}"
|
||||||
then:
|
then:
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
@ -508,6 +520,8 @@ script:
|
|||||||
- condition: state
|
- condition: state
|
||||||
entity_id: input_boolean.emma_sleeping
|
entity_id: input_boolean.emma_sleeping
|
||||||
state: 'off'
|
state: 'off'
|
||||||
|
- condition: template
|
||||||
|
value_template: "{{ states('media_player.emma_bedroom_google_speaker') not in ['unavailable','unknown'] }}"
|
||||||
then:
|
then:
|
||||||
- if:
|
- if:
|
||||||
- condition: template
|
- condition: template
|
||||||
|
Reference in New Issue
Block a user