close_garage:
  sequence:
  - condition: state
    entity_id: cover.cargo_bay
    state: open
  - service: cover.close_cover
    entity_id: cover.cargo_bay
open_garage:
  sequence:
  - condition: state
    entity_id: cover.cargo_bay
    state: closed
  - service: cover.open_cover
    entity_id: cover.cargo_bay

sunset_garage_open:
  sequence:
  - condition: state
    entity_id: group.garage_doors
    state: 'on'
  - service: script.driveway_all_on

turn_on_ha_speaker:
  sequence:
  - condition: state
    entity_id: input_boolean.audible_notifications
    state: 'off'
  - service: input_boolean.turn_on
    entity_id: input_boolean.audible_notifications
  

inside_all_on:
  sequence:
  - service: scene.turn_on
    entity_id: scene.normal_livingroom_lighting
  - service: scene.turn_on
    entity_id: scene.normal_kitchen_lighting
  - service: switch.turn_on
    entity_id: switch.fireplace_lights
  - service: switch.turn_on
    entity_id: switch.croft_light
  - service: switch.turn_on
    entity_id: switch.rail_lights
  - service: scene.turn_on
    entity_id: scene.jeff_light_on
  
inside_all_off:
  sequence:
  - data:
      entity_id: light.tower_lamp_4
    service: light.turn_off
  - data:
      entity_id: light.living_room_lamp
    service: light.turn_off
  - data:
      entity_id: light.front_door_lamp
    service: light.turn_off
  - data:
      entity_id: light.kitchen_cabinets
    service: light.turn_off
  - data:
      entity_id: light.kitchen_cabinet_lights
    service: light.turn_off
  - entity_id: switch.fireplace_lights
    service: switch.turn_off
  - entity_id: switch.upstairs
    service: switch.turn_off
  - entity_id: light.jeff_lamp
    service: light.turn_off

all_fans_off:
  sequence:
  - service: group.turn_off
    entity_id: group.all_fans

all_fans_on:
  sequence:
  - service: group.turn_on
    entity_id: group.all_fans

family_is_home:
  sequence:
  - condition: state
    entity_id: sensor.family_status
    state: Away
  - service: mqtt.publish
    data:
      topic: house/family/status
      payload_template: Home
      retain: true
  - service: script.vacation_canceled
  - service: script.appliances_on
  - service: script.standby
  - service: script.washer_finished_notification_audible
  - service: alarm_control_panel.aarlo_set_mode
    data:
      entity_id: alarm_control_panel.aarlo_ah_base_station
      mode: 'home'
  - service: script.family_is_home

family_is_away:
  sequence:
  - condition: state
    entity_id: sensor.family_status
    state: Home
  - service: mqtt.publish
    data:
      topic: house/family/status
      payload_template: Away
      retain: true
  - service: script.appliances_off
  - service: scene.turn_on
    entity_id: scene.lights_out
  - service: script.security_check_garage
  - service: script.security_check_zones
  - service: script.lockdown
  - service: script.lockdown_issue
  - service: script.all_fans_off
  - service: alarm_control_panel.aarlo_set_mode
    data: 
      entity_id: alarm_control_panel.aarlo_ah_base_station
      mode: 'Armed'
  - service: script.family_is_away

driveway_on:
  sequence:
  - condition: state
    entity_id: sun.sun
    state: below_horizon
  - data:
      entity_id: switch.driveway_light
    service: switch.turn_on
  - data:
      entity_id: light.side_door_light
    service: light.turn_on

driveway_off:
  sequence:
  - delay:
      seconds: 120
  - condition: state
    entity_id: binary_sensor.side_door
    state: 'off'
  - condition: state
    entity_id: binary_sensor.garage_door
    state: 'off'
  - service: switch.turn_off
    entity_id: switch.driveway_light
  - service: light.turn_off
    entity_id: light.side_door_light

chromecast_media_stop:
  sequence:
  - service: media_player.media_stop
    data:
      entity_id: media_player.ha_speaker

appliances_on:
  sequence:
  - service: switch.turn_on
    data:
      entity_id: switch.box_fans

appliances_off:
  sequence:
  - data:
      entity_id: switch.incense
    service: switch.turn_off
  - data:
      entity_id: switch.artemis
    service: switch.turn_off