Adding Reolink API to the IpCamera binding, beta testers needed

Hey guys,
I have three Reolink cameras here.

  • E1 Zoom
  • RLC-542WA
  • RLC-410W (currently disconnected)

I am most interested in getting the motion detection working. Unfortunately, I am having trouble with both of the currently connected cameras. The things are online and the binding logins successfully as far as I can tell. I added items to the channels for both cameras: motionAlarm, humanAlarm, activateAlarmOutput, faceDetected, and lastMotionType. Only for the last item I got a value for both cameras, the other items remain NULL.

In the traces I saw the motion detection to be triggering reliably:

2023-01-07 23:41:10.118 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:RuleEngine/CellMotionDetector/Motion, Data:IsMotion, Value:true

However, I could not see this with any of the linked items. Also, today the motion detection does not appear in the logs, although it is writing to the FTP server, when it detects motion. I restarted the thing, but this did not help.

Somebody else posted their camera’s abilities and it seemed to help, so here is mine for the E1 Zoom:

2023-01-08 16:11:07.139 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetProfiles
2023-01-08 16:11:07.219 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result from /api.cgi?cmd=GetAbility&token=baed319da8d4ba6 contains        :[
   {
      "cmd" : "GetAbility",
      "code" : 0,
      "value" : {
         "Ability" : {
            "3g" : {
               "permit" : 0,
               "ver" : 0
            },
            "abilityChn" : [
               {
                  "alarmAudio" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "alarmIoIn" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "alarmIoOut" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "alarmMd" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "alarmRf" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "batAnalysis" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "battery" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "cameraMode" : {
                     "permit" : 4,
                     "ver" : 0
                  },
                  "disableAutoFocus" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "enc" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "floodLight" : {
                     "permit" : 4,
                     "ver" : 2
                  },
                  "ftp" : {
                     "permit" : 4,
                     "ver" : 6
                  },
                  "image" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "indicatorLight" : {
                     "permit" : 0,
                     "ver" : 1
                  },
                  "isp" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "isp3Dnr" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispAntiFlick" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispBackLight" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispBright" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispContrast" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispDayNight" : {
                     "permit" : 4,
                     "ver" : 2
                  },
                  "ispExposureMode" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispFlip" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispHue" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispMirror" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispSatruation" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispSharpen" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ispWhiteBalance" : {
                     "permit" : 4,
                     "ver" : 0
                  },
                  "ledControl" : {
                     "permit" : 4,
                     "ver" : 2
                  },
                  "live" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "mainEncType" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "mask" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "mdTriggerAudio" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "mdTriggerRecord" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "mdWithPir" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "osd" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "powerLed" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ptzCtrl" : {
                     "permit" : 4,
                     "ver" : 2
                  },
                  "ptzDirection" : {
                     "permit" : 0,
                     "ver" : 1
                  },
                  "ptzPatrol" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "ptzPreset" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "ptzTattern" : {
                     "permit" : 0,
                     "ver" : 0
                  },
                  "ptzType" : {
                     "permit" : 0,
                     "ver" : 5
                  },
                  "recCfg" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "recDownload" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "recReplay" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "recSchedule" : {
                     "permit" : 4,
                     "ver" : 2
                  },
                  "shelterCfg" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "snap" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "videoClip" : {
                     "permit" : 4,
                     "ver" : 2
                  },
                  "waterMark" : {
                     "permit" : 4,
                     "ver" : 1
                  },
                  "white_balance" : {
                     "permit" : 4,
                     "ver" : 0
                  }
               }
            ],
            "alarmAudio" : {
               "permit" : 4,
               "ver" : 1
            },
            "alarmDisconnet" : {
               "permit" : 4,
               "ver" : 1
            },
            "alarmHddErr" : {
               "permit" : 4,
               "ver" : 1
            },
            "alarmHddFull" : {
               "permit" : 4,
               "ver" : 1
            },
            "alarmIpConflict" : {
               "permit" : 4,
               "ver" : 1
            },
            "auth" : {
               "permit" : 4,
               "ver" : 1
            },
            "autoMaint" : {
               "permit" : 4,
               "ver" : 1
            },
            "cloudStorage" : {
               "permit" : 4,
               "ver" : 35
            },
            "customAudio" : {
               "permit" : 0,
               "ver" : 1
            },
            "dateFormat" : {
               "permit" : 4,
               "ver" : 1
            },
            "ddns" : {
               "permit" : 4,
               "ver" : 9
            },
            "ddnsCfg" : {
               "permit" : 4,
               "ver" : 1
            },
            "devInfo" : {
               "permit" : 4,
               "ver" : 1
            },
            "devName" : {
               "permit" : 4,
               "ver" : 2
            },
            "disableAutoFocus" : {
               "permit" : 4,
               "ver" : 1
            },
            "disk" : {
               "permit" : 4,
               "ver" : 1
            },
            "display" : {
               "permit" : 4,
               "ver" : 1
            },
            "email" : {
               "permit" : 4,
               "ver" : 3
            },
            "emailInterval" : {
               "permit" : 4,
               "ver" : 1
            },
            "emailSchedule" : {
               "permit" : 4,
               "ver" : 1
            },
            "exportCfg" : {
               "permit" : 0,
               "ver" : 1
            },
            "ftpAutoDir" : {
               "permit" : 4,
               "ver" : 0
            },
            "ftpExtStream" : {
               "permit" : 4,
               "ver" : 1
            },
            "ftpPic" : {
               "permit" : 0,
               "ver" : 0
            },
            "ftpSubStream" : {
               "permit" : 4,
               "ver" : 1
            },
            "ftpTest" : {
               "permit" : 4,
               "ver" : 0
            },
            "hourFmt" : {
               "permit" : 4,
               "ver" : 2
            },
            "http" : {
               "permit" : 4,
               "ver" : 1
            },
            "httpFlv" : {
               "permit" : 4,
               "ver" : 1
            },
            "https" : {
               "permit" : 4,
               "ver" : 1
            },
            "importCfg" : {
               "permit" : 0,
               "ver" : 0
            },
            "ipcManager" : {
               "permit" : 4,
               "ver" : 1
            },
            "ledControl" : {
               "permit" : 4,
               "ver" : 2
            },
            "localLink" : {
               "permit" : 4,
               "ver" : 1
            },
            "log" : {
               "permit" : 4,
               "ver" : 1
            },
            "mediaPort" : {
               "permit" : 4,
               "ver" : 1
            },
            "ntp" : {
               "permit" : 4,
               "ver" : 1
            },
            "online" : {
               "permit" : 4,
               "ver" : 1
            },
            "onvif" : {
               "permit" : 4,
               "ver" : 1
            },
            "p2p" : {
               "permit" : 4,
               "ver" : 1
            },
            "performance" : {
               "permit" : 4,
               "ver" : 1
            },
            "pppoe" : {
               "permit" : 4,
               "ver" : 0
            },
            "push" : {
               "permit" : 4,
               "ver" : 1
            },
            "pushSchedule" : {
               "permit" : 4,
               "ver" : 1
            },
            "reboot" : {
               "permit" : 0,
               "ver" : 1
            },
            "recExtensionTimeList" : {
               "permit" : 4,
               "ver" : 1
            },
            "recOverWrite" : {
               "permit" : 4,
               "ver" : 1
            },
            "recPackDuration" : {
               "permit" : 4,
               "ver" : 0
            },
            "recPreRecord" : {
               "permit" : 4,
               "ver" : 1
            },
            "restore" : {
               "permit" : 0,
               "ver" : 1
            },
            "rtmp" : {
               "permit" : 4,
               "ver" : 1
            },
            "rtsp" : {
               "permit" : 4,
               "ver" : 2
            },
            "scheduleVersion" : {
               "permit" : 4,
               "ver" : 0
            },
            "sdCard" : {
               "permit" : 4,
               "ver" : 1
            },
            "showQrCode" : {
               "permit" : 4,
               "ver" : 0
            },
            "simMoudule" : {
               "permit" : 4,
               "ver" : 0
            },
            "talk" : {
               "permit" : 4,
               "ver" : 1
            },
            "time" : {
               "permit" : 4,
               "ver" : 2
            },
            "tvSystem" : {
               "permit" : 4,
               "ver" : 0
            },
            "upgrade" : {
               "permit" : 0,
               "ver" : 1
            },
            "upnp" : {
               "permit" : 4,
               "ver" : 1
            },
            "user" : {
               "permit" : 6,
               "ver" : 1
            },
            "videoClip" : {
               "permit" : 4,
               "ver" : 2
            },
            "wifi" : {
               "permit" : 4,
               "ver" : 263
            },
            "wifiTest" : {
               "permit" : 4,
               "ver" : 1
            }
         }
      }
   }
]

