IP Camera: No Stream, no motion detection, but warnings in logfile

Hi,

I’m starting with my new “sub-project” to integrate an IP camera into OH3 (running on an Raspberry 4B). The IP cam is a Reolink RLC-410W. The support docs say, that this model supports CGI, ONVIF and RTSP.

Unfortunately, I’m struggling with the integration since two days now, and have currently no idea. In a first step, I want to integrate a motion detection and a stream into OH3.

My first approach was to do the integration like for other device via text files (.things, .items). After one day without any success, I’m using web UI for an more agile approach (trial and error). But even by this way, I only run into errors :wink:

Things

UID: ipcamera:onvif:c2285df369
label: ONVIF IP Camera
thingTypeUID: ipcamera:onvif
configuration:
  mjpegOptions: -q:v 5 -r 2 -vf scale=640:-2 -update 1
  ipAddress: 192.168.xx.xx
  updateImageWhen: "0"
  onvifPort: 8000
  gifPreroll: 0
  ffmpegLocation: /usr/bin/ffmpeg
  serverPort: 9997
  ffmpegOutput: /etc/openhab/html/camera1/
  ipWhitelist: DISABLE
  mp4OutOptions: -c:v copy -c:a copy
  pollTime: 1000
  password: xxxxxxxx
  port: 80
  snapshotOptions: -an -vsync vfr -q:v 2 -update 1
  ptzContinuous: false
  onvifMediaProfile: 0
  username: admin
  hlsOutOptions: -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy
    -hls_flags delete_segments -hls_time 2 -hls_list_size 4
  gifOutOptions: -r 2 -filter_complex
    scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse
  ffmpegInput: rtsp://192.168.xx.xx:554/h264Preview_01_main

Additionally I’ve create some test channels and linked them to items, which are used by widgets in Habpanel and Sitemap.

Example: Motion Detection
In Habpanel I use a switch and dummy widget for the status of the respective motion detection item. But when I dance in front of the IP cam, nothing happens. Only the openhab.log file is flooded with the following two lines:

2021-04-21 21:39:37.099 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel cellMotionAlarm although the handler was already disposed.
2021-04-21 21:39:37.167 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel lastMotionType although the handler was already disposed.

Has anyone some ideas to push me into the right direction?

Amendment: After reading many IP cam topics here, I’m now more confused, cause by the possibility for other solutions (e.g. HTTP Binding, Zoneminder Binding, etc.) => What are the different advantages/disadvantages for IP cams in OH3.

Thanks in advance!

What version of openHAB are you using? Is it the latest milestone or older stable release? That warning may just need a restart of openHAB if you dropped different JAR files into the addons folder, without more info it is impossible to comment and you really need to support TRACE logs of when the camera is connecting for the first time which can be triggered by pausing the thing and then un pausing it.

Version is 3.0.1 (stable resp. Release build)

Which of the loggers should be downgraded to trace level? I did a test with trace level at the root logger and the logfiles explodes.

If I set the openhab.event logger to trace level, then the following lines occur when I disable and re-enable the thing (which looks OK for me):

2021-04-22 16:41:16.343 [TRACE] [ab.event.ThingStatusInfoChangedEvent] - Received event of type 'ThingStatusInfoChangedEvent' under the topic 'openhab/things/ipcamera:onvif:c2285df369/statuschanged' with payload: '[{"status":"UNINITIALIZED","statusDetail":"NONE"},{"status":"ONLINE","statusDetail":"NONE"}]'
2021-04-22 16:41:16.347 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:onvif:c2285df369' changed from ONLINE to UNINITIALIZED
2021-04-22 16:41:19.893 [TRACE] [ab.event.ThingStatusInfoChangedEvent] - Received event of type 'ThingStatusInfoChangedEvent' under the topic 'openhab/things/ipcamera:onvif:c2285df369/statuschanged' with payload: '[{"status":"UNINITIALIZED","statusDetail":"DISABLED"},{"status":"UNINITIALIZED","statusDetail":"NONE"}]'
2021-04-22 16:41:19.896 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:onvif:c2285df369' changed from UNINITIALIZED to UNINITIALIZED (DISABLED)
2021-04-22 16:41:23.622 [TRACE] [ab.event.ThingStatusInfoChangedEvent] - Received event of type 'ThingStatusInfoChangedEvent' under the topic 'openhab/things/ipcamera:onvif:c2285df369/statuschanged' with payload: '[{"status":"INITIALIZING","statusDetail":"NONE"},{"status":"UNINITIALIZED","statusDetail":"DISABLED"}]'
2021-04-22 16:41:23.624 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:onvif:c2285df369' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2021-04-22 16:41:27.655 [TRACE] [ab.event.ThingStatusInfoChangedEvent] - Received event of type 'ThingStatusInfoChangedEvent' under the topic 'openhab/things/ipcamera:onvif:c2285df369/statuschanged' with payload: '[{"status":"ONLINE","statusDetail":"NONE"},{"status":"INITIALIZING","statusDetail":"NONE"}]'
2021-04-22 16:41:27.658 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'ipcamera:onvif:c2285df369' changed from INITIALIZING to ONLINE

