Change a Switch state on motion if lux is below xxx

Tags: #<Tag:0x00007f32694c7b40>

Hi,

I currently have an automation to turn on a light if motion is detected

- alias: Turn on Rear Hall Lamps when there is movement
  trigger:
    platform: state
    entity_id: binary_sensor.rear_hall_pir_sensor
    to: 'on'
  action:
    service: switch.turn_on
    entity_id: switch.rear_hall_lamps_main_switch
- alias: Turn off Rear Hall Lamps 3 minutes after last movement
  trigger:
    platform: state
    entity_id: binary_sensor.rear_hall_pir_sensor
    to: 'off'
    for:
      minutes: 3
  action:
    service: switch.turn_off
    entity_id: switch.rear_hall_lamps_main_switch

I would like to incorporate the lux from entity: sensor.rear_hall_pir_luminance

so the light only comes on if the lux is below say 10

,many thanks

Add a condition if lux is less than 10

cheers ill give it a go