Binding Request: Synology Surveillance Station

I don’t quite understand, what your goal is.
You can disable snapshot refresh and use dynamic URL for your sitemap instead. See release notes for more details:


In this case, Surveillance Station is still being polled but with much smaller packages, greatly reducing network traffic. Snapshot will only be taken if a sitemap is active. If yours is a more specific case, please provide more details.

Thanks, it does exactly what I need, much appreciated (I had to manually
uninstall and re-install the bundle to make it work, not sure which
version I had before)

BTW, could you do the same for the “stream feed” ? Provide a URL so we
can put it as a video ?

I’m sorry to be such a pain, but I enabled the dynamic URL (which worked fine for a while, less network usage, less CPU usage also on NAS), but now it started to give errors like :

2018-02-26 13:53:18.173 [WARN ] [.internal.proxy.BlockingProxyServlet] - Proxy servlet failed to stream content: java.util.concurrent.RejectedExecutionException: Max requests per destination 1024 exceeded for HttpDestination[http://192.168.0.9:5000]@114c5e4,queue=1024,pool=DuplexConnectionPool[c=64/64,a=64,i=0]
2018-02-26 13:53:24.596 [WARN ] [.internal.proxy.BlockingProxyServlet] - Proxy servlet failed to stream content: java.util.concurrent.RejectedExecutionException: Max requests per destination 1024 exceeded for HttpDestination[http://192.168.0.9:5000]@114c5e4,queue=1024,pool=DuplexConnectionPool[c=64/64,a=64,i=0]
2018-02-26 13:53:28.169 [WARN ] [.internal.proxy.BlockingProxyServlet] - Proxy servlet failed to stream content: java.util.concurrent.RejectedExecutionException: Max requests per destination 1024 exceeded for HttpDestination[http://192.168.0.9:5000]@114c5e4,queue=1024,pool=DuplexConnectionPool[c=64/64,a=64,i=0]

Any idea ?

No problem, Karl, I’m happy to have some feedback. It’s the general lack of, why I’m but seldom active.

Actually there is no need to use a dynamic URL within a sitemap, even a static one would be sufficient. This could be the next feature if requested. The same applies to the stream feed URL, which is also basically static but could be provided dynamically for triggering other events.

As for the issue with requests: what is your refresh rate? I could imagine requests stacking with a high timeout and low refresh rate. As I’ve said, there is a prototype with refresh rates tied to timeouts, so no stacking is possible. If you wish to try it out and/or have other requests (see above), please PM me or create a GitHub issue.

Well, I had to disable it completely. After a while my NAS becomes almost unresponsive. It is not the most powerful and doing event dtection on it might not be a good idea, so I’ll keep trying some options…

As a general idea, it’d be good not to pull too often, as the API for what I can see is not very responsive by itself (not optimized), and if you use all features (homemode, recording, …) that’s probably diffferent API request each time, which would stack as you said.

Something I noticed for the dynamic URL is that is was changing (as an item event) every 10 seconds, but was staying the same. The dynamic URL is not really dynamic, only the “sid” might change if session expire, so maybe that a keep-alive could be done that would consume less bandwith (or less processing power). Looking at the Synology Manager GUI, it seems that it does the same (sends an entry.cgi request every x seconds with no parameter just to stay awake)

For the rest, the binding is great, especially because one of my camera is recognized a ONVIF and is limited on API request, so using the SYNO API is great for that one

As already written, neither snapshot URL nor live feed URL are dynamic but static. The URL is made dynamic by adding a optional timestamp to the static URL. Perhaps it’d be better to provide both options…

Anyway you can change refresh rate in your camera settings if you wish. Pseudo-dynamic URL is generated with event refresh rate (default: 3 seconds). You might want to set it higher if you encounter problems.

something about this binding is killing my habpanels’ response times.
I’m thinking of disabling all the auto refresh of images and learn about the REFRESH of images instead.
just FYI
edit
i think when i first set this up i didn’t understand the update interval thing so i had the snapshots updating as well as refresh times in the sitemap and refresh times in habpanel as well.
sooo i’m fixing that and habpanel isn’t running like crap anymore and i’m not getting these weird refreshes in the sitemaps. my bad.

Could you share your config ?

hi all,

i have the following error when i install/config the binding:

2018-02-27 10:21:13.406 [hingStatusInfoChangedEvent] - 'synologysurveillancestation:station:a6g6n04432' changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)

==> /var/log/openhab2/openhab.log <==

2018-02-27 10:21:13.408 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'synologysurveillancestation:station:a6g6n04432': null

java.lang.NullPointerException: null

	at org.openhab.binding.synologysurveillancestation.internal.webapi.WebApiException.<init>(WebApiException.java:41) [220:org.openhab.binding.synologysurveillancestation:2.2.0.a21]

	at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.createSession(SynoWebApiHandler.java:189) [220:org.openhab.binding.synologysurveillancestation:2.2.0.a21]

	at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.connect(SynoWebApiHandler.java:82) [220:org.openhab.binding.synologysurveillancestation:2.2.0.a21]

	at org.openhab.binding.synologysurveillancestation.handler.SynoBridgeHandler.initialize(SynoBridgeHandler.java:107) [220:org.openhab.binding.synologysurveillancestation:2.2.0.a21]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]

	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

I Use Openhab 2.2 Stable on RPI and i have download die version from 15 january from github.

have you any idea?

thansk!

i tried several times to get the things file right but i got errors every time so i’m at a paperui config only at the moment. i set the refresh time of the cameras to 10 seconds and removed refresh from all the sitemap images and in all my habpanels set the refresh to 0. now the img updates happen all via the binding and everything is much happier.

Well, did you each time restart OH when changing things ? For what I can see here it doesn’t pick changes on reconfiguration. Like for the refresh rate. Restart the bundle doesn’t seems to make a difference. But full restart of OH takes new values. So now I do refresh the station every minute ( to get home zone) and the cameras event every 90s only to get the URL. I did set the snapshot refresh to 0 and it all seems better.

Karl

my thing has never had the status online. is the binding compatible with openhab 2.2 stable?

I didn’t restart OH every time but I did observe entries in the logs as I made and saved changes to the files.

I really appreciate what @Pavion did with this binding but I think I just have too many cameras or something. I watch the console in the browser and I see tremendous amounts of data moving around, so much so that my habpanel tablets don’t keep up. I had the cameras on a 10 second refresh but it was still too much. For now I’ve moved back to a script that runs and grabs snapshots via ffmpeg and the browsers are much more responsive.
To be clear, this isn’t @Pavion’s fault. It’s 9 images updating every 10 seconds and all of that getting pushed to the browser constantly. “Static” images via URL seem to be far, far less taxing.

I’m going to try playing with motion detection only in the next couple of days to see if the image data still gets pushed around or not.

Well, stopping motion detection on the NAS helped a lot for me

Also, the dynamic URL, doesn’t actually grab the image. It will grab it
if you have your UI opened and refreshing (so if any UI are closed, the
URL isn’t retrieved, only when UI displaying that as an Image)

So, in my case I have only 2 camera, each using an Image from that
dynamic URL. It only grabs the snap when I open the link where it will
be displayed, so I have each camera in a separate screen, so I load only
1 at a time

i have so far 2 panels that are on all the time. the main panel displayed on each uses 2 cameras. the panels drop into a screensaver after ~5 minutes with each “screensaver” showing 6 cameras. There’s just too much going on in this setup. my options are to stop displaying so many cameras or the option i described previously.

Well, if you want to do something like that, you’ll have to get the real
feed from camera

What you could check also is in SurveillanceStation, if you did set the
feed to come from surveillance station or from camera. I did set all
from SS now but got only 2.

I think in your case, if all cameras have a mjpeg feed, it is probably
better to get a snap directly from the cam, so unloading the NAS

Most cams allows it

Hi together,

I’ve watched your discussion for some time and I feel the need to apologize for the binding being unstable for some of you. I’m running my Surveillance Station with but one camera on a rather powerful DS1815+ and encounter none of the issues you’ve mentioned. I’m having a 10 seconds refresh rate for snapshots and 3 seconds for events and haven’t seen but a single timeout exception or a higher load after a full month running.

It’s not an excuse but I’m still asking for your understanding, that I can’t always fix the issues you’ve encountered, which I can’t trace back or emulate. Having this thread sleeping for a month with no test feedback at all I confess to have also lost some encouragement I felt at the beginning.

Still I don’t like the thought of abandoning this community project and would still try to improve the binding and your experience with it. I’ll try to find some time this weekend (or next time, as RL allows) and I have some features I’d like to implement. Among other:

  • as already mentioned, further increasing connection timeouts has proved itself as a wrong concept. New concept would include lower timeouts tied to refresh rates, to avoid stacking requests and potential overloads;
  • adding static URL for snapshots and Live Feed, allowing you to integrate images/videos in your sitemaps without SSS being polled;
  • adding stream profile to the camera configuration: as of now, snapshots are taken using “Balanced” stream profile of your IP camera (see SSS>IP Camera->Edit camera->Device Settings->Video). By the way, if you’re encountering performance issues, you may want to reduce the overall quality of this profile.

Please note, that I’m depending on your feedback and debug information to trace back you issues. Of course I’m also open for your proposals.

@gravidigit It seems, you’re encountering some configuration issues while setting your binding. Have you used the automatic discovery?

Best regards
Pav

Just an issue I discovered on my install: The “Enable” switch doesn’t work on my system, for both cameras.

I wanted to disable a camera, but then I was still seeing snapshots, so I checked in surveillance station and the camera was still enabled.

Any idea ?

Here is the error from openHab.log:
2018-03-01 09:28:51.148 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.handleCommand()’ on ‘org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler@15b4629’: null
java.lang.NullPointerException: null
at org.openhab.binding.synologysurveillancestation.internal.webapi.WebApiException.(WebApiException.java:41) [224:org.openhab.binding.synologysurveillancestation:2.2.0.a21]
at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.handleSimpleResponse(SynoWebApiHandler.java:209) [224:org.openhab.binding.synologysurveillancestation:2.2.0.a21]
at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.disable(SynoWebApiHandler.java:334) [224:org.openhab.binding.synologysurveillancestation:2.2.0.a21]
at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.execute(SynoWebApiHandler.java:115) [224:org.openhab.binding.synologysurveillancestation:2.2.0.a21]
at org.openhab.binding.synologysurveillancestation.handler.SynoCameraHandler.handleCommand(SynoCameraHandler.java:100) [224:org.openhab.binding.synologysurveillancestation:2.2.0.a21]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.201801231340]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.201801231340]
at com.sun.proxy.$Proxy155.handleCommand(Unknown Source) [224:org.openhab.binding.synologysurveillancestation:2.2.0.a21]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.201801231340]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.201801231340]
at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.201801231340]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.201801231340]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

Hi, and thanks for your continued efforts. I want to be perfectly clear when I say that the delays I’m seeing aren’t because of anything you’ve done. I like your binding a lot, I just have too many cameras. With one of the habpanels open on my desktop I was watching the browser console (f12) and I could see the image data coming through with each refresh of the image. I was at the time using probably 7 of my 9 cameras in various panels so there was just a lot of data coming through.

That’s not too big of a problem on a computer, but the tablets couldn’t handle it. It made other items on the panels unresponsive or very slow to respond. Your idea to implement static URLs for the images would be well received in my case, thank you.

Also, clearer documentation of file configuration ( .things ) would be nice. While I think I had it right using your example I was getting errors when the configs were reloaded. If/when you update the binding with static URLs I’ll give it another go and share what errors I encounter, but for now I don’t want to reconfigure things, sorry!

I’m happy to provide feedback.

And again, thank you for what you’re doing. If no one else says it, I’ll say that I definitely appreciate your efforts.