If I set the log level to trace for org.openhab and dance in front of the IP cam to create motion detection alerts, then openhab.log is filled with entries like this:

1-04-22 16:50:53.186 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:RuleEngine/CellMotionDetector/Motion, Data:IsMotion, Value:true
2021-04-22 16:50:53.188 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel lastMotionType although the handler was already disposed.
2021-04-22 16:50:53.190 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel cellMotionAlarm although the handler was already disposed.
2021-04-22 16:50:53.191 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2021-04-22 16:50:53.221 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?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/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/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:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="1">http://192.168.xx.xx/onvif/PullSubManager?Idx=00_2</wsa5:To></SOAP-ENV:Header><SOAP-ENV:Body><wsnt:RenewResponse><wsnt:TerminationTime>2021-04-22T14:02:21Z</wsnt:TerminationTime><wsnt:CurrentTime>2021-04-22T14:51:05Z</wsnt:CurrentTime></wsnt:RenewResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

2021-04-22 16:50:53.222 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2021-04-22 16:50:53.258 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?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/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/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:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="1">http://192.168.xx.xx/onvif/PullSubManager?Idx=00_2</wsa5:To></SOAP-ENV:Header><SOAP-ENV:Body><tev:PullMessagesResponse><tev:CurrentTime>2021-04-22T14:51:05Z</tev:CurrentTime><tev:TerminationTime>2021-04-23T11:21:21Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:RuleEngine/CellMotionDetector/Motion</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2021-04-22T14:51:05Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="VideoSourceConfigurationToken" Value="000"/><tt:SimpleItem Name="VideoAnalyticsConfigurationToken" Value="000"/><tt:SimpleItem Name="Rule" Value="000"/></tt:Source><tt:Data><tt:SimpleItem Name="IsMotion" Value="true"/></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Update: I found the hint for logging in the docs; I’ve now enabled logging for org.openhab.binding.ipcamera with trace level (compared to the former logging, it is reduced to the sub package, instead of org.openhab top package).

Here a fresh log snippet:

2021-04-22 21:03:07.461 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:RuleEngine/CellMotionDetector/Motion, Data:IsMotion, Value:true
2021-04-22 21:03:07.462 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel lastMotionType although the handler was already disposed.
2021-04-22 21:03:07.463 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel cellMotionAlarm although the handler was already disposed.
2021-04-22 21:03:07.464 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:Renew
2021-04-22 21:03:07.489 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?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/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/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:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="1">http://192.168.xx.xx/onvif/PullSubManager?Idx=00_2</wsa5:To></SOAP-ENV:Header><SOAP-ENV:Body><wsnt:RenewResponse><wsnt:TerminationTime>2021-04-22T14:02:21Z</wsnt:TerminationTime><wsnt:CurrentTime>2021-04-22T19:03:19Z</wsnt:CurrentTime></wsnt:RenewResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

2021-04-22 21:03:07.491 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2021-04-22 21:03:07.533 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?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/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/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:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="1">http://192.168.xx.xx/onvif/PullSubManager?Idx=00_2</wsa5:To></SOAP-ENV:Header><SOAP-ENV:Body><tev:PullMessagesResponse><tev:CurrentTime>2021-04-22T19:03:19Z</tev:CurrentTime><tev:TerminationTime>2021-04-29T21:13:21Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:RuleEngine/CellMotionDetector/Motion</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2021-04-22T19:03:19Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="VideoSourceConfigurationToken" Value="000"/><tt:SimpleItem Name="VideoAnalyticsConfigurationToken" Value="000"/><tt:SimpleItem Name="Rule" Value="000"/></tt:Source><tt:Data><tt:SimpleItem Name="IsMotion" Value="true"/></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

Did you reboot both openhab and also the camera?

Yes. Yesterday a couple of times for the OH server, but not the IP cam (nothing changed there). A day ago, where I’ve changed some settings directly at the IP cam, it has been rebooted a couple of times, too.

In the meantime I’ve done some more motion detection tests, but without any success. Even if I disable some features by setting the server port to -1, I get no results. I’ve tried different motion alerts like

  • audioAlarm
  • cellMotionAlarm
  • motionAlarm
    but all remains OFF. Only reaction is on lastMotionType which is set to cellMotionAlarm.

I’ve read the Reolink support docs again and found some deeper information:

  • There is an CGI-command PDF, where the available commands are shown. Just a general question in terms of the binding: Does API mean the same as CGI for IP cams (Reolink always use CGI there; I don’t mean the the technical difference on coding level)?
  • Another support doc says, that ONVIF protocol version 2.1 is used. But afaik the version of the ONVIF protocol is maintained in profiles with an capital letter. In traced xml in the log snippets (xsd versions) most times indicates version 10 and 20.

However, the following log snipped shows, that the cell motion alert works in principle, because the ONVIF message contains respective values. Seems like, that these results are not correctly processed.

2021-04-23 18:28:12.414 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:PullMessages
2021-04-23 18:28:12.456 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:<?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/ver10/device/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tls="http://www.onvif.org/ver10/display/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:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="1">http://192.168.xx.xx/onvif/PullSubManager?Idx=00_2</wsa5:To></SOAP-ENV:Header><SOAP-ENV:Body><tev:PullMessagesResponse><tev:CurrentTime>2021-04-23T16:28:25Z</tev:CurrentTime><tev:TerminationTime>2021-05-23T07:09:21Z</tev:TerminationTime><wsnt:NotificationMessage><wsnt:Topic Dialect="http://www.onvif.org/ver10/tev/topicExpression/ConcreteSet">tns1:RuleEngine/CellMotionDetector/Motion</wsnt:Topic><wsnt:Message><tt:Message UtcTime="2021-04-23T16:28:25Z" PropertyOperation="Changed"><tt:Source><tt:SimpleItem Name="VideoSourceConfigurationToken" Value="000"/><tt:SimpleItem Name="VideoAnalyticsConfigurationToken" Value="000"/><tt:SimpleItem Name="Rule" Value="000"/></tt:Source><tt:Data><tt:SimpleItem Name="IsMotion" Value="true"/></tt:Data></tt:Message></wsnt:Message></wsnt:NotificationMessage></tev:PullMessagesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

2021-04-23 18:28:12.457 [DEBUG] [amera.internal.onvif.OnvifConnection] - Onvif Event Topic:RuleEngine/CellMotionDetector/Motion, Data:IsMotion, Value:true
2021-04-23 18:28:12.459 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel lastMotionType although the handler was already disposed.
2021-04-23 18:28:12.460 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler IpCameraHandler of thing ipcamera:onvif:c2285df369 tried updating channel cellMotionAlarm although the handler was already disposed.

This line shows that the camera is giving the alarm and the binding is seeing it, the issue is the handler is disposed and hence it can not handle the alarm as that part of the code has been closed down or never started up (it is not running). The only time I have seen this is when I drag and drop JAR files in and out of the addons folder whilst the binding is running. A reboot fixes it here when it happens.

From memory you can not set the server port to -1 if you want the ONVIF alarms to work, it must be set for at least one of the onvif methods to work as there are multiple ways that onvif alarms can be implemented.

My gut feeling is there is something stopping the binding from running correctly and it is possible there will be an error or warning in the logs earlier on that will give a clue. Perhaps the java heap has run out of space and the handler can not start due to this ocurring earlier on. Look at the whole log and dont ignore any warnings and errors that occur when openhab starts up.

It would also be worth cleaning out the cache and tmp by searching this forum on how to do it.

I don’t believe this is a bug, but an issue on how the binding is running on your setup, find the cause and it should work as there are other people with that same camera that have reported that it works.

EDIT:

One last thing to try would be to use the newer JAR which will run under openHAB 3.01 stable. Just unzip all the files to your addons folder.
Index of /openhab/IpCameraBinding/ (pcmus.com)

That makes me confident to get it running!! And in fact, I’ve some news:

  • After cleaning the cache it looks like, that the motion detection works now (for cell motion detection; other one, are not activated). The former mentioned warnings regarding handler disposal do not occur anymore.
  • Directly after cleaning I get some other problems: The transformations didn’t run anymore. The log was full of warnings “… [WARN ] [rest.core.item.EnrichedItemDTOMapper] - Failed transforming the state ‘NULL’ on item ‘xyz’ with pattern ‘MAP(shelly.online.map):%s’: Couldn’t transform value because transformation service of type ‘MAP’ is not available.”. After a restart, these issue was fixed
  • Now, only two warning remain, a new one and a old one. But there are no entries like an OutOfMemory Exception (what I would assume, if something like the heap size do not fit)

