Binding Request: Synology Surveillance Station

Hello together!

I’m new to openHAB and I’d like to contribute to this great project by offering my thoughts and solutions for accessing a Synology Surveillance Station via openHAB.

I have implemented (or put together from other sources) two different ways, both using Synology API, and I would be glad to hear your suggestions and thoughts on this matter. If you’re interested, I can also give you more detailed description or upload my files on GitHub. Please be kind to me, if there already is a better solution :smile:

First and easy way for the users of HABPanel only is a creating of an Image item linked to an URL. This URL points at a php script running on Synology Web Station. The script then connects to Synology API and delivers a camera snapshot.

Advantages:

  • Script runs only if HABPanel is open, greatly reducing server load
  • Script is easy and foolproof :slight_smile:

Disadvantages:

  • Limited to HABPanel, not controllable and thus not “Smart”

Second way: I’ve created a Synology Surveillance Station Binding, which binds a camera through API and as of now offers following channels: current snapshot as IMAGE, automatic refresh yes/no as SWITCH and refresh rate in seconds as DECIMAL. Fully configurable and even controllable with PaperUI.

Advantages:

  • using full openHAB functionality: persistence, rules etc. (e.g. trigger snapshot on alarm and so on)
  • potentially allowing even more control of IP camera by binding additional Surveillance Station API functions

Disadvantages:

  • higher server load in automatic refresh mode (24/7); without automatic refresh requires custom HABPanel widget
  • error prone, as I’m new to this project (I had already to find out how to uninstall a binding with Karaf console :blush:) and have but limited time available

As I’ve said, I’d like to hear if there is still need, as well as your feedback and your thoughts on this.

Best regards
Pav

hi Pav,

sounds good because a binding would be great thing…

I working on a Surveilanvce Station binding over API too.

I already implemented the following functionalities:

  • discovery cameras
  • PTZ (zooming, moving …)
  • start/stop recording

regards Nils

Hi Nils and thank you four your answer.
I’ve also tried to implement discovery but for now I’m stuck with one Camera Thing, which has to be configured manually. In there I’m using a simple http server for connecting to API and a GSON parser to parse its answer.
Is there a way to combine our development or for me to contribute to your project, if you’re further ahead? It makes no sense for me to develop two bindings with the same goal.
With best regards
Pav

That sounds good to me! Let’s talk about this…

For those, who are interested, you can trace the progress of the binding on GitHub and propose new ideas or issues. See you there!
Pav

1 Like

Is there somewhere i can download a compiled jar to test?

/Mike

Hello Michael,

I’ve just uploaded a version I have now running on my stable installation:


Please note, that it’s a work in progress, and use it only if you know how to uninstall/update it just in case.

Having said this, I thank you for your interest. Feel free to give feedback and create new issues.
Also if you’re using HABPanel, you should also try my snapshot lazy loading widget.

Best regards
Pav

1 Like

Get this error when trying.

2017-12-18 12:04:19.958 [WARN ] [ig.xml.osgi.XmlDocumentBundleTracker] - The XML document '/ESH-INF/thing/camera.xml' in module 'org.openhab.binding.synologysurveillancestation' could not be parsed: The document is invalid, it contains further unsupported data: [NodeValue [nodeName=category, value=Camera], NodeList [nodeName=channels, attributes={}, list=[ChannelTypeXmlResult [id=image, typeId=image-channel, properties=null], ChannelTypeXmlResult [id=record, typeId=recording-channel, properties=null], ChannelTypeXmlResult [id=enable, typeId=enable-channel, properties=null], ChannelTypeXmlResult [id=zoom, typeId=zoom-channel, properties=null], ChannelTypeXmlResult [id=move, typeId=move-channel, properties=null]]]]!
---- Debugging information ----
class               : org.eclipse.smarthome.core.thing.xml.internal.ThingTypeXmlResult
required-type       : org.eclipse.smarthome.core.thing.xml.internal.ThingTypeXmlResult
converter-type      : org.eclipse.smarthome.core.thing.xml.internal.ThingTypeConverter
path                : /thing-descriptions/thing-type
line number         : 23
class[1]            : java.util.ArrayList
converter-type[1]   : com.thoughtworks.xstream.converters.collections.CollectionConverter
class[2]            : org.eclipse.smarthome.core.thing.xml.internal.ThingDescriptionList
converter-type[2]   : org.eclipse.smarthome.core.thing.xml.internal.ThingDescriptionConverter
version             : 1.4.7

/Mike

I can’t reproduce this behavior and couldn’t find anything resembling this error :frowning:
Could you please provide some more information:
When do you encounter this error? On copying the binding in your addons/ already? Can you see the binding though? What happens on openHAB restart? What openHAB version are you using?

Hi i run 2.1 stable on rpi 3.
I get the error when copying in the file to addons and also when i restart.

START LEVEL 100 , List Threshold: 50
 ID | State    | Lvl | Version                | Name
------------------------------------------------------------------------------------------------------
  9 | Active   |  80 | 5.3.1.201602281253     | OSGi JAX-RS Connector
 10 | Active   |  80 | 2.3.1                  | Gson
 11 | Active   |  80 | 18.0.0                 | Guava: Google Core Libraries for Java
 12 | Active   |  80 | 3.0.0.v201312141243    | Google Guice (No AOP)
 13 | Active   |  80 | 1.5.8                  | swagger-annotations
 14 | Active   |  80 | 3.19.0.GA              | Javassist
 16 | Active   |  80 | 3.5.2                  | JmDNS
 19 | Active   |  80 | 1.1.0.Final            | Bean Validation API
 21 | Active   |  80 | 2.0.1                  | javax.ws.rs-api
 23 | Active   |  80 | 3.2.0.v201101311130    | ANTLR Runtime
 26 | Active   |  80 | 1.6.0                  | Commons Codec
 27 | Active   |  80 | 3.2.1                  | Commons Collections
 28 | Active   |  80 | 1.1                    | Commons Exec
 29 | Active   |  80 | 2.2.0                  | Commons IO
 30 | Active   |  80 | 2.6                    | Commons Lang
 35 | Active   |  80 | 4.2.3                  | Apache HttpClient OSGi bundle
 36 | Active   |  80 | 4.2.3                  | Apache HttpCore OSGi bundle
 57 | Active   |  80 | 4.0.8                  | Apache Karaf :: Wrapper :: Core
 58 | Active   |  80 | 3.1.0.7                | Apache ServiceMix :: Bundles :: commons-httpclient
 63 | Active   |  80 | 2.11.0.v20150805-0538  | EMF Common
 64 | Active   |  80 | 2.11.1.v20150805-0538  | EMF Ecore
 65 | Active   |  80 | 2.11.1.v20150805-0538  | EMF XML/XMI Persistence
 66 | Active   |  80 | 3.8.0.v20160509-1230   | Common Eclipse Runtime
 67 | Active   |  80 | 3.6.100.v20160223-2218 | Extension Registry Support
 94 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Config Core
 95 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Configuration Discovery
 96 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Config Dispatcher
 97 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome Config XML
 98 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core
 99 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core Audio
