Binding Request: Synology Surveillance Station

would you happen to have the jar file for this release?

You can find the jar file here:

Thnx… why did i not see that :slight_smile:

Hi Michel!

As you’ve already figured out, the API is responding with a quoted URI, as stated in latest Surveillance Station API documentation v.2.8. This behavior seems to cause random issues depending on browser / playback software. In fact, in binding’s issue #26 you’ve found an user had an issue with StmKey not being quoted.
As it is, I’d rather leave the URI unchanged and hope for Synology to make it somehow… universal someday.

P.S. Just tested on my setup: both quoted and unquoted URIs were working in browser and VLC as well.
Your thoughts on this are welcome.

Best regards

Hi Pav,

as a workaround I created a new dummy item for the URL and then created a rule which does the string replacement. The basically does:
Cam_Dome_Snapshot_Live.postUpdate( Cam_Dome_Snapshot_Live_Uri_Mjpeg_Http.state.toString.replaceAll("\"", "" ) )

But later I also got the problem with leading 0 where this doesn’t work anymore. So I was further searching for a solution and maybe found (script from here some good one which maybe could also be applied to your solution. The idea is to have a php script which does the authentification inside so the url is somehow static.

// Configuration
$user = "display";  // Synology user
$pass = "somepassword";  // Password
$ip = "";  
$port = "5000";  
$cameraID = $_GET["CamID"];  // ID for the camera
$cameraStream = $_GET["stream"];
// You can change the stream by adding ?stream=0/1/2 to the url. For example:
// 0: Live stream | 1: Recording stream | 2: Mobile stream
// Default value is stream 0
if ($cameraStream == NULL) {
        $cameraStream = "0";

// Authentification and get SID
$json = file_get_contents('http://'.$ip.':'.$port.'/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=3&account='.$user.'&passwd='.$pass.'&session=SurveillanceStation&format=sid');
$obj = json_decode($json, true);
@$sid = $obj["data"]["sid"];

$Cam_Stream_URL = 'http://'.$ip.':'.$port.'/webapi/SurveillanceStation/videoStreaming.cgi?api=SYNO.SurveillanceStation.VideoStream&version=1&method=Stream&cameraId='.$cameraID.'&format=mjpeg&_sid='.$sid;

$fp =  fopen($Cam_Stream_URL, "r");
foreach ($http_response_header as $header) {
while($str = fgets($fp, 4096))
    echo $str;

Maybe it’s possible also for you to get the SID and deliver a static URL without the StrKey?


Nice idea! As you’re already there, you might just try it yourself. With following replacement in your rule you would convert the static snapshot URI (Surveillance_Snapshot_Uri_Static) into a new dummy item (Surveillance_Snapshot_Live_Uri_Static):

  Surveillance_Snapshot_Uri_Static.state.toString.replace("entry.cgi", "SurveillanceStation/videoStreaming.cgi").replace(".Camera", ".VideoStream").replace("version=8", "version=1").replace("GetSnapshot", "Stream&format=mjpeg")

I’m looking forward to your feedback.

Hi Pav,

thanks for this workaround. It’s working fine:


In my openhab.log I see such message:

2018-11-04 11:41:38.276 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1630mqn415001 tried checking if channel homemode is linked although the handler was already disposed

Any idea what is causing this?

Glad it worked!
Your warning I haven’t seen yet though. Is your HomeMode channel linked/enabled? If yes, is it functioning properly? Can you see anything wrong at all? When do you receive this message? Every X seconds/minutes, on every Binding/openHab start, on configuration change?

You have handler disposed in this thread:


This binding works perfect! Nice job!

Yes, this is actually from me.
I don’t use HomeMode yet.
Is this mandatory?

I added some camera’s, but the camera’s with PTZ are giving me an error, any ideas?

2018-11-22 09:48:32.707 [WARN ] [ome.core.thing.internal.ThingManager] - Initializing handler for thing ‘synologysurveillancestation:camera:42f5d3bc:8’ takes more than 5000ms.
2018-11-22 09:48:35.545 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.initialize()’ on ‘org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler@4ec48’: null
java.lang.NullPointerException: null
at org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler.updatePatrols( [224:org.openhab.binding.synologysurveillancestation:2.4.0.a30]
at org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler.initialize( [224:org.openhab.binding.synologysurveillancestation:2.4.0.a30]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke( ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:?]
at java.lang.reflect.Method.invoke( ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect( [101:org.eclipse.smarthome.core:0.10.0.oh230]
at [101:org.eclipse.smarthome.core:0.10.0.oh230]
at [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:?]
at java.util.concurrent.ThreadPoolExecutor$ [?:?]
at [?:?]

What is your exact question? HomeMode can be used but is not mandatory for anything. Although there are some obscure warnings I couldn’t reproduce, it still should work as intended.

@dafdegiraf could it be that you have no patrols defined? Please try to run this URL (using your IP and your camera ID as shown in camera properties in the binding):


If you have any patrols defined, you should see their list. If not, you will get an error with code 400 (execution failed). In that case you have to disable the corresponding channel for the binding to work.

Indeed, i have no patrols defined.
How do i disable the corresponding channel?
I tried it to unlink it in habmin, but it doesn’t do anything

Actually it should… you’d need to unlink or delete altogether this “Run patrol” item, so it doesn’t there anymore. I would recommend using PaperUI, which is more user friendly in my opinion.

I was able to reproduce your issue: turning Run patrol on put the Thing offline, turning off brings it online back again.

In any case, the binding going down in this case is an obvious error and I thank you for pointing this out! I’ll try to make a hotfix today or this weekend.

Thanks for your quick response.

I was actually wondering if HomeMode is a Must and if not used if it could cause the „Handler disposed“ issue.

But obviously not - according to your response .
So, thanks again :blush::+1:t2:

@NCO @michelm_de @dafdegiraf
I’ve tried to address your issues, please check the latest release and its notes for more details.
Thanks for reporting, feedback is appreciated!

how long ago did you start this binding? a while now! I’m still several versions back and rock solid.
Keep up the good work @Pavion

1 Like