This is the new one:

... [WARN ] [org.apache.karaf.shell.ssh.Activator] - Error starting activator
java.lang.IllegalStateException: Service not tracked for class interface org.osgi.service.cm.ConfigurationAdmin
	at org.apache.karaf.util.tracker.BaseActivator.getTrackedService(BaseActivator.java:369) ~[bundleFile:?]
	at org.apache.karaf.util.tracker.BaseActivator.ensureStartupConfiguration(BaseActivator.java:154) ~[bundleFile:?]
	at org.apache.karaf.shell.ssh.Activator.doStart(Activator.java:96) ~[bundleFile:?]
	at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:312) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

This is the old one:

... [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'QueryablePersistenceService.query()' on 'org.openhab.persistence.rrd4j.internal.RRD4jPersistenceService@d801a0': Value must be between 0 and 100
java.lang.IllegalArgumentException: Value must be between 0 and 100
	at org.openhab.core.library.types.PercentType.validateValue(PercentType.java:57) ~[bundleFile:?]
	at org.openhab.core.library.types.PercentType.<init>(PercentType.java:42) ~[bundleFile:?]
	at org.openhab.persistence.rrd4j.internal.RRD4jPersistenceService.mapToState(RRD4jPersistenceService.java:415) ~[?:?]
	at org.openhab.persistence.rrd4j.internal.RRD4jPersistenceService.query(RRD4jPersistenceService.java:272) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor79.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]

FYI / Note: In the meantime, Reolink has answered me, that this IP cam model supports ONVIF 2.1 profile S.

As next steps I’m going to

  • Play around with the motion detection to get more familar with that feature. And try to get the other motion detection types running
  • After that, getting pictures and streams included into my Habpanel and Sitemap. Streams looks complicated, because H.264 streams in high quality are not directly supported by browser or the default video widget in a sitemap. But, step by step, so first the motion detection features :slight_smile:

You really need to work out the cause and fix the warn and error that you posted. I dont believe they are related to the ipcamera binding as I have never seen them. Search the forum to see how others have solved them and create a new thread for the issue as they should not be ignored. Good to hear the original issue is fixed.

Not sure if it’s still an open topic, but wanted to share that I have successfully integrated two Reolink POE cameras models 410 and 520. Both are configured as ONVIF and perform as expected: they provide snapshot images and RTSP streams, and issue a Cell Motion Detection Alarm via ONVIF. Specific to Reolink, the cameras come configured with no password, so that is the first thing to configure. Secondly, the cameras do not successfully report neither a snapshot URL nor RTSP stream URL via ONVIF protocol, so those have to be configured manually. And lastly, the ONVIF port for Reolink is 8000 but the binding by default have it as 80, so that is important to configure for the motion detection alarm. For reference:

  • the snapshot URL is in the following format: http://[192.168.x.x]/cgi-bin/api.cgi?cmd=Snap&channel=0&rs=[some_random_string]&user=[user]&password=[password]
  • the RTSP stream URL is in the following format: rtsp://[user:password]@[192.168.x.x]:554/h264Preview_01_main
    :exclamation: Replace values in [] with your own

I use the following channels exposed by the binding:

  • Image
  • Poll image
  • Last Motion Type
  • Cell Motion Detection Alarm
1 Like

Hi Alexander,

thank you for your reply. In fact, the cam is working since a few month and I added a second cam of the same model to my OH instance. I forgot to mark the comment from @matt1 regarding cleaning the cache as solution (I’ve corrected this now).

Currently, I’m struggling with OOME in this context, but I’ve opened another thread for that (see IPCam: OutOfMemoryError and OH delays)

I feel that your issues may be related to your OH3 configuration/setup, because they are totally on a system level of things. I am still running the latest OH2, not OH3 and don’t experience any issues with configuring ONVIF cameras. In fact, the only tricky things about ONVIF cameras is to figure out their correct ONVIF parameters. I use ONVIF Manager Windows program first to check out a camera before adding it to the OH, that helps to configure the camera correctly from the first attempt.

That should not be necessary, the binding should auto find and configure the camera for you just the same as ODM program. If you have a camera that has an issue with the latest milestone builds of the binding, then feel free to create a github issue with some TRACE logs when the camera is getting discovered as then it can be looked at why that is happening. Perhaps it is due to different subnets being used and your firewall is blocking the discovery, it may be something simple.