11 Jan 2021
Like many of you out there, I use my Synology NAS for a number of things, and I have done so for a good number of years. In fact, my Home Assistant setup is run through a Docker Container on my Synology NAS, along with a number of additional services such as MQTT, ESPHOME etc.
Synology offer a number of services which for me, I have stuck with in one way or another despite better and in the case of surveillance station, dare I say cheaper options if you have more than a few cameras. Anyway, this is not a review of Synology.
Synology Surveillance Station comes with most Synology NAS devices and is free for the first two cameras. After the first two you then have to pay for additional licenses which personally, I think is a little tight, but it seems to work for them. Due to this I have moved away from Surveillance Station except for a couple of cheap Pan Tilt Zoom cameras which I can’t seem to control in quite the same way with any other integration.
This guide assumes that you have Synology Surveillance Station installed with the cameras setup and working as you are expecting to be replicated through Home Assistant. It also assumes that you have Home Assistant setup and configured.
In this guide we are going to set up create a Home Assistant rest_command: to move the camera to preset locations. This will obviously only work with cameras which already have PTZ control as a feature.
You can use this same process for a number of different actions from Home Assistant to your camera inside Synology Surveillance Station including Start action rule recording, Stop action rule recording, Take Snaphots, Move to Preset, Patrol, Auto pan, Enable Camera and Disable Camera. The principle is the same although the beginning process will be different depending on which option you are trying to achieve.
You can see I have created a few different locations on the camera already. You can add as many different positions as you would like.
To start you need to move the camera to the position you want to save as a Preset. This can be done by clicking the + button at the top right
You will now notice a little pan icon which appears on the bottom right of the image. Once you click this, the camera will start to pan around until you click the stop button above it.
Once you are happy with the new position, simply add a name which you will remember.
Click save and you will see the new position saved on the right side
You can test you are happy with the position by moving the camera and selecting the position again or going into the Live View app where the option will also be listed.
If you wish, you can setup more advanced rules for Patrol and also rules for sending the camer aback to its original or home position after you move it. You can either use the options here or use the rest commands in Home Assistant later. That’s a matter of preference for you.
To add an Action Rule, click Add
This will start the Add Action Rule Wizard. Start of by giving your Action Rule a name. We need to chose the Triggered option, as we will be Triggering an event with our rest_command:. You also need to select whether you wish the actions to be interrupted or not. I almost always chose interruptible for this type of thing, as it means if I select the wrong option, I can select the correct one and it will start straight away. If we chose uninterruptable, we would have to wait until that process completes before we can do anything else.
Click next to continue with the Wizard.
For this process we are going to have one simple event. Select Webhook in the Event Source dropdown and this will show a unique Webhook URL which we will use as our rest_command: in Home Assistant. Click Next
The Action is what we want Synology Surveillance Station to actually do when we hit that Webhook URL. You can have as many things happen as you like when the Webhook URL but for this example we are only going to add one Action.
First we need to decide what we want to control with our Action. As we want to move our camera to a Preset Position, we will select Camera. You will see there are other options for other things which you can control such as Surveillance Station (should you wish to use Home and Away mode) and even IFTTT, although I am not sure why you would do it through here if you have Home Assistant.
Then chose which camera we are going to control, if you have more than one setup.
The Action is where we will choose Move to Preset but of course you can select any Action you wish to do when the Webhook URL is hit.
Select the duration. This is important if you wish to set a Return Position as this is the time it will remain at the position you selected. For example if you wanted the camera to turn to the left when you click on the Webhook URL and then return to the Home Position after 30 seconds, this is a great feature to ensure it always resets after someone moves it.
You do not need to select a return position. If you select None, then the camera will simply remain where you moved it to until you move it to another position.
Once you are happy with the settings click next to set up scheduling
For most of us we will want this to always be active, however if there are fixed times or days you do not want this action to work, you can remove them from here and the Webhook URL will not work during those times.
Once you ae happy, click finish and its now time to test our Webhook URL we copied earlier. To do this, open a new tab in your browser, paste the Webhook URL from earlier and hit enter. Now go to your camera and see if the rule is behaving as it should. Now is the best time to fix that before we go off and add our rest_command: to Home Assistant
Now we have set up Synology Surveillance Station to do actions when we hit our Webhook URL, we now need to add them to Home Assistant. To do that we need to go to our config file to add our rest_command: Webhook URL.
# Example configuration.yaml entry rest_command: example_request: url: 'http://example.com/'
Once you have added your rest_command: you will need to restart for it to be available in Home Assistant. The rest_command: will not show as an entity, it will only be available as a service. This will be fine for Automations but if you want to use a Picture Glance card like the below, you will need to take a few more steps to make an entity for each rest_command or Action Rule you have.
There are a few options in Lovelace to add your Camera. If you want easy access to your controls then you will need to set up a Picture Entity card in Lovelace with the entities you want to control shown along the bottom.
There are many ways to achieve the same thing in Home Assistant. I have chosen to use a mix of input Booleans and Automations to manage my specific requirements but there is no right or wrong way.
Personally, I like the Input Boolean for this scenario as I opted to have the camera return to its home position once it had completed the action we set. You may remember that at the start of this guide when we were setting our Actions in Synology Surveillance Station. So, during this time I want to make it clear that the button has been pushed (there may be a second or two latency) and also that it hasn’t finished yet. I then use my automation to turn it off again.
By its nature the Picture Entity Card will show bold or highlighted when it is on and dull or greyed out when it is off. We can use a cheeky automation to control that if you wish.
We only sell products which have been tried and tested by our team in our own installation.
Detail 〉We offer a range of flexible delivery options, including free standard delivery on orders over £75.
Delivery options 〉Happy to wait? Get the biggest savings by Prebuying your bulk order from our next delivery of stock.
Learn More 〉Need a helping hand getting started with your purchase? Get free setup support from our team.
Product support 〉Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.