Aqara FP2 trigger behaviour is not "BECOME occupied" but "IS (already) occupied"

My problem: I have the usual automation:

Trigger: FP2 become occupied
Condition: FP2 lux below XX
Action: Turn the lights on

If I’m still in the room, and I’m manually turn off the lights, the automation is immediately launched by the sensor and the lights are turned back on.

Any idea how to solve this, so to be able to set the lights manually how I want when I’m in the room? (and not trigger the sensor of course).

Thank you,

Hello, just gonna drop this awesome blueprint I use for every light in my house.
It might just fit your requirements. It also doesn’t just turn on because you triggered the sensor again after manually turning it off (until the delay time is expired at least).

Thank you very much, I’m impressed about the complexity of this blueprint, I’ll test it.

In the meantime I found a manual solution, by manually disabling the automation before changing the lights manually. This automation is automatically re-enabled when I’m leaving the room.

If you trigger by the state the light should not go on again. I use something like this in the trigger:

    - entity_id: binary_sensor.presence_fp2
      from: "off"
      platform: state
      to: "on"

As long as the fp2 says the room is occupied (which should be the case when you are in) it won’t trigger again and the lights stay on the state you gave them manually.

Thank you, but I’m not sure I fully understand (I don’t use yaml, only visual editor).

Do you mean to replace trigger “device” with trigger “state”, so it is something like:
" When Presence-Sensor-FP2 Presence Sensor 1 changes from Clear to Detected"?

Thank you,

I only use yaml, but it should be this. You should have a binary_sensor for the fp2 which turns on when you enter the room. In the visual editor it is called detected (or clear if off).
Give it a try, i think it will work.