Differentiate between someone leaving vs. entering the house through the main door, to trigger different actions

Do you currently change the location.mode from away to home, and if so, how do you trigger the change?

(This is the mode you can use in the smart lighting feature in the classic app, not the security.mode, which is the armed Status for SHM.)

And are you using webcore at all?