Correct, my goal is to basically “start the day with a default light brightness” which sounds very simple until you get down to it.
Because at night it gets set to 10% for feedings (into the night too so all the way up till 6 or 8 am), but then the first and subsequent times after the morning I’d like to revert it back to 80%.
However, if I decide to set it to 60% come 6 or 7pm and leave the automation to setting it to 80% during every motion I can never actually utilize the custom light setting as we go into the evening. So I have to get very specific about “when” I can actually set this default brightness level to get reset.
I actually ended up changing the automation to an input_boolean, it was getting overly complicated with the template checks and considerations… Now:
- condition: time
after: "11:00:00"
before: "23:00:00"
sequence:
- choose:
# FIRST trigger after 11:00am -> force default brightness, then mark initialized
- conditions:
- condition: state
entity_id: input_boolean.nursery_daytime_initialized
state: "off"
sequence:
- action: light.turn_on
target:
entity_id: light.nursery_lights
data:
brightness_pct: 80 # <-- "start of daytime" brightness
- action: input_boolean.turn_on
target:
entity_id: input_boolean.nursery_daytime_initialized
default:
# Subsequent triggers (same day after 11am) -> restore last light brightness
- action: light.turn_on
target:
entity_id: light.nursery_lights
I am still not clear on what the root problem you are trying to solve is.
If all you want to do is ensure that the light is bright in the morning, just create an automation to do that, something like this:
mode: single
alias: Bright Morning
triggers:
- trigger: state
entity_id:
- light.living_side
from:
- "off"
to:
- "on"
conditions:
- condition: time
after: "06:00:00"
before: "11:00:00"
actions:
- action: light.turn_on
target:
entity_id: light.living_side
data:
brightness_pct: 100
So if anyone turns on the light between 6 AM and 11 AM, the automation will fire and change the brightness to 100%.
The automation will only fire if the light starts “off”, so it won’t recursively trigger. If fixed times don’t work for you, you can use something like sunrise/sunset.
This is actually good to keep in mind, didn’t think about listening for the light to go from off to on during a time duration and modifying it like that. I’ll just clarify everything here since this has gotten off the path of the original thread’s question.
Purpose of this post (Resolved due to restrictions of hardware)
To see if I can set a light’s brightness prior to the light turning on (and without having to turn on the light) which seems to be hardware specific
My Specific Needs for this one Room
24/7 Motion Sensor Automation
10% Light setting from 11:00 p.m. → 11:00 a.m.
Start the first initial light turn on after 11:00 a.m. at 80%
Whether it’s via Alexa or motion detection
Only after 11:00 a.m. we want to restart at 80%
However, if someone after 11:00 a.m. were to set the light to 60% at 7pm or something continue using that 60% for every motion detection until 11:00 p.m.
(If we don’t have a choose: down there, we would then keep re-triggerring back to 80% on every motion detection)
Full automation for clarity:
alias: NURSERY - Light Control from Motion (both lights before 11pm, bookshelf only after)
mode: restart
max_exceeded: silent
trigger:
# Motion starts
- trigger: state
entity_id: binary_sensor.nursery_motion_sensor
from: "off"
to: "on"
# No motion for 30 minutes
- trigger: state
entity_id: binary_sensor.nursery_motion_sensor
from: "on"
to: "off"
for:
minutes: 30
action:
- choose:
# -----------------------
# MOTION ON
# -----------------------
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'on' }}"
- condition: numeric_state
entity_id: sensor.nursery_motion_sensor_illuminance
below: 10
sequence:
- choose:
# 11:00am -> 11:00pm
# Both lights in Nursery
#
# Goal: FIRST motion-trigger AFTER 11:00am sets a default brightness (80%).
# After that, we just turn the lights on normally (restoring last settings).
#
# How we detect "first after 11am" WITH a helper:
# - input_boolean.nursery_daytime_initialized == off -> first trigger after 11am
# - set it to on after we apply brightness_pct: 80
- conditions:
- condition: time
after: "11:00:00"
before: "23:00:00"
sequence:
- choose:
# FIRST trigger after 11:00am -> force default brightness, then mark initialized
- conditions:
- condition: state
entity_id: input_boolean.nursery_daytime_initialized
state: "off"
sequence:
- action: light.turn_on
target:
entity_id: light.nursery_lights
data:
brightness_pct: 80 # <-- "start of daytime" brightness
- action: input_boolean.turn_on
target:
entity_id: input_boolean.nursery_daytime_initialized
default:
# Subsequent triggers (same day after 11am) -> restore last light brightness
- action: light.turn_on
target:
entity_id: light.nursery_lights
# 11:00pm -> 11:00am (spans midnight): bookshelf lamp @ 10%
# BUT: don't switch if nursery lights are already on
- conditions:
- condition: or
conditions:
- condition: time
after: "23:00:00"
- condition: time
before: "11:00:00"
- condition: state
entity_id: light.nursery_lights
state: "off"
sequence:
- action: light.turn_on
target:
entity_id: light.nursery_bookshelf_lamp
data:
brightness_pct: 10
# -----------------------
# MOTION OFF (30 min)
# -----------------------
- conditions:
- condition: template
value_template: "{{ trigger.to_state.state == 'off' }}"
sequence:
- action: light.turn_off
target:
entity_id:
- light.nursery_lights
- light.nursery_bookshelf_lamp