Help with a Motion-Dimmer-Virtual Switch Rule

First Rule Machine Rule, requesting some help.
Was a simple automation app, but adding some complication that I'm trying to wrap my head around. Any guidance/suggestions appreciated.

Background: We like to turn on the lights when walking into our mudroom, and when motion stops turn off after x minutes. However, when we take the dogs out when it's dark in the morning or at night, we like that dimmer switch to remain on until we come back inside and close the door (virtual switch), and motion stops.

Devices:
Motion Sensor
Dimmer switch
Virtual contact Switch (Ring door sensor)

Trigger - motion turn on lighting
Actions - Turn on dimmer switch at x level. Turn off when motion stops after x minutes.
Conditions:

  1. between 8pm-8am (or sunset to sunrise, or mode), keep dimmer on when virtual switch is open. Can also use modes as a condition here if easier.

You need the rule to know if you are coming in or going out.

I accomplish this by combining the motion sensor with the door sensor. You need to place the motion sensor near the door, inside, but not too close to be triggered by it.

Door open with motion inactive means you are coming in.

Door open with motion active means you are going out.

If you are coming in and out faster than the motion sensor resets, then the rule gets messed.

Greetings BIGS, and thanks for helping spartysh32. I don't want to boggart the post, but maybe this will help as well. Can you let me know how you set up the conditions you described? It sounds very useful. Maybe help sparty as well... unless I'm the only one with little knowledge. Thanks !

The way you've shown it in your post should work if you leave the door open while you're outside.

But I don't think that's what you're actually trying to achieve? (I live in Minnesota, so definitely think of "leaving the door open" as a huge energy sink and making the room uncomfortably cold. Could also be a security issue anywhere, though with you active with dogs in the back yard just outside the door maybe not so much that.)

There you go.

Luz Escaleras 1 and Luz Escaleras 2 are interior lights triggered by the interior motion sensor that will be on only when exiting. When both are off that implies you are entering. They will turn on precisely when entering.

Luz Porche Entrada is the light that will go on only when exiting.

Beautiful! Thank you! Love this. This is extremely helpful, to me anyway. Hopefully this will provide answers to spartysh32, originator of the post, as well.
Let us know sparty...

Thanks for the help here.

@dd-b - In this scenario, we actually do keep the door open just a crack, to avoid potential lockout while walking the dog (quickly) around our yard in the dark. Agree, not the most energy efficient here in MN, esp 2-3 weeks ago. Luckily a storm door also there. Joys of coyotes.

@BiGs - will look through this more. Thanks!

I have a virtual switch already setup with the ring door sensor to turn on the outdoor lights when opened to go outside. I'm thinking I can use that sensor in this one somehow.