How To: Setting a virtual motion sensor (with Maker API) based on motion detection within Synology Surveillance Station

One of my final frontiers was creating some sort of tie up between my Synology Surveillance Station software and HE. I was a previous BlueIris user for a couple years and recently moved to Synology due to ease of upkeep (it's already on my network). I haven't done much fiddling with Synology but did quickly put together a working trigger that keeps a virtual motion sensor in HE "Active" while Synology is detecting motion on the Camera (in this case it doesn't matter if Synology is set to detect motion or let the camera do it, they mask that all with "motion detected").

This general pattern can allow you to control any device that maker API supports via triggers in synology but this was the most obvious use case for me.

First step is to create the virtual motion sensor device and set the auto inactive setting to 15 seconds or longer (Synology will keep pinging while the camera motion is active but will never say it's inactive so this is important!) , ensure Maker API is installed in APPs and enable the maker API to access the virtual motion sensor device.

Copy the "Command" example at the bottom of that screen, we'll use that (with some modifications) as the URL Synology hits when it detects motion.

Head into Synology Surveillance Station and open "Action Rules" from the menu and create a new rule:

Name it appropriately and set it to "triggered" and "interruptible" and hit Next.

In the next screen select the camera you want to trigger the event and "motion detected" as the event type. I left interval at 10, which means every 10 seconds this will re-trigger. Since our virtual motion detector falls back to inactive after 15 seconds (or longer) this re-triggering will keep our virtual device set to active the whole time the camera is detecting motion.

The next screen is the Action you want Synology to take based on the trigger. You want to choose "External Device" as the action device and then we'll use a "Command" From the maker API as the external URL.

To put that together go into Hubitat -> Apps -> Maker API and open the link that says "Get All Devices" and find the virtual motion sensor and note the ID.

the URL we want to put into Synology looks like this:

http://10.0.1.X/apps/api/HUBID/devices/DEVICEID/active?access_token=ACCESSTOKEN

You can get the basics of this with everything but the DEVICEID and action filled in by copying the " Send Device Command" example on the Maker API app page. Replace the device ID with your virtual motion sensor, replace the [COMMAND] with active and then remove "/[SECONDARY VALUE]" and it should look like above. You can test your URL by simply putting it into your browser, it should set the motion sensor to active.

Paste that URL into the "URL" Field in synology:

No need to set username/password and leave "Times" at 1, the interval is pre-set.
Hit Next to get to schedule.

Set your schedule of when you want this trigger to happen, I set mine to all the time, but depending on use you might not want this triggering all the time.

thats it!

You should now see the motion sensor trigger active when the camera triggers, and fall off once the camera stops detecting. You can use the motion change in all of your other rules/etc just as if you had a big motion sensor in the back yard. You could even have multiple cameras trigger the same motion sensor, or the average all utility to combine all outside camera based motion sensors into one motion sensor that says "Something is moving in the yard".

You can also use this basic pattern to change options on any devices maker API supports, so for instance set presence based on motion from your garage camera or turn on the hallway light at night based on motion from a camera there.

Many cameras have VERY configurable motion sensing so if Synology supports them and receiving that information it can be a great way to skip using traditional motion sensors in areas you already have cameras.

12 Likes

Thanks for sharing this. :grinning: I just setup basically the same thing but with SecuritySpy on a Mac to trigger a virtual backyard motion sensor.

2 Likes

Glad it helped!!

I currently use sighthound to track "Animals" crossing into my grass which then turns on a spruce sensor via a virtual switch in smartthings. it works great.

so looks like you meant you just change hte end point i.e http://10.0.1.X/apps/api/HUBID/devices/DEVICEID/active?access_token=ACCESSTOKEN to enable motion detection or disable it in station?

thank you

blue iris is very customiseable.. how do you find synology surveillance?

This looks like a really good function. I just followed your steps although Surveillance has changed a bit and now has Webhook. Am I right to add the very long device ID coped out of the device I created? SS has a test function which fails so Iā€™m doing something wrong.


Please see images of new SS screen and my link I typed in.

My surveillance station interface looks nothing like that, it doesn't offer "Webhook" or most of the other stuff above. Granted I have a QNAP nas rather than Synology but can the actual app be that different between them?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.