Turn on lights - 2 conditions

Hi Guys.

I am trying to get an automation to turn on a scene when I trigger my motion detector. I would also like this automation to only work if the door lock has just been unlocked.

entity:
lock.hovedinngang - when unlocked it will have state “unlocked”
scene.stuekjokkengang_medium
binary_sensor.neo_coolcam_battery_powered_pir_sensor_sensor_2 - when triggered it will have state “on”

Anyone with a good idea? :smile:

Something like this:

automation:
  alias: 'Whatever you want'
  trigger:
    platform: state
    entity_id: binary_sensor.neo_coolcam_battery_powered_pir_sensor_sensor_2
    to: 'on'
  condition:
    - condition: state
      entity_id: lock.hovedinngang
      state: 'unlocked'
  action:
    service: homeassistant.turn_on
    entity_id: scene.stuekjokkengang_medium
1 Like

thank you @r1kkie - i will try that :slight_smile:

Note, above automation will always trigger when the “lock.hovedinngang” has the state unlocked. Doesnt matter how long it has been unlocked. If thats an issue I think that senario could be achived with an aditional input_boolean and automation.

Worked just perfect. The door lock is unlocked for about 15 secs - just enough time to trigger the motion detector.

Thank you so much!!! :slight_smile:

Great, your welcome.