React if group is off

Hi,

I have a staircase with three light groups, stairs, upstairs area and downstairs area. On the stairs I have two motion sensors, at the top and down. When I go up the stairs - downstairs motion sensor is triggered. Than I need that stairs and upstairs would light up. When I go down - upstairs motion sensor is triggered. Than I need that stairs and down stairs would light up.

Also I use a split of different actions before and after sunrise.

How should I set up that when I trigger one of the sensors, other one would be temporarily off until the actions of the first one would not be completed?

Problem is, if second sensor is not disabled, than all actions are triggered for upstairs and downstairs despite which direction I am going.

Thank you
Ernestas