Update Theater State Machine

This commit is contained in:
2022-05-16 14:21:29 -07:00
parent cbef127c84
commit 930d35a576

View File

@@ -12,6 +12,7 @@ input_select:
- Stopped - Stopped
- System - System
- Offline - Offline
- Unknown
initial: Idle initial: Idle
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -26,13 +27,8 @@ script:
mode: restart mode: restart
sequence: sequence:
- choose: - choose:
# Receiver Off (prevents error with source attribute not available # Receiver Off
# when receiver is off; normally this is set directly by the Turn-Off - conditions: "{{ is_state('media_player.living_room_receiver', 'off') }}"
# to Idle automation)
- conditions:
- condition: state
entity_id: media_player.living_room_receiver
state: 'off'
sequence: sequence:
- service: input_select.select_option - service: input_select.select_option
target: target:
@@ -61,13 +57,12 @@ script:
option: Paused option: Paused
- conditions: - conditions:
- condition: or - condition: and
conditions: conditions:
# Not sure why this doesn't work with shorthand notation?
- condition: template - condition: template
value_template: "{{ is_state('media_player.living_room_roku', 'stopped') }}" value_template: "{{ is_state('media_player.living_room_roku', 'on') }}"
- condition: template - condition: template
value_template: "{{ is_state('media_player.living_room_roku', 'idle') }}" value_template: "{{ not is_state('input_select.ht_player_state', 'Idle') }}"
sequence: sequence:
- service: input_select.select_option - service: input_select.select_option
target: target:
@@ -75,6 +70,22 @@ script:
data: data:
option: Stopped option: Stopped
- conditions: "{{ is_state('media_player.living_room_roku', 'off') }}"
sequence:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Idle
# Fallback to Unknown State
default:
- service: input_select.select_option
target:
entity_id: input_select.ht_player_state
data:
option: Unknown
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Media Player Automations # Media Player Automations
automation: automation: