Adding Reolink API to the IpCamera binding, beta testers needed

Same from the UI with OH 3.4.2, tellstick, and the December 3.4.2 JAR.

Try restarting openhab, if that does not work then I do not know why and you may need to move to openhab 4 if something was changed in the 3.4.2 openhab that broke older jar files.

I restarted (restarted Karaf…)

I can sandbox 3.4.2 and 4.x side-by-side if I want, can’t I? (not at the same time). My only interest right now is proving the concepts (And testing your binding!). Nothing is in production yet.

The last JAR for 3.4.2 I found was December. If there is a newer one, point me to it and I’ll try it. And, if the intent is that this supports 3.x and 4.x, I can grab any logs you want.

Always great to have people willing to test and help out. Do not bother testing and supplying any results for 3.x openHAB, nothing more will happen as all development has moved to 4.x openHAB. You probably can run both with docker and flick between them quickly and easily, but that is not something I know a lot about. The milestone 3 of 4.0 is due out next week and it is probably a good time to start looking at testing and moving to the newer 4.x version of openHAB. Just need to know that it requires a newer Java version so this may cause hurdles when you jump back and forth between them that normally does not exist when changing versions.

How do I “upgrade” to 4.0 keeping as much of my 3.4.2 setup as possible?

That should be pretty easy but best to be placed in its own thread after first reading how others have done it. The process is update Java to the newer version required, then install V4.x. However there are some breaking changes noted that you should read about first and do not attempt it unless you have some spare time to fix issues that arise. By this I mean don’t do it 1 hour before you plan to go to sleep :slight_smile: I would wait the extra week and perhaps 1 more for others to discover/test the next Milestone before taking it on.

I apologize for being late to report as I got sidetracked and now the details might be a little murky. My 4 Reolink cameras are on Rpi4 2GB running OH4M2. I had them running as ONVIF no problem. After the merge of the little fix for multiple streaming I copied your waiting PR for Reolink locally and switched my cameras over to Reolink things. (Should have only done one first :frowning_face:) Anyway streaming snapshots no longer worked. I could stream video, but it was straining Rpi4 cpu. Because it was my main system, I switched things back to ONVIF and all is fine again. Unfortunately 1) I also did not get a trace log and 2) I noticed you posted an updated Reolink later, but did not test that one, so the problem may be fixed. 3) I’m not using any animal detection channel (You will see why I added this observation). What log file I have is this (many times over)

2023-04-27 17:09:23.593 [WARN ] [netty.channel.DefaultChannelPipeline] - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.NullPointerException: Cannot read field "dog_cat" because "aiResponse[0].value" is null
	at org.openhab.binding.ipcamera.internal.ReolinkHandler.channelRead(ReolinkHandler.java:123) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[?:?]
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) ~[?:?]
	at org.openhab.binding.ipcamera.internal.handler.IpCameraHandler$CommonCameraHandler.channelRead(IpCameraHandler.java:297) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[?:?]
	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) ~[?:?]
	at org.openhab.binding.ipcamera.internal.MyNettyAuthHandler.channelRead(MyNettyAuthHandler.java:182) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[?:?]
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[?:?]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) ~[?:?]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) ~[?:?]
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[?:?]
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[?:?]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[?:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[?:?]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[?:?]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584) ~[?:?]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496) ~[?:?]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[?:?]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]

There is a fix for that already in the code, you must not have been using the latest code/version.

1 Like

Can someone post the TRACE level logs for when their cameras are scanned and added to the INBOX please? I want to see if it is possible to automate adding them as reolink instead of just onvif thing types. Hopefully it gives log output that shows the cameras login page and something that can be used to ID the camera brand from this. Using ONVIF methods the user and password is needed before asking the brand and model of a camera so this method of scraping the camera login page is used and works for other brands as they usually have a copyright message or website link that mentions the brand.

What’s the status of the Reolink integration. I just got a RL NVR. (16 channel/8 cam). Is that supported too?

Hi, I get this when I scan with the binding. it looks cutted.
but it should be 3 Reolink Cameras, not only 2…

2023-06-16 08:34:06.416 [TRACE] [camera.internal.onvif.OnvifDiscovery] - Device replied to discovery with:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:ns10="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:ns11="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:ns12="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:ns14="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:ns3="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:ns4="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:ns5="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:ns6="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:ns7="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:ns8="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:ns9="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tds="http://www.onvif.org/v
2023-06-16 08:34:06.417 [INFO ] [camera.internal.onvif.OnvifDiscovery] - Possible ONVIF camera found at:192.168.0.179
2023-06-16 08:34:06.418 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'ipcamera:onvif:1921680179' to inbox.
2023-06-16 08:34:06.418 [TRACE] [camera.internal.onvif.OnvifDiscovery] - Device replied to discovery with:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver20/media/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tad="http://www.onvif
2023-06-16 08:34:06.419 [INFO ] [camera.internal.onvif.OnvifDiscovery] - Possible ONVIF camera found at:192.168.0.178
2023-06-16 08:34:06.419 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'ipcamera:onvif:1921680178' to inbox.

I’m on 3.4.0.202212282316 │ org.openhab.binding.ipcamera
greets

It was merged so if your using 4.0 milestone 3 or newer you can use the built in binding. Since I don’t work for reolink I have no idea if your gear will work, if it has their api in it then make sure you upgrade the firmware which is always good practise to do and some of their nvr models come with onvif turned off till u enable it.

I’m still on 3.4.4

I installed the binding and thins comes online, but I’m not able to get a snapshot image nor video. What to setup the things for 8 channels?

Then its possible the missing camera either had ONVIF turned off in its settings, or the camera may not support onvif which is true of all battery powered Reolink cameras.

I made some improvements based on your log output that will mean reolink should get detected much better. The auto added thing in the merged binding will be making them ONVIF and not reolink and also giving the wrong onvif port of 80 instead of 8000. Until these changes are merged I would just manually add the cameras or you can change to the jar linked in this PR.

@markus7017
This may be the cause of your issue as well. Manually add the reolink things and check they are using the onvif port 8000 in the things setup. Also its known that many NVRs made by Reolink come with ONVIF disabled and require a screen to be connected to the NVR to enable the support. Possibly newer firmwares will have it enabled by default but I can not comment if this is true as I neither own any Reolink nor work for the company. If you can not get them to be seen by the free ‘onvif device manager’ software, then contact their support for help.

ONVIF gets enabled on the NVR level, not per cam. I added the thing manually and it gets online. Nevertheless, there must Best regards, Markus some addressing mechanism gor the different channels. You can‘t reach he cams directly with different IPs. The NVR builds a separate IP subnet for the cameras. The binding only sees the NVR and needs to address channel 1…8

Here we go, two cameras.
192.168.1.156 is a Reolink RLC-811A
192.168.1.155 is a Dahua IPC-HFW5541E-ZE
The latter is automatically discovered, the 811A needs to be added manually.
The Reolink is not recognized as an API camer as far as I can see. Once added I don’t get any events (whereas adding as ONVIF gets at least the cellMotion event).
Here is the trace of the scan. I hope that helps:

