IpCamera: New IP Camera Binding

New beta just uploaded with changes made from your feedback, thanks for helping.

Strange that it is able to be used just by adding an extra argument. I’ll check if that argument causes issues first and then make it the new default.

Great thanks for the feedback as it is always great to hear back it works and how well it works for others… What sort of CPU is Openhab running on and does the stream reach 1.0x speed quickly or does it take 10+ seconds to reach full speed if you watch the debug log? Also it is possible to compile ffmpeg with hardware encoders enabled which also may speed things up but this is something I don’t have the spare time to research.

New beta build has the following changes:

  • @tnemrap
    Latest beta has a new way of finding the local IP, it does not use it yet but will place it in the INFO log level when the camera connects, if it shows your local IP I can change the binding over to use the newer method. It will also put DEBUG logs in on what it finds as your network connections using the old method.

  • Fetch a snapshot if they are disabled and the binding is asked for ipcamera.jpg

  • snapshot url is now pointing to ipcamera.jpg after the server connects to make it inline with the other urls. Will display the cameras direct url until the streaming server starts.

  • Fix for bug that stopped ONVIF cameras coming online due to not getting a rtsp url. This uses newer onvif method.

Moving my quest on GitHub Issue #41 @ipCamera to the forums to not only bother poor Matt and maybe get some more help from the community.

I’m using OH2.5 on RPi4_4GB using Openhabian on SD card.
I’m only using the bindings

  • ipcamera
  • network
  • expire
  • astro

I have two HIKVISION DS-2CD2T46G1-4I/SL cameras deployed working properly through their own web interface as well as through my Synology Surveillance Station.

My situation:
ipcamera is working fine for some time. It does properly react to updateImageNow or updateGif. I have simple rules setup which detect the SMART alarm states, trigger a GIF creation and send this through Pushover. I have setup a Habpanel to manually trigger alarms or the updateImageNow or updateGif switches for testing.

Turning log:level to DEBUG on ipcamera you can see, that in this normal state the following statements occur:

2019-12-26 14:01:02.587 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET:
2019-12-26 14:01:02.587 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET:

My issue:
However, after an apparently random time passing, typically a few hours, one of the camera stops updating and get’s stuck - followed by the other one after some additional random time (up 12-20 hours later).

Taking a look at the OH logs, you no longer see the GET requests for the cameras (or just for one, if the other is “stuck”).

In this state, triggering the switches [e.g. through Habpanel] does not do anything. E.g. when triggering updateGif the snapshot files in the local folder do not change.

