How to modify state of boolean variable following action on physical light switch

Hi. I run Hassio 0.103.5 on Rasbperry Pi 3 with Lutron Caseta integration via Caseta Bridge Pro.

I have created some automations where lights are turned on for x minutes when entry door is opened at night. However, I don’t want the light to turn off when the timer times out if someone manually modified the light brightness directly from the wall dimmer (lutron caseta) during the count down. I thought of using some boolean variable that would turned on when someone use the physical switch and use that in my automation that turns the light off.

Does anyone know how to do that … or know of a better way of implementing this?

Thanks.

Can you share your automations to make sure we give you an adapted answer ?

Here are my current automations:

  1. turn light on upon door opening if light was off. And start 10 min timer
  2. turn light off upon time out

The current automation will turn light off even if in the meantime someone modified the light level using the physical on-wall dimmer.

- id: ‘xxxxx’
  alias: Éclairer Corridor RdC - Porte Avant Rdc Ouverte le Soir
  description: Allumer éclairage passage rdc à partir de 30 min avant le coucher de
    soleil ou jusqu’à 30 min après le lever du soleil
  trigger:
  - device_id: xxxxxx
    domain: binary_sensor
    entity_id: binary_sensor.openclose_2
    platform: device
    type: opened
  condition:
  - condition: or
    conditions:
    - before: sunrise
      before_offset: 00:30:00
      condition: sun
    - after: sunset
      after_offset: -00:30:00
      condition: sun
  - condition: state
    entity_id: light.couloir_rez_de_chaussee_lumieres_principales
    state: 'off'
  action:
  - data:
      transition: 2
    entity_id: light.couloir_rez_de_chaussee_lumieres_principales
    service: light.turn_on
  - entity_id: timer.hallway
    service: timer.start

- id: 'xxxxxxxx'
  alias: Éteindre éclairage corridor rdc 10 min après ouverture de la porte
  description: ''
  trigger:
  - event_data:
      entity_id: timer.hallway
    event_type: timer.finished
    platform: event
  condition: []
  action:
  - entity_id: light.couloir_rez_de_chaussee_lumieres_principales
    service: light.turn_off