100 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome AutoUpdate Binding
101 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core Binding XML
102 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core ID
103 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core Persistence
104 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Scheduler Service
105 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core Thing
106 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome Core Thing XML
107 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Transformation Service
108 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core Voice
109 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Console
110 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Console for OSGi runtime Karaf
111 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome JavaSound I/O, Fragments: 169
112 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Monitor
113 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Net I/O Bundle
114 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome REST Interface Bundle
115 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Core REST API
116 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome REST mDNS Announcer
117 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Sitemap REST API
118 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome SSE REST API
119 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Voice REST API
120 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Bonjour/MDS Service Discovery Bundle
121 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Web Audio Support
122 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Model Core
123 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Item Model
124 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Item Model Runtime
125 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Persistence Model
126 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Persistence Runtime
127 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Rule Model
128 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Rule Runtime
129 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Script
130 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Script Runtime
131 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Sitemap Model
132 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Sitemap Runtime
133 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Thing Model
134 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Thing Model Runtime
135 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Json Storage Service
136 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome UI
137 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome UI Icons
138 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Classic IconSet
139 | Active   |  80 | 2.9.2                  | Xtend Runtime Library
140 | Active   |  80 | 2.9.2                  | Xtend Macro Interfaces
141 | Active   |  80 | 2.9.2                  | Xtext
142 | Active   |  80 | 2.9.2                  | Xtext Common Types
143 | Active   |  80 | 2.9.2                  | JSR-45 Smap installer
144 | Active   |  80 | 2.9.2                  | Xtext Utility
145 | Active   |  80 | 2.9.2.v20160428-1452   | Xbase Model
146 | Active   |  80 | 2.9.2                  | Xbase Runtime Library
162 | Active   |  80 | 2.2.0                  | JUPnP Library
163 | Active   |  80 | 1.9.6                  | MIME streaming extension
164 | Active   |  80 | 5.0.2                  | Require-Bundle Fix :: org.objectweb.asm
166 | Active   |  90 | 2.1.0                  | openHAB Core
167 | Active   |  80 | 2.1.0                  | openHAB Karaf Integration
169 | Resolved |  80 | 2.1.0                  | openHAB Sound Support, Hosts: 111
170 | Active   |  80 | 2.1.0                  | openHAB Dashboard UI
175 | Active   |  80 | 3.2.0                  | Commons Net
176 | Active   |  80 | 2.1.0                  | openHAB 1.x Compatibility Layer
177 | Active   |  80 | 1.1.1.201605111122     | Swagger Provider
178 | Active   |  80 | 2.4.5                  | Jackson-annotations
179 | Active   |  80 | 2.4.5                  | Jackson-core
180 | Active   |  80 | 2.4.5                  | jackson-databind
181 | Active   |  80 | 2.4.5                  | Jackson-dataformat-YAML
182 | Active   |  80 | 2.1.0                  | json-path
183 | Active   |  80 | 1.5.8                  | swagger-core
184 | Active   |  80 | 1.5.8                  | swagger-jaxrs
185 | Active   |  80 | 1.5.8                  | swagger-models
186 | Active   |  80 | 2.2                    | json-smart
187 | Active   |  80 | 3.4.0                  | Apache Commons Lang
188 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome Exec Transformation Service
189 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome JavaScript Transformation Service
190 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome JSonPath Transformation Service
191 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome Map Transformation Service
192 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome RegEx Transformation Service
193 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome Scale Transformation Service
194 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome XPath Transformation Service
195 | Active   |  75 | 0.9.0.b5               | Eclipse SmartHome Xslt Transformation Service
196 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Basic UI, Fragments: 200
197 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome WebApp UI
198 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome Paper UI, Fragments: 204
199 | Active   |  80 | 2.1.0                  | openHAB REST Documentation
200 | Resolved |  75 | 2.1.0                  | openHAB Basic UI Fragment, Hosts: 196
201 | Active   |  75 | 2.1.0                  | openHAB Classic UI Fragment
202 | Active   |  80 | 2.1.0                  | HABmin User Interface
203 | Active   |  80 | 2.1.0                  | HABPanel User Interface
204 | Resolved |  75 | 2.1.0                  | openHAB Paper UI Theme Fragment, Hosts: 198
205 | Active   |  80 | 0.9.10.v20160429-1435  | reflections (wrap)
206 | Active   |  80 | 1.5.8.v20160511-1038   | swagger-jersey2-jaxrs (wrap)
207 | Active   |  80 | 3.12.0.OH              | nrjavaserial
208 | Active   |  80 | 2.1.0                  | ZWave Binding
211 | Active   |  80 | 1.10.0.201706231114    | openHAB RFXCOM Binding
212 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome hue Binding
213 | Active   |  80 | 0.9.0.b5               | Eclipse SmartHome UPnP Transport Bundle
214 | Active   |  80 | 1.10.0                 | openHAB mySQL Persistence bundle
215 | Active   |  80 | 0.9.0.b5               | Astro Binding
216 | Active   |  80 | 1.10.0                 | openHAB Mqtt Action
217 | Active   |  80 | 1.10.0                 | openHAB MQTT Transport Bundle
218 | Active   |  80 | 1.10.0                 | openHAB Exec Binding
219 | Active   |  80 | 1.10.0                 | openHAB HTTP Binding
220 | Resolved |  80 | 2.1.0                  | HarmonyHub Binding
221 | Active   |  80 | 2.1.0                  | Network Binding
222 | Active   |  80 | 2.1.0                  | Samsung Tv Binding
223 | Active   |  80 | 0.9.0.b5               | Sonos Binding
224 | Active   |  80 | 2.1.0                  | openHAB Cloud Connector Bundle
225 | Active   |  80 | 0.9.0.b5               | ntp Binding
226 | Active   |  80 | 2.1.0                  | VoiceRSS TTS Voice Service
227 | Active   |  80 | 1.10.0                 | openHAB Expire Binding
228 | Active   |  80 | 2.1.0                  | Hue Emulation Service
229 | Active   |  80 | 1.10.0                 | openHAB MQTT Binding
230 | Active   |  80 | 1.10.0                 | openHAB Mqttitude Binding
231 | Active   |  80 | 2.1.0                  | Chromecast Binding
232 | Active   |  80 | 2.1.0                  | MaryTTS Voice Service
236 | Active   |  80 | 2.2.0                  | SynologySurveillanceStation Binding

