Can I set the DND or follow me using an email or similar

I know nothing about Home Assistant, but will this script by Lorne Gaetz work for you?

Test that you can set or unset DND from the FreePBX command line.

Next, test that you can use ssh to run the command from the HA command line.

Set up RSA authentication so HA can access FreePBX without a password.
https://help.ubuntu.com/community/SSH/OpenSSH/Keys

Set up HA to issue the appropriate ssh command programmatically, when you arrive or leave home.