Binding Request: Synology Surveillance Station

Hi @monnimeter

Could you please check following:

In a coming version client/thread handling will be redone and I hope some issues will be resolved as well.

Best regards
Pav

Hi Pav,

thank you.

  • Yes, in the log file I see several NullPointerExceptions - but without a Stack Trace… like this - so it’s unclear where it breaks:

2019-01-03 19:55:29.825 [ERROR] [tation.internal.thread.SynoApiThread] - DeviceId: Bridge; Thread: HomeMode; Critical error:

java.lang.NullPointerException: null

  • The connection is technically stable, every thing is wired. I’m running openHAB inside a Docker Container on a Synology which is also running the SSS
  • Refresh rates are as low as possible: Snapshot 0 Sek., Event 5 Sek.
  • I’ve checked the documentation, I’m showing the Cam Image like this

Image item=xxxxx_common_snapshot_uri_static url="[%s]" refresh=5000

Best regards,
Osman

Snapshot 0 seconds is not good

Hmmm… OK, why is snapshot:=0 not a good idea? :thinking:

In my understanding there’s a channel “common#snapshot” (Snapshot) of Type Image which I don’t want to be refreshed by the Thread.
I just want the channel “common#snapshot-uri-static” (Static snapshot URI) to be refreshed. The Image is loaded in Basic-UI every 5 Seconds from that given URL…

Image item=xxxxx_common_snapshot_uri_static url="[%s]" refresh=5000

As it’s the Bridge error, please check whether your Bridge’s refresh rate is moderate, try to unlink the HomeMode channel from the Bridge or set its refresh rate to 0. Which version are you using?

OK. I unlinked the “Home Mode” Channel and now I’v set the refresh rate also to 0 (before it was 5 Sec.). I’m using the latest version (v32-alpha).

It is not the bridge making trouble… in most of the cases the Camera Thing is going offline.

image

It happend again some minutes ago. The Logfile does not contain any hint… it just starts repeating this line every 5 Seconds:

2019-01-06 15:55:13.327 [ERROR] [tation.internal.thread.SynoApiThread] - DeviceId: 9; Thread: Camera; Handler gone offline

Hi people! I’ve just published a new version with reworked HttpClient handling, which should greatly reduce overall thread count and perhaps fix other thread related issues. Please check release notes for further details:

1 Like

@monnimeter
For using but static URI all refresh rates (Thing and Bridge) can be turned off. This static Item should be populated on openHAB start and be available in your sitemap. In every case, please unlink every channel you’re not using, as this too will disable their respective threads.

Please check the latest version too, it could also address your issue.

If everything fails, please provide some more information per PM or create an issue with GitHub:

  • PaperUI oder .things/.items based configuration?
  • larger log excerpt perhaps?
  • what are you trying to achieve?
  • what is your setup’s load?
  • anything special with your setup?

Great, @Pavion! Thank you much :slight_smile:

I just moved to the new version (v0.33-alpha) of you binding.
Things and Items are configured using PaperUI as follows:

  • synology bridge with no channel bound, event refresh rate:=0
  • camera with snapshot refresh rate:=0 and event refresh rate:=5. Channels bound:
    – Camera recording
    – Camera enabled
    – Static snapshot URI
    – Motion event
    – Manual event

Simle sitemap integration within BasicUI (Serial No. removed):

			Frame label="Camera 1" {
				Image item=synologysurveillancestation_camera_xxxx_9_common_snapshot_uri_static url="[%s]" refresh=5000
				Text item=synologysurveillancestation_camera_xxxx_9_common_enable label="Kamera aktiv [MAP(yes_no.map):%s]" icon="camera"
				Switch item=synologysurveillancestation_camera_xxxx_9_common_record label="Aufnahme aktiv" icon="camera"
				Text item=synologysurveillancestation_camera_xxxx_9_event_motion label="Bewegung erkannt [MAP(yes_no.map):%s]" icon="motion"
				Text item=synologysurveillancestation_camera_xxxx_9_event_manual label="Manuelle Aufnahme [MAP(yes_no.map):%s]" icon="mediacontrol"
			}

And there’s one rule which toggles the recording channel if openHAB detects a motion using one of my other sensors (i.e. HomeMatic Motion Sensor):

	...
	if (motion_detected) then {
		synologysurveillancestation_camera_xxxx_9_common_record.sendCommand(ON)
	}
	...

My system has almost no load and nothing special running. I run the basic synology sesrvices and docker with openHAB. That’s all.

I’ll try the new version and let you know how it performs. If I face issues - which I do not hope :slight_smile: - I’ll increase the log level and also try to generate some more information to make the issue reproducable.

Thank you much and best regards,
Osman

Hi @Pavion.

The new version (V.0.33-a) of your binding is running now for 2 days without any issue.
Great work, thank you much!

Best regards,
Osman

1 Like

