IpCamera: New IP Camera Binding

I like to give feedback about my current tests and local setup.
Probably it will help other.

Camera I use (just bought few days ago):
Reolink 4MP Überwachungskamera Aussen, 2,4/5GHz WLAN CCTV IP Kamera Outdoor, Wetterfest, 30m Nachtsicht, Sicherheitskamera mit Bewegungserkennung, Audioaufzeichnung, Fernzugriff, RLC-410W Schwarz

The rstp-address to get the native stream of the camera in my network is:
rtsp://admin:YOUR_PASSWORD@192.168.178.53:554//h264Preview_01_main

In my openHAB-configuration I add a new binding of “IpCamera Binding”:

I decided to use “RTSP/HTTP IP Camera”:

I kept most of the default which work.
I changed only:

  • IP Address (to 192.168.178.53)
  • Server Port (to 9801, must be unused, will be occupied by the streaming, see later)
  • FFmpeg Input (the mentioned URL, i.e rtsp://admin:YOUR_PASSWORD@192.168.178.53:554//h264Preview_01_main)

Thats it.

In openHAB’s “Model” page I have added the camera with “Create Equipement from Thing” with the following channels:

I am more than suprised… It works very smoothly.
The stream address is provided in the “Model”:

It can be opened directly in the browser but as well in the habpanel:
image

With the use of the small html part:

<h2>Kamera #1</h2>
<img src="http://192.168.178.29:9801/ipcamera.mjpeg" 
     style="width: 100%; height: 100%;">

As you can see 9801 is the configured port at the beginning which is used to provide the stream. Any camera needs its own port.

In the background the stream is provided by ffmpeg as you can see in the process list:

This is all great!
I really appreciate this approach.

1 Like

Hi @matt1,

I’ve been using your binding for over 3 years now and I’m starting my migration from OH 2.5 to 3.1 using two different platforms.

Bindings used:
org.openhab.binding.ipcamera-2.5.4-SNAPSHOT.jar
org.openhab.binding.ipcamera-3.2.0-SNAPSHOT.jar

I have copied all the settings via the GUI between the platforms. OH 3.1 Things report to be online but NO images are being produced.

I really only use the IMAGE channel and that’s NOT working on any camera on OH 3.1 like it is on OH 2.5

I did install the FFMPEG on the new RaspberryPi for OH 3.1 but did not per se configure and test it. Not sure if the FFMPEG is really used for what I’m doing.

Here’s an example of one camera config.




Do you have any thoughts on this?

Best, Jay

Since you have a Hikvision, there was a bug that stopped them working in DIGEST mode recently and this was just fixed in the released 3.2m4 just released. So make sure your on the latest version, or you can switch to basic auth as a work around. Dropping the new jar into older cores can be done.

As for the image channel, what is the config set to that is called ‘updateImage’? also have you tried the channel called ‘updateImageNow’ and turning that on?

I really don’t recommend using the image channel for multiple reasons, one of which is it floods the event bus with the image data. With only a few cameras and longer poll times it is fine to do but it is a feature that I have not tested in a very long time so if you still can not get it working let me know so I can run a test here. You posted you have 9 cameras and poll times of 3 seconds, I really really don’t think it is a good idea to use the image channel in this case, I would be surprised if it worked without issues.

Why do you not want to use the other methods?

The version I got was off your site back in Oct, should I get it from here which is built today?

https://ci.openhab.org/job/openHAB-Addons/lastSuccessfulBuild/artifact/bundles/org.openhab.binding.ipcamera/target/

EDIT - If found M4 here

I really only want an image to be displayed (which the image gets updated between 3 - 5 seconds) on a panel I have 6 cameras showing. Really don’t need to stream video the the panel (tablets aren’t that powerful)

Here’s the ITEMS for a camera that is working with your OH 2.5 binding.

Image		HIKGarageImage										"Snapshot"									(Group_HabPanel_Dashboard)									{ channel="ipcamera:hikvision:10f6258d1a:image" }
Switch		HIKGarageMotion										"Motion [MAP(Motion.map):%s]" (IPCams, gHIKMotion, gLastMotion, Group_HabPanel_Dashboard, ResetExpire)	{ channel="ipcamera:hikvision:10f6258d1a:motionAlarm", expire="10m, command=OFF" }
String		HIKGarageImageURL									"[%s]"																									{ channel="ipcamera:hikvision:10f6258d1a:imageurl" }
Switch		HIKGaragelineCrossingAlarm 							"Line Crossing [MAP(Motion.map):%s]"		(IPCams, gHIKLineCrossingAlarm, ResetExpire)				{ channel="ipcamera:hikvision:10f6258d1a:lineCrossingAlarm", expire="10m, command=OFF" }
Switch		HIKGarageEnablelineCrossing							"Enable Line Crossing [MAP(Motion.map):%s]"	(IPCams)													{ channel="ipcamera:hikvision:10f6258d1a:enableLineCrossingAlarm" }
Switch		HIKGarageEnableMotionAlarm							"Enable Motion Alarm [MAP(Motion.map):%s]"	(IPCams, gHIKMotionAlarm)									{ channel="ipcamera:hikvision:10f6258d1a:enableMotionAlarm" }
Switch		HIKGarageUpdateImage								"Update Image Now [MAP(Motion.map):%s]"		(IPCams, gHIKUpdateImage)									{ channel="ipcamera:hikvision:10f6258d1a:updateImageNow" }

Best, Jay

Hey @matt1,

I remember having to install some extra JAR’s around the 2.5.x version.

Is the 3.2m4 just one JAR or is there some other support JARs I need to install also?

Best, Jay

It still needs the extra Netty library, but now different openHAB versions use different Netty lib versions it is far easier to just install the telstick binding which will take care of the Netty libs so the single jar works. You can download the jars from the mvn/maven website, or install them with the console using the info from this post making sure you only use a single version of Netty on your system. The mqtt binding also uses different parts of the Netty libs.

That link will be the fixed version and should work on all 3.x versions of the core.

IpCamera binding - Breaking changes and new features in 3.2 Milestone 3 and newer - Add-ons / Bindings - openHAB Community

Try using the autofps.mjpeg stream as it updates every 8 seconds when there is no movement, then will change to every second when motion is detected. Tablets will handle it fine and there are widgets for OH3 that can make setting it up easy.

Another way would be to use snapshots.mjpeg and set the pollTime to 3 seconds and the stream will be a picture change every 3 seconds.

Yet another way is to use an Image item or oh-image card that gets fed the ipcamera.jpg url and set to update every 3 seconds.

All three of these ways will stop the image data going through the event bus and result in less load.

1 Like

Hey @matt1,

Thank you for all the detail to follow. I’m struggling to get TellStick to work. I’ve tried using the GUI to install it and dropping in the JAR. Here’s the state of it which it shows its missing a Netty object.

Also, I do have MQTT and zWave bindings both 3.1 versions installed if this is causing the issue.

344 │ Installed │  80 │ 3.2.0                 │ org.openhab.binding.tellstick


2021-11-09 08:23:46.618 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.tellstick-3.2.0.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.tellstick [344]
  Unresolved requirement: Import-Package: io.netty.channel.kqueue; version="[4.1.0,5.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:440) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.8]

Here’s the Netty’s I have on my 3.1 system.

243 │ Active │  80 │ 4.1.63.Final          │ io.netty.buffer
244 │ Active │  80 │ 4.1.63.Final          │ io.netty.codec
245 │ Active │  80 │ 4.1.63.Final          │ io.netty.codec-http
246 │ Active │  80 │ 4.1.63.Final          │ io.netty.common
247 │ Active │  80 │ 4.1.63.Final          │ io.netty.handler
248 │ Active │  80 │ 4.1.63.Final          │ io.netty.resolver
249 │ Active │  80 │ 4.1.63.Final          │ io.netty.transport
275 │ Active │  80 │ 4.1.63.Final          │ io.netty.codec-socks
276 │ Active │  80 │ 4.1.63.Final          │ io.netty.handler-proxy
277 │ Active │  80 │ 4.1.63.Final          │ io.netty.transport-native-epoll
278 │ Active │  80 │ 4.1.63.Final          │ io.netty.transport-native-unix-co

Maybe as a simplier option, can you zip up the Netty stuff and put it up on your server like you have in the past with the older versions?

Best, Jay

Hi @matt1,

I have upgraded OH from 3.1 to 3.2m4 and now I have more Netty objects and the install of TellStick worked.

openhab> list -s | grep netty
258 │ Active │  80 │ 4.1.68.Final          │ io.netty.buffer
259 │ Active │  80 │ 4.1.68.Final          │ io.netty.codec
260 │ Active │  80 │ 4.1.68.Final          │ io.netty.codec-http
261 │ Active │  80 │ 4.1.68.Final          │ io.netty.codec-socks
262 │ Active │  80 │ 4.1.68.Final          │ io.netty.common
263 │ Active │  80 │ 4.1.68.Final          │ io.netty.handler
264 │ Active │  80 │ 4.1.68.Final          │ io.netty.handler-proxy
265 │ Active │  80 │ 4.1.68.Final          │ io.netty.resolver
266 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport
267 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport-native-epoll
268 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport-native-unix-common
331 │ Active │  80 │ 4.1.68.Final          │ io.netty.transport-native-kqueue

I uninstalled the IPCam 3.2m4 and re-dropped it in and got this in the event log.

2021-11-09 14:07:45.710 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:60179e611f' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.896 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:10f6258d1a' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.919 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:1e24e8460d' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.946 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:91b4b89a9d' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.978 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:0cf1f88e47' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:45.998 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:46e5506d6a' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.005 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:60179e611f:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.021 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:87cb66e306' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.053 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:0b51a19946' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.077 [hingStatusInfoChangedEvent] - Thing 'ipcamera:hikvision:2df5aa8a86' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2021-11-09 14:07:46.081 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:10f6258d1a:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.162 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:1e24e8460d:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.287 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:46e5506d6a:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.329 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:91b4b89a9d:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.335 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:0cf1f88e47:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.352 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:87cb66e306:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.361 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:0b51a19946:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []
2021-11-09 14:07:46.381 [nelDescriptionChangedEvent] - Description for field 'STATE_OPTIONS' of channel 'ipcamera:hikvision:2df5aa8a86:gotoPreset' changed from 'null' to '{"options":[]}' for linked items: []

Does this look right?

Best, Jay

Then just use the merged binding as it has the fix in it. Remove all extra jars and just install it as per normal.

Done.

  • Stopped IPCam 3.2m4 addon, uninstalled it then deleted it
  • Uninstalled TellStick from the GUI
  • Installed IPCam 3.2m4 from the GUI
  • Stopped OH
  • Cleared /Cache & /Tmp
  • Rebooted

Same issue, Things are online but no item channels are working with it.

This is pretty much a clean install on a new Pi4. I don’t even have rules running yet, just trying to get the Things and Items to work as first step.

What can I provide you to figure this out? Debugs, remote connection to my system, etc.?

Thanks again!

Best, Jay

Debug or trace log output would be the first step. The ipcamera binding documentation has at the very first section titled ‘how to get help’ which gives the command to enable the log output, then please start a new thread and feel free to mention my name in it or post a link to it from here.

Hikvision cameras have an illegal login lock that once tripped will mean you have to reboot the camera, worth doing in case that is the cause but the logs should be picking that up when you enable debug/trace.

Also you should try and open the stream by just typing the URL into any web browser, the binding should log that it got the request and then the following info may yield a clue as to what is wrong.

Hi @matt1,

I found out the issues with my HikVision NVR model DS-7208HUI-K2 configuration with migrating the binding versions from 2.5 to 3.x.

Here’s a summary of them.

v2.5 has two channels that are NOT named the same on v3.x

  • updateImageNow is now pollImage
  • videourl is now mjpegUrl (at least I think it is)

v2.5 does NOT need the updateImageNow turned ON to update the IMAGE channel but v3.x pullImage channel does.

v2.5 has a “Poll Time” value which is defaulted to 1000. The v2.5 binding has an option called “Update the JPG and Image when: Always update JPG” which is 1. v3.x has an option called “Update Image Channel When” which is defaulted to None but if you put it to follow pullImage which is option 1 to mirror v2.5 setting, this isn’t the same thing. You must have v3.x pullImage switch ON for this to work.

I did get these to work: [EDITED]

http://openhab:8080/ipcamera/cameraUID/ipcamera.jpg
http://openhab:8080/ipcamera/cameraUID/ipcamera.mjpeg
http://openhab:8080/ipcamera/cameraUID/snapshots.mjpeg

These did NOT get these working but I didn’t spend much time trying to debug why: [EDITED]

http://openhab:8080/ipcamera/cameraUID/ipcamera.m3u8
http://openhab:8080/ipcamera/cameraUID/autofps.mjpeg

I’m interested in how to push the ipcamera.jpg url into a native IMAGE item in the item file. Is it simply this format or something else?

Image HIKFrontDoorImage { http://openhab:8080/ipcamera/cameraUID/ipcamera.jpg }

Best, Jay

Those URL’s are wrong as they are missing the uniqueID of the camera. Since you are using 3.2m4 you can find the next gen documentation here
IP Camera - Bindings | openHAB

Replied to your other post on this.

I tested the image channel last night and it is working when the channel is turned on, as per the documentation. Yes this was changed at some point. I am also working towards making the binding be fully on demand and not poll at all so it would be best to change to a method that keeps the pollTime at 1000 ms as this is where I do all my testing.

My fault, this interface doesn’t like brackets around a variable, it striped the uniqueID out of the URL. I removed the brackets from the post.

Best, Jay

Hello there. Anyone in a mood to give a help? I am needed :smiley:

Trying to get any sitemap view of my DCS 932L (DLINK) cam in openhab. Openhab 3.1 running, ffmpeg installed and ONVIF Things is connected.

There is a http://192.168.8.100/image/jpeg.cgi snapshot url 100% functional.

I tried to follow already many times the IP Camera binding documentation (Console…Trace…Logs I got all done).

PD: I am trying both ONVIF and HTTP IP things in case the problem was the ONVIF.
I get no luck in any of then and no stream no image is generated.

Log:

2021-11-14 12:19:49.441 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.8.100:80/image/jpeg.cgi

2021-11-14 12:19:54.955 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request:GetSystemDateAndTime

2021-11-14 12:19:54.971 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: GET: http://192.168.8.100:80/image/jpeg.cgi

2021-11-14 12:19:55.045 [TRACE] [amera.internal.onvif.OnvifConnection] - Onvif reply is:

The request is forbidden.





I wanted to report the successful use of my ip camera with openHAB. But I can’t find where this request was expressed and therefore the details on how to do it. Anyone knows?

Hi,

Is there an option to override base URL of the ipcamera URLs?
I run Openhab in Docker with several network interfaces and have 3 distinct IP-s. In addition I access openhab with nginx reverse proxy through HTTPS.

So my ipcamera HSL URL looks like this:

http://192.168.1.8:8081/ipcamera/doorbell/ipcamera.m3u8

Chrome throws an error that http is not served inside a https page (Or something like that) so the stream does not start. If I open openhab with http only the stream is able to start.
What I need is to exchange base URL from the wrong IP and http url to https://fqdn

https://oh3.example.net/ipcamera/doorbell/ipcamera.m3u8

If I specify the above url manually in a video player card on the Web UI the stream is started correctly even though https. But I need to skip selecting the created HLSURL item. IT would be more convenient to use the item and not to override the given URL.

Thank you.
Zsolt.

You can create your own String item and put any URL you want into it by using a rule that triggers when the system is started.

Hi @matt1,

I’m having trouble getting this one to work.

In the documentation it refers to (serverPort=54324) but the GUI doesn’t have any place to set this value. I’m assuming because of the new URL handling this with version 3.2m4 of the binding?

How can I test the ffmpeg setup with the parameters in the GUI? Asking for command line syntax.

Here’s the settings for HIKVision NVR I have setup:



Best, Jay

Correct. You can see the updated version of the documentation if you click on the LATEST button in the top left corner of the website. Or this link takes you there…

IP Camera - Bindings | openHAB

Not sure I under5stand the question. If you enable DEBUG log level you will get the command that is trying to be run, plus you will get any errors that ffmpeg is throwing.

BTW you do not need to include the user:pass@ in any urls, the binding will take care of that automatically so the password is only in 1 place if you ever want to change it.

1 Like