# Description:
#   Detect a light turning on and set brightness to 30% (76) if before 8am
#
# Written for:
#   @CCOSTAN
#
# Components:
#   automation
#   light
#
# License:
#   MIT
#
# Author:
#   Dale Higgs <@dale3h>
#
# PLEASE NOTE: THIS CONFIGURATION IS UNTESTED AND MAY CONTAIN ERRORS

- alias: detect_light_on_in_morning
  trigger:
    - platform: event
      event_type: state_changed
  condition:
    - condition: time
      before: '08:00:00'
    - condition: template
      value_template: "{{ trigger.event.data is not none }}"
    - condition: template
      value_template: "{{ trigger.event.data.entity_id is not none }}"
    - condition: template
      value_template: "{{ trigger.event.data.entity_id.split('.')[0] == 'light' }}"
    - condition: template
      value_template: "{{ trigger.event.data.new_state is not none }}"
    - condition: template
      value_template: "{{ trigger.event.data.new_state.state is not none }}"
    - condition: template
      value_template: "{{ trigger.event.data.new_state.state == 'on' }}"
    - condition: template
      value_template: "{{ trigger.event.data.new_state.attributes is not none }}"
    - condition: template
      value_template: "{{ trigger.event.data.new_state.attributes.brightness|default(0)|int > 76 }}"
  action:
    - service: light.turn_on
      data_template:
        entity_id: "{{ trigger.event.data.entity_id }}"
        brightness: 76

Add morning light detection for @CCOSTAN
Add morning light detection for @CCOSTAN
