Binding Request: Synology Surveillance Station


I installed the binding a couple of weeks ago and have troubles with some memory leak, which crashes openhab after a couple of days. I tried setting the refresh rate to 0 and only using the lazy loading habpanel widget, but got the same result. I could trace the memory leak to the HttpClient. Every time I installed the binding, The result for shell:threads | grep HttpClient | wc -l would show up to 2000 threads after 2 or 3 days. There are no error messages in the log. Also setting the log level to debug did not help me pinpoint the problem. Does anyone else have this problem? @Pavion Do you have an idea what could be the cause of this behavior?

My setup runs for months now and i have 81 RUNNABLE and 240 TIMED clients.
Are you using the latest v.31 release? Please execute bundle:list | grep Syno and check, whether the release is correct and the binding is not executed twice.

Thanks for the quick reply! I figured that I was the only one with this problem, otherwise somebody probably would have mentioned something.
I had v.30 installed, then uninstalled for maybe 1 or 2 weeks, after realizing this seems to be the cause of the problem, then tried v.31. Same behavior. I just reinstalled v.31:
271 │ Active │ 80 │ 2.4.0.a31 │ SynologySurveillanceStation Bin
HttpClients went up from 17 to 81 (whish seems to be normal, after seeing your numbers):
shell:threads | grep HttpClient | wc -l
81 81
Unfortunately, I can’t reproduce whatever is creating the threads (closing, reopening habpanel etc.) but I’m pretty sure, that the binding was never executed twice.

Please check this issue:

Seems like the same problem.

10 cameras, several habpanels in the house 89 threads and i am using the binding to refresh.

glad its working better for you now

Oh crap, I only checked open issues… Yes, that definitely sound like the same issue! Wifi is not enabled on my raspberry but I will check if I find something that might cause connection issues. Thanks for the hint!

This morning I had 1617 Threads again. I checked the log and only found a couple of suspicious “Thing ‘synologysurveillancestation:station:16b0o6n663902’ has been updated.” messages (I think these are not supposed to appear, right?). Actually 24 of them. If you multiply these by 64, which are initially created each time and add the 81, which were there in the first place, this seems to be the reason for the threads. I will try to define the Thing in a file instead of the paper ui, to see if that helps, before doing any time-consuming network analysis.

My Cameras works perfectly in Synology Survillance Station, They handle Digital Input and i see every event in Timeline. But i can not use your binding for motion of the reason it just handle Motion detection.


@janis http clients used in the binding were never shut down properly. Normally it should not be a problem but it might have had an impact in your case. I’ve now added a proper client shutdown prior to disposal, which should reduce the number of connections being open. Please check the latest release, whether it helps.

@tnemrap could you please PM me your full event list (with an PIR / DI event) as described in second part of my post #241?

My camera with PTZ , no patrol activated, is blocking openhab.

2018-12-17 12:01:34.662 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.initialize()’ on ‘org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler@14e85a’: null
java.lang.NullPointerException: null
at org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler.updatePatrols( [227:org.openhab.binding.synologysurveillancestation:2.4.0.a31]
at org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler.initialize( [227:org.openhab.binding.synologysurveillancestation:2.4.0.a31]
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 [?:?]

I tried to unlink the channel, like you said, but i get an error in my log
2018-12-17 12:10:03.980 [ERROR] [io.openhabcloud.internal.CloudClient] - Unsupported request method DELETE

Defining the bridge via text file instead of paper ui seems to fix the problem, still 81 Threads after ~24 hours. I will now try the new version in combination with paper ui, thanks!
The new binding seems to show up as a31 as well. Is this correct?
bundle:list | grep Syno
273 │ Active │ 80 │ 2.4.0.a31 │ SynologySurveillanceStation Bin

@janis Oops, yes, I’ve forgot to change it. Hope it works though!

@dafdegiraf please check the .a32 release for a quick fix. Additional null check has been added to prevent this exception.

Hello @Pavion

I just installed the latest .jar but I cannot get to the discovery of my synology station. I get a 403 error and also the same when I try the following URL


Obviously my username/password is correct. i suspect that this happens because I have two factor authentication enabled on my synology using this guide

Is this the case ?

Two factor will not work, you’ll need to create a separate user with rights to access Surveillance Station.

Makes sense. I will create another user. Thanks!

Yep, seems to work. Still at 81 threads after 2 days. Perfect, thank you very much for the fix and especially the binding in general!

Glad to hear!
Thanks to your help I’ve also found an even better solution: in future versions I’m using the internal HttpClientFactory:

This greatly reduces the client count (merely 3-6 threads) and all of client handling is done by openHAB core.

Hello @Pavion.

Thank you for this great binding. I’m been trying this for a couple of days, and I love it as long as it works… but unfortunatelly I’m regullary facing issues with a thread breaking :frowning:
The camera thing is then showing the status as “offline” and the only measure I can do to reset the thing is to restart openHAB.

Now I wanted to see what happens if I unbind the channel “common#snapshot” and only use the channel “common#snapshot-uri-static”. But then it seems the String is not populated, hence the sitemap is showing no image.

Is there a way to make these channels work independently of each other? Or am I missing something and my idea does not make sense…

Thank you much and best regards,