Binding Request: Synology Surveillance Station

I am running Openhab 2.2.0 stable with the binding.
Openhab is running in the same vlan as my Synology NAS with surveillance station active.
Surveillance station is not discovered and when adding the API thing manually it says communication error - errorcode 0 (with all parameters set correctly).
Any idea?

can you post the response from the following url:

http://diskstation:5000/webapi/query.cgi?api=SYNO.API.Info&method=Query&version=1&query=SYNO.SurveillanceStation.Camera

or

http://YOUR-DISKSTATION-IP:YOUR-PORT/webapi/query.cgi?api=SYNO.API.Info&method=Query&version=1&query=SYNO.SurveillanceStation.Camera

This gives

{“data”:{“SYNO.SurveillanceStation.Camera”:{“maxVersion”:9,“minVersion”:1,“path”:“entry.cgi”,“requestFormat”:“JSON”}},“success”:true}

ok what returns the following url:
http://diskstation:5000/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=6&account=YOUR-USER&passwd=YOUR-PASSWORD&ession=SurveillanceStation&format=sid

(replace YOUR-USER and YOUR-PASSWORD )

{“data”:{“is_portal_port”:false,“sid”:“HXFBNSdePjOzYC9L1N08395”},“success”:true}

Hello together!

I’ve just uploaded a new version. This version should address the discovery issue (@stefaanbolle) and also introduces motion and alarm detection (@tnemrap). Please check the release log for more information.


We’re just at the beginning and I ask you for your understanding if something goes wrong. Thank you for your testing efforts and patience, we depend on you! :slight_smile:

Best regards
Pav

It is working now. Thanks!

How do i see motion detection?
Can not find a channel for that.

/mike

Hi Michael,

please download the newest release (0.7a) from the project page, I’ve fixed some bugs regarding motion detection.
To install the binding, you should remove all old JARs from /addons and/or copy the new one over.
If you’ve had the version without motion detection, you will need to recreate your camera Thing to see new channels. I hope, you will find this option useful and I’d be glad to hear what your next proposal would be :slight_smile:

Pav

Hello together,

I’ve spent a lot of time in my holidays for the binding and implemented many ideas (see below). Before I commit a new release I would gladly hear if somebody has some feedback on current version and/or some requirements to be implemented. In fact, most functionality of Synology Surveillance Station seems to be reflectable in openHAB.

New:

  • Better event handling with further event support. Currently implemented are motion, alarm and manual events. Easily implementable on request: custom, external, analytics, edge and action rule events.
  • All switches are now properly initialized. To reflect external changes, the state of camera (enabled / recording) is polled with the event refresh rate.
  • All refresh queries should run only if corresponding channels are active to reduce network load.

Changes:

  • Refresh rates for snapshot and for event are now separated and relocated to the camera Thing. It is now possible to fine tune refresh rates per camera. Accordingly, old refresh rate is removed from the bridge.
  • As side effect, changing refresh rates now actually works.
  • Moving to built-in Jetty http handler instead of Apache greatly reducing overhead, binding file size (~70k) and footprint.
  • Replacing old and ugly Bridge discovery with mDNS discovery, which is faster, lighter and better by far and supplies more information for the discovery.
  • Channel grouping for better usability.
  • PTZ cameras are yet again the same cameras just with PTZ channels disabled.

You can check the changes in the current project branch here:

Greetings and a happy New Year!
Pav

1 Like

Where is the compiled version?

/Mike

Wasn’t drafted yet as I’ve hoped for some other ideas before I merge the new branch… Anyway I’ve drafted a new version here:

In the widget if you have no label it is still one line before picture begin.


/mike

The Image is a couple of hours old.

Find this in log.

2018-01-02 20:01:20.172 [ERROR] [nternal.thread.SynoApiThreadSnapshot] - could not get snapshot: org.eclipse.smarthome.core.thing.internal.ThingImpl@664a3916
java.lang.NullPointerException: null
        at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.getSnapshot(SynoWebApiHandler.java:250) [273:org.openhab.binding.synologysurveillancestation:2.2.0.a15]
        at org.openhab.binding.synologysurveillancestation.internal.thread.SynoApiThreadSnapshot.refresh(SynoApiThreadSnapshot.java:48) [273:org.openhab.binding.synologysurveillancestation:2.2.0.a15]
        at org.openhab.binding.synologysurveillancestation.internal.thread.SynoApiThread$1.run(SynoApiThread.java:49) [273:org.openhab.binding.synologysurveillancestation:2.2.0.a15]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
        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) [?:?]

/Mike

Hi Michael,

please edit your widget and remove following block at the beginning to remove the label margin.

.synology-camera-snapshot {
    **margin-top:20px;**
}

Second problem should be avoided with the new version a16 (please check installation notes).

Actually I think to drop this whole widget thing. Constant image refresh seems to have smaller overhead as I’ve thought and allows for some later automation. With now three threads polling the Surveillance Station API I can see no load spikes. With constant refresh, PaperUI and standard HabPanel widgets can be used.
Would be glad to hear your opinion on that.

Pav

There was some problem with the new binding.
It find the diskstation but i could not get a stable connection.
Moved back to the previous one and now it works again.

/mike

Which is the previous? Have you checked the today’s a16 (see link to release page above)? a15 had some bugs indeed :frowning:

Sorry it was a15 now i am trying a16 and it seems to work.

Previous for me was a3.

/Mike

I think you can skip the work around the widget it is not so much difference compared to the image widget.

/Mike

Now i get:

2018-01-02 22:32:38.739 [ERROR] [nternal.thread.SynoApiThreadSnapshot] - Snapshot: Handler gone offline

/Mike