IpCamera: New IP Camera Binding

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 0.0.0.0 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 0.0.0.0 as a IP previously if this is now fixed on their setups
1 Like

hi,
just a quick test:
1:
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.
2.
PTZ controls does not work
3.
IP:s are showing up correctly (i.e. NO 0.0.0.0)

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 0.0.0.0 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:

TestCamGotoPreset.sendCommand(1)

example item file:

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

sitemap:

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

Hello,

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!

Downloading!!!

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 192.168.1.40 is now online.
2020-01-03 01:20:58.323 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at 192.168.1.40 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 192.168.1.40 is now online.
2020-01-03 10:08:45.693 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at 192.168.1.40 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.

thanks.

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:
grafik
(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

Interesting situation, always good to read how others use cameras…

You can buy cameras that will on their own upload every 5 minutes to a FTP server and you can set schedules to not do this at night time, as a view like that is not going to get lit up by any built in LED.

If you have Openhab running on a Pi you could setup the binding to Poll every 5 minutes and set the gif preroll to 143 and the postroll to 1. Then at a certain time of day automate the animated gif switch to create you a 12 hour long timelapse that gets sent via pushover to your phone. Pushover then can be set to only keep the last 10 messages automatically. Just open the app and you can have a look when it suits you.

I have never done it with that many snapshots before nor do I know if there is a limit to the size of a gif that pushover can handle, but if you have enough ram it should work as you will need 144* the size of a snapshot to hold all the images. The binding does not have any limits other than the size of a INT and your ram that Java can use.

Would love to hear if it works.

1 Like

@matt1

Sorry for the delay. i am a little bit lost

let me summarize in order to not waste your time if this camera is not supported.

  • From VLC, i can access to

rtsp://192.168.1.40:8001/0/avN with admin and Password blank

  • The PTZ works works ONVIF Device manager with admin and Password blank
    Found URI :http://192.168.1.40/onvif/device_service

i have tried all those url without success

As far, i understood my thing definition should be like :slightly_smiling_face:

Thing ipcamera:ONVIF:003
[
    IPADDRESS="192.168.1.40",
    USERNAME="admin",
	PASSWORD="",
    ONVIF_PORT=8001,
    PORT=80,
	FFMPEG_OUTPUT="/etc/openhab2/html/cameras/cam1/"
]

But my thing is offline


i have tried this approach to integrate rstp feed

the camera is well accessible also from an ONVIF android application

on the second side, a thing with the settings below is in status online


What i am missing? will be glad to help!

Hi Matt,
Has the multiple adapter issue been resolved in the latest version as I’m still unable to use the binding where my unit is selecting the wrong ip for the server?

Also, if you get a minute spare… I have a EZVIZ db1 doorbell. There is no web interface, but I can access the rtsp stream. I cannot add to binding due to this, however I wasn’t sure if there is a way to get motion detection into openhab. I’ve seen couple of posts regarding the motion in homeassistant with their library so maybe it’s a possibility but I don’t know what to look for.

Also you can add hik DS-2CD2032-I as compatible btw

@nakh_Home think you need to add SNAPSHOT_URL_OVERRIDE to your thing and set it to the url as in the bottom right of your Android app showing the snapshot url.

The camera thing in paperui is telling you the issue, it’s offline because it can’t set the url through onvif

1 Like

@Daniel_Linder you do know there is a hack for Chinese Hikvision cameras to permanently change them to english? I have 4 and I now upgrade with English firmware. It involves changing some hex values. Have done upgrades over the last 6 years now without any issue

Thanks now it’s Up!

with this thing definition :slightly_smiling_face:

Thing ipcamera:ONVIF:003
[
    IPADDRESS="192.168.1.40",
    USERNAME="admin",
	PASSWORD="",
    ONVIF_PORT=8001,
    PORT=80,
	FFMPEG_OUTPUT="/etc/openhab2/html/cameras/cam1/",
	SNAPSHOT_URL_OVERRIDE="http://192.168.1.40/onvif/snapshot"
]

but i can see this error in the IP CAM binding log

2020-01-06 23:21:59.229 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:21:59.867 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Channel status is -1 for URL:/onvif/snapshot
2020-01-06 23:22:00.624 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - initialize() called.
2020-01-06 23:22:01.627 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - About to connect to the IP Camera using the ONVIF PORT at IP:192.168.1.40:8001
2020-01-06 23:22:01.633 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:22:01.791 [INFO ] [ing.ipcamera.handler.IpCameraHandler] - IP Camera at 192.168.1.40 is now online.
2020-01-06 23:22:01.796 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - We got an ONVIF error404:Not Found
2020-01-06 23:22:08.787 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:22:10.787 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:22:12.787 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:22:14.787 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:22:16.787 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:22:18.787 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot
2020-01-06 23:22:20.787 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.1.40/onvif/snapshot

And some errors in the openhab.log

2020-01-06 22:52:21.299 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@113851c': String index out of range: 7

	at org.openhab.binding.ipcamera.internal.Ffmpeg.buildFfmpegCommand(Ffmpeg.java:86) ~[?:?]

	at org.openhab.binding.ipcamera.internal.Ffmpeg.<init>(Ffmpeg.java:74) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.setupFfmpegFormat(IpCameraHandler.java:1076) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.handleCommand(IpCameraHandler.java:1205) ~[?:?]

2020-01-06 22:52:35.018 [vent.ChannelTriggeredEvent] - logreader:reader:openhablog:newErrorEvent triggered 2020-01-06 22:52:21.299 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@113851c': String index out of range: 7

2020-01-06 22:52:35.029 [vent.ItemStateChangedEvent] - openhablogreaderLastError changed from 2020-01-06 22:51:52.718 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'mqtt_sensor_door_LastUpdate': The name 'mqtt_sensor_door_LastUpdate' cannot be resolved to an item or type; line 134, column 2, length 27 to 2020-01-06 22:52:21.299 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@113851c': String index out of range: 7

2020-01-06 22:52:35.070 [vent.ItemStateChangedEvent] - openhablogreaderLastError changed from 2020-01-06 22:52:21.299 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@113851c': String index out of range: 7 to 2020-01-06 22:52:21.632 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'mqtt_sensor_motionf2 update': The name 'mqtt_sensor_motionf2_LastUpdate' cannot be resolved to an item or type; line 103, column 13, length 31

2020-01-06 23:15:51.862 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7

	at org.openhab.binding.ipcamera.internal.Ffmpeg.buildFfmpegCommand(Ffmpeg.java:86) ~[?:?]

	at org.openhab.binding.ipcamera.internal.Ffmpeg.<init>(Ffmpeg.java:74) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.setupFfmpegFormat(IpCameraHandler.java:1076) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.handleCommand(IpCameraHandler.java:1205) ~[?:?]

2020-01-06 23:15:56.938 [vent.ChannelTriggeredEvent] - logreader:reader:openhablog:newErrorEvent triggered 2020-01-06 23:15:51.862 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7

2020-01-06 23:15:56.947 [vent.ItemStateChangedEvent] - openhablogreaderLastError changed from 2020-01-06 23:01:04.631 [ERROR] [org.apache.felix.configadmin        ] - [org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler, id=423, bundle=273/mvn:org.openhab.binding/org.openhab.binding.weather/1.14.0]: Updating property weather of configuration org.openhab.weather caused a problem: Unable to find any configuration settings for weather binding. Check openhab.cfg. to 2020-01-06 23:15:51.862 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7

2020-01-06 23:16:16.337 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7

	at org.openhab.binding.ipcamera.internal.Ffmpeg.buildFfmpegCommand(Ffmpeg.java:86) ~[?:?]

	at org.openhab.binding.ipcamera.internal.Ffmpeg.<init>(Ffmpeg.java:74) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.setupFfmpegFormat(IpCameraHandler.java:1076) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.handleCommand(IpCameraHandler.java:1205) ~[?:?]

2020-01-06 23:16:16.943 [vent.ChannelTriggeredEvent] - logreader:reader:openhablog:newErrorEvent triggered 2020-01-06 23:16:16.337 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7

2020-01-06 23:16:16.947 [vent.ItemStateChangedEvent] - openhablogreaderLastError changed from 2020-01-06 23:15:51.862 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7 to 2020-01-06 23:16:16.337 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7

2020-01-06 23:22:31.362 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@1e9d66': String index out of range: 7

	at org.openhab.binding.ipcamera.internal.Ffmpeg.buildFfmpegCommand(Ffmpeg.java:86) ~[?:?]

	at org.openhab.binding.ipcamera.internal.Ffmpeg.<init>(Ffmpeg.java:74) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.setupFfmpegFormat(IpCameraHandler.java:1076) ~[?:?]

	at org.openhab.binding.ipcamera.handler.IpCameraHandler.handleCommand(IpCameraHandler.java:1205) ~[?:?]

2020-01-06 23:22:36.967 [vent.ChannelTriggeredEvent] - logreader:reader:openhablog:newErrorEvent triggered 2020-01-06 23:22:31.362 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@1e9d66': String index out of range: 7

2020-01-06 23:22:36.976 [vent.ItemStateChangedEvent] - openhablogreaderLastError changed from 2020-01-06 23:16:16.337 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@bb60ca': String index out of range: 7 to 2020-01-06 23:22:31.362 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@1e9d66': String index out of range: 7