Is this of any help?

Kind regards
Harry

Try looking at the cellMotion channel not the motion channel. ONVIF allows you to have different motion detection methods and treats them like different alarms.

But to read that channel I need to setup the camera as an ONVIF thing, since the Reolink thing does not have that channel, correct?

I tested it and it is working as an ONVIF thing, which is good enough for me. Reolink thing is not reacting to that channel.

Panning is working neither on ONVIF nor Reolink, although this is not a use case for me. I just wanted to let you know. If I can help you with testing shoot me a message.

Thanks for pointing it out, it needs to be added as all onvif channels should be available in reolink.

As for panning issues it is common for various brands to not support all onvif moving methods. If it is only panning effected and tilt works, then make sure you upgrade the firmware of the camera and test if it occurs in the onvif device manager software. Report to reolink support if it happens in ODM software. There are four different ways to move a camera, try another one as a work around by reading the docs.

Tested successfully tilt, pan, and zoom with onvif device manager. None of them is working on the E1 Zoom as ONVIF thing.

Which of the four methods have you tried? Which one was used in ODM? Absolute, Continuous or relative and presets?

@matt1 Currently, the Reolink implementation assumes an NVR is used if the channel is greater than 0 and ONVIF otherwise. However, NVR channel indexing starts at 0. So, I think there needs to be a specific switch in the Reolink Thing setup that toggles ONVIF capability. Note sure how you want to go about handling this.

