Overall, it works pretty well, however I would like to be able to manually adjust the brightness. Whenever I change the brightness on the physical dimmer or HA, the blueprint sets it back to 30%. I’ve seen samples for lux meters, but this isn’t really applicable.
This is what I’ve cobbled together from the great examples
blueprint:
name: Turn Light ON and OFF MK
description: Turn light on when motion is detected, and turn it off when motion is not detected.
domain: automation
input:
motion_sensor:
name: Motion Sensor
description: Choose the motion sensor to control the lights.
selector:
entity:
domain: binary_sensor
device_class: motion
target_light:
name: Target Light
description: Choose the lights that you want to control.
selector:
target:
entity:
domain: light
delay_time:
name: Number of minutes
description: Number of minutes, after which the lights will turn off.
selector:
number:
min: 0
max: 10
step: 1
unit_of_measurement: "minutes"
start_time:
name: Start Time
default: "17:00:00"
description: Time this should start
selector:
time:
end_time:
name: End Time
description: Time this should end
default: "07:00:00"
selector:
time:
trigger:
- platform: state
entity_id: !input motion_sensor
from: 'off'
to: 'on'
- platform: state
entity_id: !input motion_sensor
from: 'on'
to: 'off'
for:
minutes: !input delay_time
condition:
- condition: time
# At least one of the following is required.
after: !input start_time
before: !input end_time
action:
- choose:
- conditions: "{{ trigger.to_state.state == 'on' }}"
sequence:
- service: light.turn_on
data:
brightness_pct: 30
target: !input target_light
default:
- service: light.turn_off
data: {}
target: !input target_light
mode: single
For clarification, you are saying the lights on, you have dimmer set manually to 90%, the BP detects movement and sets it back to 30%?
If that is the problem, and a condition of this BP running that the light is off, then it only donks with settings when it turns the light on.
Yes, it gets set back to 30% after I manually tweak it to a value besides 30%.
I’ve seen that and other ideas, but they all set brightness to a certain day / night value or light sensor. The other types of solutions are full overrides that I don’t really want either.
Is this your scenario then?
I want the value in the BP to change so that the next time it turns on, it has the new setting?
Doable but klunky. It would involve capturing the brightness every time it changes either manually or in HA and storing that as a helper, then referring to that helper when motion turns it on.
Frankly, anding a condition not to turn it on via motion if it is already on would be much better.
Not really. I’m doing a bad job of describing it - let me give it another shot.
Walk into dark room, turn on light to 30% (I’m a bit light sensitive)
Depending on what I’m doing I might need a bit more light or a lot more light, so I increase the brightness on the wall or HA to x percent (and it stays at that percentage)
Walk out of room, turn off
Hour later, walk back into room and turn on light to 30% again
An alternative is have another button or voice command that locks the light on for a couple of hours unless cancelled. Motion turns it on, you set brightness, you tell it to stay there a couple of hours. That either times out or you button/voice it off when done.
In my script, which was thrown off above, there is a condition that the script performs the inclusion once and until the motion sensor shows its absence, the brightness will not change, but also in general you can make a condition that if the light is already on, there is nothing not to do, but how to implement it when a lot can be used in one place light sources