Dimmer do not reset

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?

- id: '1622131442412'
  alias: Kitchen sensor
  description: Controls island light based on motion sensor
  trigger:
  - platform: state
    entity_id: binary_sensor.q_sensor_home_security_motion_detection_2
    to: 'on'
  condition: []
  action:
  - type: turn_on
    device_id: 64c62869599e47aab7789f9213cdebf0
    entity_id: light.kitchen_island
    domain: light
    brightness_pct: 100
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - timeout: 00:00:00
    wait_template: '{{  is_state(''binary_sensor.q_sensor_home_security_motion_detection_2'',
      ''off'')  }}'
  - type: turn_off
    device_id: 64c62869599e47aab7789f9213cdebf0
    entity_id: light.kitchen_island
    domain: light
  mode: restart

Add a condition that the lights must be off for the automation to run.

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.

Hi thanks for suggestion I changed as stated but now the light is closing even though it sees motion before the 1 minute time out.
see my mod below

- id: '1622131442412'
  alias: Kitchen sensor
  description: Controls island light based on motion sensor
  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:
  - type: turn_on
    device_id: 64c62869599e47aab7789f9213cdebf0
    entity_id: light.kitchen_island
    domain: light
    brightness_pct: 100
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - timeout: 00:00:00
    wait_template: '{{  is_state(''binary_sensor.q_sensor_home_security_motion_detection_2'',
      ''off'')  }}'
  - type: turn_off
    device_id: 64c62869599e47aab7789f9213cdebf0
    entity_id: light.kitchen_island
    domain: light
  mode: restart

yes turn on light if motion stay on if now motion after 1 minute turn off

@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
1 Like