Binding Request: Synology Surveillance Station

Thanks a lot!
I will give it a try!

EDIT:
I just installed the latest version and will report back with the outcome.

However, I had issues starting the binding:

openhab> bundle:list | grep Syno
245 x Installed x  80 x 2.4.0.a31              x SynologySurveillanceStation Binding
openhab> bundle:start 245
Error executing command: Error executing command on bundles:
    Error starting bundle 245: Could not resolve module: org.openhab.binding.synologysurveillancestation [245]
  Unresolved requirement: Import-Package: org.eclipse.jdt.annotation; resolution:="optional"
  Unresolved requirement: Import-Package: org.jupnp.model.meta

and needed to install the following additional features:

openhab> feature:install openhab-transport-serial
openhab> feature:install esh-io-transport-upnp

How to ensure that these are installed persistently?

Another question in the subject.
Does SS have a stream that is supported by Chromecast.
I want to cast to my TV.

/Mike

I don’t have a Chromecast device so I can’t answer your question. Couldn’t you just test every URI this binding returns? Aside from Live feed URI (rtsp) and Live feed URI (mjpeg over http) you may also try an http URI as in post #206.

@tnemrap I’ve also updated the binding manual with an easy method to obtain transformed URI using JS transform.
@michelm_de Thanks for this idea!

Updated to M7 and was spamed with:

2018-12-09 21:00:56.285 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1490ltn388511 tried checking if channel homemode is linked although the handler was already disposed.
2018-12-09 21:00:59.291 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1490ltn388511 tried checking if channel homemode is linked although the handler was already disposed.
2018-12-09 21:01:02.295 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1490ltn388511 tried checking if channel homemode is linked although the handler was already disposed.
2018-12-09 21:01:05.299 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1490ltn388511 tried checking if channel homemode is linked although the handler was already disposed.
2018-12-09 21:01:10.535 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1490ltn388511 tried checking if channel homemode is linked although the handler was already disposed.
2018-12-09 21:01:13.540 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1490ltn388511 tried checking if channel homemode is linked although the handler was already disposed.
2018-12-09 21:01:16.545 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:1490ltn388511 tried checking if channel homemode is linked although the handler was already disposed.

Hi NCO and sorry for having missed your message.
Unresolved requirement is a known issue. As far as I know it happens only with SNAPSHOTs and only if it’s the first binding being installed. It’s actually only esh-io-transport-upnp, which is required, and it is (afaik) pre-installed with a STABLE version and/or is installed with any other binding using UPNP (Netatmo and such).
As this binding is not integrated into openHAB, it’s not possible to force the installation of this feature. See Creating a binding with UPNP discovery for more info.
I will update the binding manual with a quick how-to: feature:install esh-io-transport-upnp.

Hi @tnemrap
Sorry, I still can’t reproduce your issue or pinpoint its source. My fresh M7 installation don’t show any warnings. Please provide more information if possible:

I restarted and now i do not get the messages.

/Mike

Hi Pavion,

don’t worry - it seems to be running well so far on M7
Thanks for responding, though.
It’s greatly appreciated!
Great Binding by the way :slight_smile:

I guess the binding doesn’t support PIR motion detection?
I have integrated the
Switch Surveillance_Event_Motion “Camera motion event” {channel=“synologysurveillancestation:camera:diskstation:1:event#motion”}

and added a rule for it.
I have noting in my log files from motion detection when Home Mode is Off.
My camera is only sending an alert when there is PIR detection, so camera motion detection is disabled, but PIR is enabled.

Is it possible to add this to the binding?

This binding can detect events coming from / through Synology Surveillance Station. If your camera has an integrated motion detection or you’re using separate hardware for this, those events are not available for this binding.

i checked my configuration and i haven’t checked the checkbox “When detects PIR, trigger motion detection events as well”.

Shouldn’t you turn it on?

It is turned on, but no event in log for this

alarm.items
Switch Camera_Hal_Motion “Beweging in hal” <alarm> {channel=“synologysurveillancestation:camera:beveiliging:5:event#motion”}

alarm.rules
rule “Beweging gedetecteerd hal”
when
Item Camera_Hal_Motion received command ON
then
sendBroadcastNotification(“Beweging hal!”)
end

I can’t test your issue as I have no PIR… Please check following:

  1. Check your Surveillance Station. In the Timeline-App you should see your PIR events. Only those shown there could be queried by the binding.
    If you see your PIR events there…
  2. Try using received update instead of received command
rule “Beweging gedetecteerd hal”
when 
Item Camera_Hal_Motion received update
then	
if (Camera_Hal_Motion.state == ON)  {
sendBroadcastNotification("Beweging hal!")
}
end
  1. For a quick testing you can adjust the sensitivity of your sensor, which would increase event frequency and length
  2. If you’re using persistence with your openHAB, you can add your item and check the database sometime later
  3. Try using Synology internal motion detection (with high sensitivity) and look whether it would generate events

On my HikVision i use an external Bosch PIR connected to Digital Input.
synology surveillance station detects digital input and start recording.
Can i have a switch for Digital Input also?
I am now using this solution to capture events

/Mike

Sorry people, I can’t implement things I can’t test myself and I still can’t quite understand your request

As shown in post #236 of @dafdegiraf, there is a switch, which should - upon turning on - relay PIR events as motion detection events. If this is the case, those events should be shown in the Timeline app and should thus be available for the binding.

That means: if you events are not shown in the Timeline app, I don’t see any way to include them in the binding. I ask for your understanding, that I’m not going to support some third party PIR provider which are not supported by the Synology Surveillance Station API itself. If this is the case, you should look for an other binding (or use Exec / JS Transform) for obtaining events and using them in your rules.

On the other hand, if your events are shown in the Timeline app, I’m depending on you to help me find out, why they are not available for the binding. In this case, some answers for my questions in previous post #293 could help.

You can also check your events directly:

  • Execute this to get your SID:
http://192.168.0.2:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=3&account=xx&passwd=yy&session=SurveillanceStation&format=sid
  • Execute this with the SID and Camera ID to get full event list of your camera
http://192.168.0.2:5000/webapi/entry.cgi?&version="4"&cameraIds="1"&api="SYNO.SurveillanceStation.Event"&method="List"&limit=10&_sid=kbpMwEAKPNzLU14A0MDN043107

You should then see last 10 events being triggered. If your PIR event is among them, please check his reason:

"reason":2  

As of now, the binding polls for reasons 2 (Motion), 3 (Alarm) and 5 (Manual). Perhaps your PIR sensor generates 6 (External), that’d be easy to implement. Other possibility would be creating an Action Rule in your Surveillance Station, which should trigger reason 9.

Hi,

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.