/mike

Hello Michael,

thank you for the information, this error is specific for openHAB 2.1 and is fixed in openHAB 2.2
You can try my new compatible release here:


or you can upgrade to 2.2.stable (out since yesterday):

Thank you for your feedback!
Pav

Works in 2.2 Stable.

/Mike

To fast answer

Now i have Synology under bindings and i do not have it in addons.

I can not find it anywhere to uninstall it.

/Mike

When i try to add the jar i get:

2017-12-19 13:47:56.070 [ERROR] [org.apache.felix.fileinstall        ] - Failed to install artifact: /usr/share/openhab2/addons/org.openhab.binding.synologysurveillancestation-2.2.0-SNAPSHOT.jar
org.osgi.framework.BundleException: A bundle is already installed with the name "org.openhab.binding.synologysurveillancestation" and version "2.2.0"

/Mike

Sorry, you can’t uninstall a binding from PaperUI, this feature is not yet implemented.
For this you must open your Karaf console and execute bundles:list to list all installed bundles (bindings).
Newer bindings stand at the end of the list, their ID is the leftmost value (e.g. 222).
Now you can type bundles:uninstall xxx to uninstall a binding with its ID.

Done

How do i reinstall it?

It is not enough to add the jar.

/Mike

In my case it was enough to:

  • remove JAR from /addons
  • uninstall binding
  • copy JAR to /addons
    You might also try to restart openHAB, if not working.

Now it is working.

What i am missing is the events when motion or digital input is triggered.

/mike

It’s possible to poll Synology API every X seconds and get the latest recording event. This is basically the same event as seen in Timeline package of the Synology surveillance station and has following payload:

  • Event start / stop time
  • Event snapshot
  • Path of the video recording (some path anyway)
  • Cause (recording on: motion, alarm or action)

Questions:

  • with which frequency should be polled for events? To poll every second could be too much. Polling every minute actually gives you no live but last event.
  • which channels should be used, for example:
    – event snapshot as IMAGE
    – event start and/or stop time as DATE
    – some event STRING: “motion detected on blah blah”
    – some SWITCH

What would you think about it? Would it suffice?
I need a clear assignment before I go on :wink:

Pav

I was thinking to have switch connected to motion event then we also can use cameras as motion detectors.

My HIKVision cameras have an alertstream you can connect to see http://www.ragingcomputer.com/2016/06/hikvision-motion-detection-in-openhab-using-node-js
I am looking if Survillance Station also have this kind of stream.
Then motion can be in near realtime.

/Mike