Help me with automatisation please

I have HA on Raspberry. I bought an Aqara FP2 human detection sensor. I placed it in the living room and divided it into 4 zones: passage, sofa, relaxation, and TV. Now the problem begins because whatever I do, it doesn’t work. I need to create an automation such that:

  1. When someone enters the passage zone, the light turns on.
  2. When someone leaves the passage zone, the light turns off.
  3. When someone moves from the passage zone to another zone, the light should remain on until all zones are empty.
    The same applies if someone moves between zones.
    If I turn on the light using Alexa, the sensors should not work until I turn the light off also using voice through the Alexa system.
    If I say the word ‘sleep’ to Alexa, the sensors will not work until 09:00 or until the ‘sleep’ command is canceled using the ‘reset sleep’ command.
    If someone helps me figure this out, I will not fail to show my gratitude.

What does #2 accomplish that #3 does not?

If you look in HA now can you see someone enter and leave each zone?

What does it show? What states show for persons leaving and entering zones?

Hello ashoflife,

I’m sure that can be done. Also having someone or something writing it for you means the second it misbehaves, you will be struggling back to find someone to fix it for you.
The best way to learn is to just try. Run thru the docs on getting started with the automation editor. If you get stuck, come back with what you have done.

and
The Home Assistant Cookbook - Index.