#-------------------------------------------
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
# Lighitng based on Nest Away status
#-------------------------------------------
# Nest ThermoStat https://amzn.to/2eAhB1k
# Uses the Nest thermostat to turn on lights and turn them off upstairs.

- alias: 'Upstairs Light Turn on'
  id: 439fc892-74ef-42b3-9d53-9474b9b9ae11
  trigger:
    - platform: event
      event_type: upstairs_light_on

  condition:
    - condition: state
      entity_id: sun.sun
      state: 'below_horizon'
    - condition: time
      before: '23:45'

  action:
    - service: light.turn_on
      entity_id: light.upstairs_lights

- alias: 'Upstairs Light Turn off'
  id: ee50f882-94b7-4cfc-bc2e-4a3e07ae08a8
  trigger:
    - platform: state
      entity_id: light.upstairs_lights
      to: 'on'
      for: '02:00:00'
  action:
    service: light.turn_off
    entity_id: light.upstairs_lights