in many cases you can change the location.mode In a piston. Then you can have an automation which changes the security.mode based on the location.mode. Of course that won’t work for people who have additional location.modes like “dog walker“ or “guest”
have the piston turn on a virtual switch and have the virtual switch trigger an automation that changes the security.mode
This workaround has only been possible for a few months since they made it possible to change security.mode in an automation.