#
#
# Garage
#
############


- alias: Close Garage at lights out
  trigger:
  - platform: time
    hours: 22
    minutes: 30
    seconds: 0
  condition:
  - condition: state
    entity_id: binary_sensor.garage_door
    state: 'on'
  action:
  - service: script.close_garage

- alias: Garage Open At Sunset
  trigger:
  - platform: sun
    event: sunset
  condition:
  - condition: state
    entity_id: binary_sensor.garage_door
    state: 'on'
  action:
  - service: script.driveway_on

- alias: Garage Opening Driveway Lights On
  trigger:
  - platform: state
    entity_id: binary_sensor.garage_door
    from: 'off'
    to: 'on'
  condition:
    - condition: state
      entity_id: sun.sun
      state: 'below_horizon'
  action:
  - service: script.driveway_on

- alias: Garage Closing Driveway Lights Off
  trigger:
  - platform: state
    entity_id: binary_sensor.garage_door
    from: 'on'
    to: 'off'
  - platform: state
    entity_id: binary_sensor.side_door
    from: 'on'
    to: 'off'
  action:
  - service: script.turn_on
    entity_id: script.driveway_off

# - alias: Garage Motion after Sunset
#   trigger:
#   - platform: state
#     entity_id: binary_sensor.garage_motion
#     from: 'off'
#     to: 'on'
#   condition:
#     - condition: state
#       entity_id: sun.sun
#       state: 'below_horizon'
#   action:
#   - service: notify.jeff_ios
#     data:
#       message: 'Motion: Garage'