What i have tried / had a look at:

  • Looking at the OH log end Eventlog. There’s no hint towards errors (except for an IOException, but this does not occure every time:

2019-12-26 12:12:47.358 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - !!! Camera has closed the channel URL:/ISAPI/Streaming/channels/101/picture Cause reported is: {} java.io.IOException: Connection reset by peer

  • Matt has also hinted me in the direction of checking for OOM problems. However, nothing like that in the logs. I increased Xmx just to be on the safe side to 512. This did not solve the issue.
  • SYSLOG does not show a crash or something related to OH [karaf].

I’m happy for any suggestion of what to check next.

One idea:
Is there any reason, why any of the polling threads, that ipcamera binding creates, could stop or be stopped? Can i diagnose something like this (java threads being aborted or stopped, or whether they are running or not?)

Your best starting your own thread as in 1 weeks time this post wont be read anymore. Also you wrote that “it was working fine for some time” so what changed between when it was working fine to now? It is 100% your job to work out what causes this to happen to your setup and not mine and others.
I was going to suggest Syslog, but you have checked that good, but you should look for any errors not just OH related as any issues at an operating system level can effect what is happening inside the JVM. Perhaps it is the Wifi network overheating and crashing or something like that but I would expect to see the binding log something if that was the case, I am at a loss to know the cause.

Yes if a java library crashes due to a bug it could stop the programs flow and not create logs, but I have never seen this happen in the build only during development.
You can also get lockups in Openhab if you run out of timers or threads that are limited by using ‘sleep’ in rules, so you should strip back your system to see if it works fine and then enable things 1 by one until you find the cause that breaks it.

Without knowing what to change on my setup to make it break, or a log to show what is happening I can not help as there are too many possible causes it has to be narrowed down by your testing first.

Hi Matt, i sincerely apologize if i made the wrong impression here. Your work is appreciated a lot and i am by far not expecting you to solve my problem. I got the impression, that the issue is on my side or my setup from github, so i moved the discussion here to utilize the experience of the crowd to point me into other directions to analyze. Sorry for using your thread and if that was the wrong approach - I for sure can have the discussion outside. I was just hoping for some “try this” or “try that”.

Sorry for any inconvenience caused - that was absolutely not my intention.

All I ask is that people don’t waste mine or any volunteers PERSONAL unpaid time because they (not directed at you) expect others to read through log files that they don’t bother to read first. Literally the exact time the picture froze the camera was telling you the answer in plain English. How am I supposed to react when I find that after spending a number of hours looking into this for you?

A simple quick question, ask in this thread.
Something that may turn into 6+ posts with hundreds of lines of text, open a new thread. Then when the solution is found you mark the answer to help others.

New Build 2019-12-29 has these features:

  • Auto discovery should now be working for ONVIF cameras so it should be possible to add cameras with an automated search via your PaperUI inbox. Still would recommend textual config for reasons in the readme file.
  • Defaulted to disabling the whitelist as the default is to have all serving features turned off, so a user must enable and choose a port before any serving is done anyway.
  • Ip address of should hopefully not happen

Need people to give feedback on:

  1. If auto discovery is working for all their cameras.
  2. If PTZ is working for their cameras that have the feature.
  3. If anyone had as a IP previously if this is now fixed on their setups
1 Like

just a quick test:
Two Hikvision Bullet Cameras, one Hikvision PTZ camera and a Hikvision NVR.
The NVR, 1 bullet and the PTZ are correctly indentified as ““HIKVISION” IP camera with ONVIF and API support.”. One bullet is identified as ““ONVIF” Generic IP camera with ONVIF support.”. the bullet cameras are “non upgradeable” (chinese) and on different firmwares. Manual configuration works fine though.
PTZ controls does not work
IP:s are showing up correctly (i.e. NO

let me know if you want me to send you a log file.

Many thanks for your efforts!

If you could provide logs that would be great and will help create a better binding. Whilst I am working on PTZ it is the best time to do this to ensure your camera works well. Not all cameras support Absolute movements so it is best to first test with the free program called ‘onvif device manager’ and make sure that Absolute is selected before trying to move.

  1. Some trace log output from when you press the search button in PaperUI would be great.
  2. Some trace log output when the PTZ camera is connecting with the other cameras disabled would be great to keep the log cleaner. Disabling is as easy as using comments in the thing file. Use /* to start a comment block and */ to end it. Then remove and all your cameras will come back.
  3. Great, can you confirm it used to give you before this build? I can not reproduce it here so have no idea if it is fixed as I never had it happen.

New build 2020-1-4 has these changes:

  • Fixed bug stopping httponly cams from coming online. Tested with a esp32 camera.
  • Removed a lot of logging from the binding in the well tested areas so this should give performance gains for all cameras.
  • image channel now only updates 10% of the time to force the use of ipcamera.jpg instead.
  • hls now uses the strict option by default.
  • More error messages for when you setup a camera wrongly.
  • Discovery now uses the hostname in the result to help determine which camera is the one you want.
  • Onvif PRESETS !!! For cameras which don’t support absolute movement the binding can now move your camera with preset locations that you set with another program first like the free ‘onvif device manager’ program.

@toroid @japhias @nakh_Home @Zippochonda @lfs_alp5 @kristofejro @lsteelandt
I need people to test the new Onvif preset and the new Onvif Absolute move features that use a whole new set of Onvif methods which are written from the ground up and share nothing with the old method. Since you all posted issues with PTZ in the past it would be great if you could upgrade and test if one of these two methods works with your cameras. Whilst the code is fresh in my head it would also be a good time to send in debug logs if you want your camera to work and also help others that will want this feature in the future. Thanks…

Example line you can use in a rule:


example item file:

Number TestCamGotoPreset "Goto Preset" { channel="ipcamera:INSTAR:TestCam:gotoPreset" }


Selection item=TestCamGotoPreset 

Note: You can add mappings to the selection element as per the docs to give the presets a name in the drop down lists.

1 Like


I’m facing out of memory issues when using the binding. I have 8 cams (6 HD, 2 FullHD, all INSTAR) configured using the PaperUI. In PaperUI, I can see all cam’s image channels as expected.

Once I add this cams to an items file and add them as Image items to a sitemap, I get out of memory messages cashing the openHABian server completely.

2020-01-01 14:12:37.051 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - !!!! Camera has closed the channel     URL:/tmpfs/snap.jpg Cause reported is: {}
java.lang.OutOfMemoryError: Java heap space

Once I remove the channel from the items definition, I do not get problems.

//Image Cam_Kueche_Image { channel="ipcamera:INSTAR:65678965:image" }
//Image Cam_Wohnzimmer_Image { channel="ipcamera:INSTAR:Camera1:image" }
//Image Cam_Stall_Image { channel="ipcamera:INSTAR:0f11f3e4:image" }
//Image Cam_Tor_Image { channel="ipcamera:INSTAR:46b25e66:image" }
//Image Cam_Wirtschaftsbereich_Image { channel="ipcamera:INSTAR:123bdd32:image" }
//Image Cam_Koppel_Image { channel="ipcamera:INSTAR:e4016d50:image" }
//Image Cam_Haus_Image { channel="ipcamera:INSTAR:Camera2:image" }
//Image Cam_Heizung_Image { channel="ipcamera:INSTAR:ef203a6c:image" }

Image Cam_Kueche_Image
Image Cam_Wohnzimmer_Image
Image Cam_Stall_Image
Image Cam_Tor_Image
Image Cam_Wirtschaftsbereich_Image
Image Cam_Koppel_Image
Image Cam_Haus_Image
Image Cam_Heizung_Image

I have set and verified Java heap memory setting using -Xmx1024m, this is a Rasberry PI 4 B with 4GB RAM. I’m using the binding release 31/12/19, but it occurred for older versions too. Latest openHABian and openHAB stable release.

Any help appreciated.

  • Harry

You need to set the update image to false so the image channels are not used, then see the readme and this thread on how to display a picture or stream.

Just ordered this Hikvision camera. Anyone tried that with this binding?

All cameras that support the API should work just fine, that one is similar to my turrets from Hik it is probably the same just in a different form factor… Be sure to update the firmware when you get it as mine got much better motion detection after doing that.

1 Like

Will be glad to help!

Really appreciate!


1 Like

I have set the info level log

Excellent start, the thing is online. i can from paper ui create items and link them

100% • 75% • 50%

i have created a sitemap. and my understanding if that to get the refresh image,i need to trigger the

Item 'ONVIFGenericIPCameraWithONVIFSupport_UpdateTheImage linked to the channel “ipcamera:ONVIF:30d09132:updateImageNow”

Default item=ONVIFGenericIPCameraWithONVIFSupport_UpdateTheImage

Default item=ONVIFGenericIPCameraWithONVIFSupport_CreateAnAnimatedGIF

Image item=ONVIFGenericIPCameraWithONVIFSupport_SnapshotFromCamera

nothing special in the the binding log

2020-01-03 01:20:03.707 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at is now online.
2020-01-03 01:20:58.323 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at is now online.
2020-01-03 07:04:38.119 [INFO ] [ra.internal.IpCameraDiscoveryService] - IpCameraDiscovery started
2020-01-03 07:04:48.138 [INFO ] [ra.internal.IpCameraDiscoveryService] - Device found:http://Camera.SMH 
2020-01-03 10:07:49.909 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at is now online.
2020-01-03 10:08:45.693 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at is now online.

Feel free to correct me for i have missed something.
Let me know how to proceed and how can i assist you

Thanks again !

Try to move your camera with both PTZ features, how to do this is explained here as well as many other things.

Then if there is any problems moving the camera, I will need DEBUG level log output of when the camera is starting to connect, it will have some XML responses that I need to fault find with. Just put the log into a PM to keep the thread cleaner.


is there any cool IP Camera with a decent image quality, which allows setting all the image settings. Any recommendations? Thanks!

I am guessing that you wish to do this to lower the traffic across your network unless an alarm state is reached? Without a reason why I can only guess.

There are two ways to do this.

  1. Buy any camera (See note below) and buy a separate PIR sensor of some kind, zwave for example. Then with all updating turned off, it only fetches a jpg when you ask for one, so if you only ask for the ipcamera.jpg when the PIR is going off with a rule, then you get what you desire(?) and all cameras can do this. You may not need a PIR if your goal is to only have traffic when a UI is open to the picture as this happens automagically with the Openhab framework. Close the picture in the UI and the traffic stops. The animated gif feature would make this pretty simple in a rule to display the last motion alarm, when the alarm is trigged just flip the switch to make a Gif, then when it is done, it auto flips the switch back that can trigger another rule. The Gif can be high res if you change the default options which by default scales the GIF smaller.

  2. Buy a camera with an API and then the binding can do it internally without you needing to write any rules using the image channel. All the brands that have an API listed in the first post of this thread make models that have good picture quality. There are also cameras with the ability to stay in full colour at night time under certain conditions. Best forum to look is here where there are reviews posted with video examples https://ipcamtalk.com/forums/

that’s a nice idea, but no… sorry for being unspecific. I’d like to take neat pictures. My present camera doesn’t support ONVIF (at least not fully), and so I have to improvise.
A bit more context: the camera is installed on our mountain cottage - and I’d like to get some idea, if it’s worth the ride! :wink:
(present view)

My goal(s) are:

  • taking pictures every 5mins and uploading them to a google site, where I can watch them live (don’t want to expose the remote network directly to the internet)
  • making some cool hyperlapse videos

with my current camera I have to make compromises to have pictures which are viewable regardless it’s morning, noon or black night. This I’d like to automate (presently just static, but perhaps I can automate this with a bit of logic and imagemagick, which analyzes the pictures and adjusts the image settings accordingly…

Thanks for the forum-link, I’d dive into this…

1 Like