I have found a guide on the www, but it was not that 100% clear and I had to google a lot of things to be clear. But I got it 100% functional and will publish an updated guide here.
This is the url for the original guide: https://www.paolotagliaferri.com/home-automation-home-assistant-docker-synology/
Some prerequisites:
- Docker
- Home Assistant
- Surveillance Station
- Unifi network or similar that can be integrated in Home assistant
First:
Find the entity identifier of your mobile phone that is used by the Ubiquiti UniFi integration

Create a group where the entity that represents you in your configuration.yaml

Next:
Then on the Synology Surveillance Station, I generated two actions in the Action Rule section to create webhooks that Home Assistant can use for switching the Home mode on or off
First I will create the rule to enable home mode


Here you see the webhook url we will use in the secrets.yaml later on


Now you have create the rule to enable the Home mode in surveillance station. Next will be the disable Home mode rule


Here you see the webhook url we will use in the secrets.yaml later on


When you have followed all steps, this will be the result

Now we are going to define 2 variables for the webhooks in the secrets.yaml file. These variables will be used in the configuration.yaml later.

When that is done, we can go back to the configurations.yaml to define the webhooks so they can be used for automation

Finally – I defined the automation in the UI (or in the configurations.yaml file) – here’s the generated configuration

Last thing to do is to check the configuration for errors and if that passes, you can restart the Home Assistant server.
Now the moment you go out of range of your wifi, Synology Surveillance station will go out of home mode and vica versa. Keep in mind that the standard delay the Ubiquiti UniFi integration uses for switching from home to not home is 300 seconds.