2023-06-21 19:20:49.111 [TRACE] [camera.internal.onvif.OnvifDiscovery] - Device replied to discovery with:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xmime5="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver10/actionengine/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:ns10="http://www.onvif.org/ver10/events/wsdl/PullPointBinding" xmlns:ns11="http://www.onvif.org/ver10/events/wsdl/CreatePullPointBinding" xmlns:ns12="http://www.onvif.org/ver10/events/wsdl/PausableSubscriptionManagerBinding" xmlns:ns13="http://www.onvif.org/ver10/network/wsdl/RemoteDiscoveryBinding" xmlns:ns14="http://www.onvif.org/ver10/network/wsdl/DiscoveryLookupBinding" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:ns3="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding" xmlns:ns4="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:ns5="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" xmlns:ns6="http://www.onvif.org/ver10/events/wsdl/EventBinding" xmlns:ns7="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" xmlns:ns8="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:ns9="http://www.onvif.org/ver10/events/wsdl/NotificationConsumerBinding" xmlns:tad="http://www.onvif.org/ver10/analyticsdevice/wsdl" xmlns:tds="http://www.onvif.org/v
2023-06-21 19:20:49.112 [INFO ] [camera.internal.onvif.OnvifDiscovery] - Possible ONVIF camera found at:192.168.1.156
2023-06-21 19:20:49.116 [TRACE] [camera.internal.onvif.OnvifDiscovery] - Device replied to discovery with:<?xml version="1.0" encoding="UTF-8" ?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl"><s:Header><a:MessageID>uuid:580264a4-b6f7-2d69-f071-9c7a4876b6f7</a:MessageID><a:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</a:To><a:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</a:Action><a:RelatesTo>uuid:68ea6355-ced2-4318-9cb7-ec93884040cc</a:RelatesTo></s:Header><s:Body><d:ProbeMatches><d:ProbeMatch><a:EndpointReference><a:Address>uuid:00b84a70-a79e-dce5-922f-c36b4727a79e</a:Address></a:EndpointReference><d:Types>dn:NetworkVideoTransmitter tds:Device</d:Types><d:Scopes>onvif://www.onvif.org/location/country/china onvif://www.onvif.org/name/Dahua onvif://www.onvif.org/hardware/IPC-HFW5541E-ZE onvif://www.onvif.org/Profile/Streaming onvif://www.onvif.org/type/Network_Video_Transmitter onvif://www.onvif.org/extension/unique_identifier/1 onvif://www.onvif.org/Profile/G onvif://www.onvif.org/Profile/T</d:Scopes><d:XAddrs>http://192.168.1.155/onvif/device_service</d:XAddrs><d:MetadataVersion>1</d:MetadataVersion></d:ProbeMatch></d:ProbeMatches></s:Body></s:Envelope>
2023-06-21 19:20:49.117 [INFO ] [camera.internal.onvif.OnvifDiscovery] - Camera found at xAddr:http://192.168.1.155/onvif/device_service

The changes in the PR I linked in my last reply should fix the detecting as an api camera, there is a jar you can trial in v4 at the PR link.

The second point of the events not working I would need the logs to look at more however you can still add as the reolink thing type and make the nvr channel set to 0 to use the onvif methods. When you set the number away from 0 it then changes to the api methods. In theory you should be able to do everything the onvif thing type can do plus more.

Thanks a lot, that did the trick!
I now get all the alarms including human plus some data on the event. That way I can actually turn openhab into a simple but comfortable NVR frontend. As soon as I have the next milestone installed I’ll try the discovery again.

Hello,

i want to set up my Reolink Cameras into my Openhab Rpi.

I use the openHAB 4.0.0.M4 - Milestone Build IP Camera Binding. My Cameras wouldn’t found automatically. When i set them manually as Reolink Camera with API they would be online, but in my Log Viewer I see only:

```2023-07-04 15:15:08.235 [WARN ] [nhab.core.internal.items.ItemUpdater] - NoSuchMethodException while creating Class instance: org.openhab.core.library.types.RawType.<init>()
2023-07-04 15:15:08.286 [INFO ] [era.internal.handler.IpCameraHandler] - Your Reolink camera gave a bad login response:[
   {
      "cmd" : "Login",
      "code" : 1,
      "error" : {
         "detail" : "login failed",
         "rspCode" : -7
      }
   }
]

I try every Account from my Reolink App (Email & Local Name/Password).

Do you have a Solution?

Thanks.

Can you login in the WebUi of the Cameras?
This login is used with the binding…
greets