Hi I have the following automation which turns on lights when motion and off after 1 minute of no motion.
Problem is I set brightness level to 100% which I want when I walk in the room. But if I decide to dim the lights they will go back to 100% when it senses motion agian.
So how do I set it to 100% when I walk in room and if I manually dim to stay to new level?
im not very good at reading automations from yaml file, but from what i understand you turn on the light, wait one minute and then check if is still motion, if no motion then you turn off the lights, but if there is still motion will it check again after one minute?
about your question just had a condition like Troon is saying.
@aqus555 I thought about this more. I’d use an input_number and three automations. I don’t have any dimmable lights — I’m assuming here that brightness_pct is visible as an attribute:
alias: "Kitchen lights on"
trigger:
- platform: state
entity_id: binary_sensor.q_sensor_home_security_motion_detection_2
to: 'on'
condition:
- condition: state
entity_id: light.kitchen_island
state: 'off'
action:
- service: light.turn_on
data:
entity_id: light.kitchen_island
brightness_pct: "{{ states('input_number.kitchen_light_level')|int }}"
alias: "Kitchen lights off after 1 min"
trigger:
- platform: state
entity_id: binary_sensor.q_sensor_home_security_motion_detection_2
to: 'off'
for:
minutes: 1
condition:
- condition: state
entity_id: light.kitchen_island
state: 'on'
action:
- service: input_number.set_value
data:
entity_id: input_number.kitchen_light_level
value: "{{ state_attr('light.kitchen_island', 'brightness_pct')|int }}"
- service: light.turn_off
data:
entity_id: light.kitchen_island
alias: "Kitchen lights level reset after 10 mins"
trigger:
- platform: state
entity_id: binary_sensor.q_sensor_home_security_motion_detection_2
to: 'off'
for:
minutes: 10
- platform: homeassistant
event: start
action:
- service: input_number.set_value
data:
entity_id: input_number.kitchen_light_level
value: 100