@matt1 The Reolink implementation seems to always try to connect via ONVIF, even if it is attached to an NVR and ONVIF isn’t supported: Line 1464 in IpCameraHandler.java. Should I be setting the ONVIF port to 0 for all of my cameras so it doesn’t so this?

in the settings panel of PTZ, there is a single radio buttion which says “continuous move”. I am unsure on how to realize this with openhab. Shall I still use the dimmer for pan, zoom, tilt?

In the setup of the thing there will be a box to tick for Continuous ptz movements. If you only get offered the one in ODM then your camera probably does not support the other methods and hence why it won’t work till you tick the box to use continuous. I can make that the default for reolink if you confirm this is the case.

I found that box, but was unsure how continuous movement could work with a dimmer since the channels are still of that type. I will tinker with it once I have activated the controls again.

See here and also the oh3 widget thread for moving cameras.

When will these upgrades/changes for the Reolink camera’s (and doorbell) be integrated in the IpCamera binding?

Nice, the buttons for decreasing, increasing, and stopping are working fine.

1 Like

I am yet to setup a newer Java that is required as all development has changed now to openhab v4. 0

I would guess that the changes are at least two months away probably more as I am too busy right now to setup a separate test server so I have to migrate everything over to V4 to test and develop with.

It will never get merged into V3. X

That is no problem at all.
The Beta works for me.

Hello,

Sorry if this has been discussed, i did not have time to read the entire post, but does the Reolink video doorbell work with this plugin? I’m looking to buy a new video doorbell.

I just would like to get the button press captured to automate some rules (turn some light on, get voice notification on sonos, …)

thanks

A user reported that it does.

Thanks for pointing this out but I am confused as the API documentation under the RTSP stream section, states that

 "Note: The “channel number” starts from 01
example:
1.Preview ipc device video
rtsp://admin:xxxx@192.168.123.145:554/Preview_01_main"

Can you confirm what the working RTSP url is for your channel 0 on your NVR?

I have made the change that -1 is the default value and this will use ONVIF, then 0 and upwards will use the API.

I’ve tried installing this but just get this message in the log

==> /var/log/openhab/openhab.log <==
2023-03-29 15:36:28.134 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.ipcamera-4.0.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.ipcamera [334]
  Unresolved requirement: Require-Capability: osgi.extender; filter:="(&(osgi.extender=osgi.component)(version>=1.5.0)(!(version>=2.0.0)))"
	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.300.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.16.300.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.7.2]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.7.2]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.7.2]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.2]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.2]

Any ideas?
Thanks