Lock and Sensor help

This one might be easy but i can't figure out where to start. I have a rule that when a code is entered on my door lock from the outside, the speakers announce that the person who the code corresponds to is home. So if my wife enters her code the speakers will say "(My wife's name) is home"

This works perfectly. However, i also want to be able to announce if someone opens the front door from the inside. I have a open/close sensor on the door as well. How would i set this up so that i can announce it when the open/close sensor opens because someone opened the door from the inside BUT not fire the open/close rule if the door was open from the outside with a lock code? Trying to avoid a duplicate notification if the door is open with a code from the outside.

So in pseudo code you're trying to accomplish:

if codeEntered & valid
elseif contactSwitch changes to open

Thank you i had a feeling it would be something that simple! Thanks so much

You might also find the discussion in this thread interesting:


Download the Hubitat app