Hi,
I’ve installed this binding - first: thanks for it.
But at start I’ll get an error “ERROR: 409 - Conflict”. I’ll get this error after wanted to add it via paperUI as thing.
my two Surveillance Stations was found but I couldn’t add them to things…

I’ve only read about UPNP discovery, but I use a working openhab with many working things (as example HUE)

There’S noch Thing with the same name or something similar
Could you help me? (also like in German :wink: )

edit: Waring from Openhab log:

2019-01-24 21:54:54.435 [WARN ] [g.discovery.internal.PersistentInbox] - Cannot create thing. No binding found that supports creating a thing of type synologysurveillancestation:station.

greats
Oliver

Hi Oliver, please check the German Synology forum yet again for an answer :slight_smile:

Hello,

Thanks for building this and from the look of it supporting it regularly.

I just tried few of the latest builds and I am getting this error:

2019-01-28 18:21:16.784 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method ‘ThingHandler.initialize()’ on ‘org.openhab.binding.synologysurveillancestation.handler.SynoBridgeHandler@3ee8d586’: null
java.lang.NullPointerException: null
at org.openhab.binding.synologysurveillancestation.internal.webapi.WebApiException.(WebApiException.java:42) ~[?:?]
at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.createSession(SynoWebApiHandler.java:175) ~[?:?]
at org.openhab.binding.synologysurveillancestation.internal.webapi.SynoWebApiHandler.connect(SynoWebApiHandler.java:86) ~[?:?]
at org.openhab.binding.synologysurveillancestation.handler.SynoBridgeHandler.initialize(SynoBridgeHandler.java:112) ~[?:?]
at sun.reflect.GeneratedMethodAccessor63.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) [102:org.eclipse.smarthome.core:0.10.0.oh240]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.10.0.oh240]
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) [?:?]

and the status is:

Status: UNINITIALIZED - HANDLER_INITIALIZING_ERROR

Any ideal?

On my side i use openhab 2.4 running on docker on an old Synology 1010+. The surveillance station is also old (Perhaps API issues?) version 7.1.

Thanks!

Hi Katerica!

It seems you’re right in your assumption and your API is a bit old. I take it, you can’t update it anymore?
It also seems that I can fall back to an older login API without drawbacks, which might work for you.
As I can’t test it, it’s up to you to try the newest release on GitHub. Please note, that any other requests might still fail, please try to unlink the corresponding channels to avoid further errors. Feedback is appreciated!

Pav

1 Like

man you are good!

It fixed the issue and camera showed up immediately. I have not tested all features yet but at least the initial part works. And unfortunately i cannot upgrade further…

I can assist in the rest of the bug hunting if more issues exist. Since i have never actually attempted to use the API i would appreciate few starting pointers on Synology’s website and since you have shared the code i can give you potential fixes for review if i find issues and solutions. It should be possible to check API version on bridge definitions and expose relevant functionality conditionally.

Agreed?

Cheers.

1 Like

Well… backward support is not really the same as bug hunting… :wink:

In the best case everything works just fine or at most some channels can’t be used. If you encounter any breaking issues, please contact me again. If you’re on GitHub, you’re welcome to create issues and give feedback there.

You can find an older API documentation v.2.0 for your version here, newest I know about is v.2.8. Don’t know how they’re related to Surveillance Station version.

Thanks a lot @Pavion!

So far I tried the Snapshot, Move, Zoom, move to preset and recording channels and all seems to work as expected.

In the log i only notice this annoying warning that shows up all the time:

[WARN ] [.core.thing.binding.BaseThingHandler] - Handler SynoBridgeHandler of thing synologysurveillancestation:station:a6gan01814 tried checking if channel homemode is linked although the handler was already disposed.

Not sure what it is but it seems to come from the bridge.

On the release notes you did for me you write API 2 vs 6. 6 here is typo right? You mean v2.0 vs 2.x8x whatever the latest is?

I’ll switch to github from here on.

Cheers!

That’s fine! As for the warning, please try to disable home mode channel of the Bridge Item or its refresh rate, it seem to cause issues sometimes and I haven’t been able to reproduce it yet.
As for the versions, I don’t actually understand the connection between API version and SSS version. The documents are labeled with 2.xx (2.8 being the latest afaik) and SSS is now at 8.2.2.
See you on Git!

Hi, i just installed your binding and its working fine!
Only problem is about motion event, because is not getting to openhab: if i check http api getting SID and then get latest event list, i see that they are all “reason”:1 . I also see some reason 9 that is triggering correctly the item of action rule.
Whats the problem with motion? Why is not 2?
And how to configure alarm events in surveillance station? Thank you!

Hi Rick! According to API reason:1 is Continuous Recording. Are you using motion detection of the Surveillance Station? Is your recording active at this time per some other rule? Please note, using camera’s internal detection will not trigger Syno’s motion events.

I’m not using/receiving alarm events myself and assume, that they are events from digital I/O Modules. Please check Syno’ documentation for more info on that.

In general, you’ll see the same events in the binding as shown in the Timeline App of the Surveillance Station.

BR Pav