Lights on when Neato is running

I’m trying to figure out the best way to have lights turn on when a Neato botvac is vacuuming and turn off when it stops. My only concern is that it could override another action or manual lights when it ends by turning off with a trigger for the botvac. I’d like to not adjust lights when it starts if they are already on and not turn off lights that were already on at the time the Botvac started.

12:05a - botvac starts, lights turn on to 15% brightness
X time later - botvac finishes, lights turn off again

or

12:05a - botvac starts, lights were already on so no adjustments made
X time later - botvac finishes, lights remain unaltered because they were on when started

Any thoughts/examples out there or is this a bit much?

You can just use a condition inside action or even outside actions. Just look at this example where I have used condition inside actions to check the state of light in the room where vacuum is cleaning and proceed only if in off state.

alias: Neato Automation
description: ''
mode: single
trigger:
  - platform: time
    at: '00:05:00'
condition: []
action:
  - service: vacuum.start
    target:
      entity_id: vacuum.robo_vacuum
  - condition: state
    entity_id: switch.living_room_light
    state: 'off'
  - service: light.turn_on
    target:
      entity_id: light.living_room_light
    data:
      brightness: 15
  - wait_for_trigger:
      - platform: state
        entity_id: vacuum.robo_vacuum
        to: returning
    continue_on_timeout: false
  - service: light.turn_off
    target:
      entity_id: light.living_room_light

Thank you so much for showing this. I’m curious if this modification looks good enough to do similarly, but to use a trigger for when Neato starts from its own app?

- id: '5628685000003'
  alias: Lights on for Basement Neato 
  trigger:
    - platform: state
      entity_id: vacuum.basement
      from:
        - "docked"
      to: "cleaning"
condition: []
action:
  - condition: state
    entity_id: light.basement_sitting_area_main_lights
    state: 'off'
  - service: light.turn_on
    target:
      entity_id: light.basement_sitting_area_main_lights
    data:
      brightness: 18
  - wait_for_trigger:
      - platform: state
        entity_id: vacuum.basement
        to: docked
    continue_on_timeout: false
  - service: light.turn_off
    target:
      entity_id: light.basement_sitting_area_main_lights

changing trigger wont be an issue with conditions.