######################################################################
##  Stuff that needs to happen at 10pm.
######################################################################

- alias: 'Shut down AMP in Living room'
  trigger:
    - platform: time
      at: '22:00:00'

  action:
    - wait_template: >-
       {{ not is_state('media_player.livingroomCC', 'playing') }}
    - wait_template: >-
       {{ not is_state('media_player.whole_house', 'playing') }}

    - service: script.speech_engine
      data_template:
        call_no_announcement: 1
        call_garage_check: 1
        call_window_check: 1

    - wait_template: >-
       {{ not is_state('media_player.livingroomCC', 'playing') }}
    - service: switch.turn_off
      entity_id: switch.living_room_amp
