IpCamera: New IP Camera Binding

Tags: #<Tag:0x00007f744c40abb0> #<Tag:0x00007f744c40aac0> #<Tag:0x00007f744c40a9f8>

Someone posted a copy of their rule on this forum on how to take the image items state and create a jpg file. Easy to do what you want with a rule.

1 Like

@matt1 Thanks a lot. That could make my life easier.

Hi, thanks for this binding. Having a couple issues, I’m trying to work thru. Just looking to have a few cameras display on my sitemap (for now). I have 3 cams that work great (HIKVISION and FOSCAM), but having trouble with another (a SV3C oddball brand, HX series).

Setting up the Thing via Paper UI. I can get the camera to show as Online in Paper as a ONVIF type, but after entering camera data initially, I get:

Status: OFFLINE - CONFIGURATION_ERROR Camera failed to report a valid Snaphot URL, try over-riding the Snapshot URL auto detection by entering a known URL.

If I enter a valid URL in the Snapshot over-ride, the camera comes online. But after updating my items files, and sitemap, the stream comes up blank. I’ve tried to configure this cam using HIKVISION type, and even FOSCAM, and in both cases, again, the camera comes online, but blank streaming.

Cleared the cache, restarted OH. Don’t see any obvious errors in the logs, although I do not see any Get streaming URL’s in the logs like the other cams.

Any ideas??? Thanks for the help!!

You probably need to specify a URL for the streams. The other cams have the urls hard coded into the binding so it is not needed like other brands.

I just setup everything for my Ctronics IP Cam and I get this error:

2019-10-24 06:10:41.309 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Following NPE occured when trying to connect to the camera with ONVIF.java.lang.NullPointerException

2019-10-24 06:10:41.314 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Since an NPE occured when asking the camera about PTZ, the PTZ controls will not work. If the camera does not come online, give the camera the wrong ONVIF port number so it can bypass using ONVIF and still come online.

In my camera settings I have set the ONVIF to ON and the port is 8080
In the settings for the IPCamera I also set the port for ONVIF to 8080.

Why can’t it connect to it ? How can I solve this?

Yes, could not find a HTML stream for this guy. Returned the damn thing, and purchased a similarly priced Amcrest IP4M-1026W, and got it working in a few minutes. Camera web interface didn’t state the ONVIF port, but some trial and error it looks like it’s 8001. And for some reason, it would not connect properly as an Amcrest type, so I setup as DAHUA. But seems to be working well enough now.

You need to make sure the ONVIF port is 8080. 3 out of my 4 cameras listed the port number in the web admin interface of the camera. Smells like 8080 is not correct for you.

Yes in the Webinterface I can set the ONVIF port.
It is set to 8080.
That’s why I don’t understand why it is not working

Hi,

is there a chance to integrate P2P cameras like Freecam L910?

(http://www.lsvt.com.cn/pro_view.asp?dl_id=192&sort_id=203&shop_id=1915)

I now used a external program to check wether PTZ is working or not. And it is working perfectly.

Any suggestion on how to fix my error? Or how to find out why the binding is not capable of it?

2019-10-27 17:53:10.738 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Following NPE occured when trying to connect to the camera with ONVIF.java.lang.NullPointerException

2019-10-27 17:53:10.747 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Since an NPE occured when asking the camera about PTZ, the PTZ controls will not work. If the camera does not come online, give the camera the wrong ONVIF port number so it can bypass using ONVIF and still come online.

EDIT: @matt1 I could identify the issue why PTZ is not working on my camera it does not support the ABSOLUTE setting but it works with RELATIVE and with CONTINUOUS.

EDIT 2: I tried to setup the HLS Straming but I am getting this error:
IpCameras file server could not find the requested file. This may happen if ffmpeg is still creating the file.
How can I fix that one ? FFMPEG is installed and this is how my settings look like in paperui:

Just found my cctv not showing so had a quick look.
Seems the binding is choosing a random network adaptor to use rather than the default openh one in system settings. Any way to manually change?

Hi,
I can’t create animated GIF (Dahua camera)

23:27:39.123 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'CameraGarageUpdateGif' received command ON
23:27:39.125 [INFO ] [arthome.event.ItemStatePredictedEvent] - CameraGarageUpdateGif predicted to become ON
23:27:39.126 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.ipcamera.handler.IpCameraHandler@7b7a9a1f': null
java.lang.NullPointerException: null
	at org.openhab.binding.ipcamera.handler.IpCameraHandler.setupFfmpegFormat(IpCameraHandler.java:1031) ~[?:?]
	at org.openhab.binding.ipcamera.handler.IpCameraHandler.handleCommand(IpCameraHandler.java:1180) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [133:org.openhab.core:2.5.0.M3]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [133:org.openhab.core:2.5.0.M3]
	at com.sun.proxy.$Proxy242.handleCommand(Unknown Source) [?:?]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [184:org.openhab.core.thing:2.5.0.M3]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [184:org.openhab.core.thing:2.5.0.M3]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:152) [133:org.openhab.core:2.5.0.M3]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [133:org.openhab.core:2.5.0.M3]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

Things :

Thing ipcamera:DAHUA:001 "Caméra Garage" [ IPADDRESS="192.168.2.200", GIF_PREROLL=0, GIF_POSTROLL=6, PASSWORD="my_pass", USERNAME="admin", UPDATE_IMAGE=false, IMAGE_UPDATE_EVENTS=0, SERVER_PORT=50001, FFMPEG_OUTPUT="/tmp/camera1/", IP_WHITELIST="(192.168.2.2)(192.168.2.100)"]

Yes this high on the list to fix and no there is no manual way to select it. It will choose the first network that passes a ‘sitelocal’ query. ie uses an internal IP address.

Hi Matt
Thanks for the reply.
Not good when I have 4 adaptors running on my nas :weary:
Glad it’s on your high priority though, any idea on timeframe?
Cheers

I should have time over Christmas break, not sure how it will be handled as I was trying an automated way to select the network with out doing any pings. It may have to be looking in the logs for a list of cards and then entering a number as a config for people that find the auto method to not work. Can you post why there are four cards and how they are setup? It may help to consider your use case when doing this.

Could you add it as a free text box in the thing config much like the stream url override and wait for an adaptor to come up matching this, ie ‘server network address’?

I’m running openhab on a qnap NAS (ts-451), it has 4 adaptors each of which has a local address assigned as follows:
1: 192.168.6.0/24 - normal lan
2: 192.168.20.0/24 - smart home lan (openhab here)
3: 192.168.4.0/24 - cctv
4: 192.168.0.0 - vpn gateway (using qvpn on NAS for certain traffic)

The other trouble is if I was to add a docker image or a vm this creates a virtual adaptor too, which is what the binding chose (10.0.5.0/24), I believe as this was first to have an address as it didn’t have to query dhcp as it’s virtual.

hi all, i’m trying to use the binding with my ipcamera Shenzhen. i think a bluecam remark.
the camera reply to this command that i found in an other forum.
Identifier: BLUECOM.GMT

Default ip_address: 192.168.1.250

Default user interface credentials: admin/

Default command credentials: admin/admin


nmap -sN -r -n -p-1-65535

(null scan (TCP flag header is 0) , do not randomize, no DNS resolution, all ports)

-O - enable OS detection

nmap port open results:

6554 - tcp (video streams)
8080 - http-proxy
9527 - tcp (command)

On power up the camera first tries to find 192.168.1.1 and then tries to contact:

116.62.7.175 - Beijing Kuancong
13.58.115.239 - amazon.com - USA
35.177.224.169 - amazon.com - Europe

OCX download www.cam158.com


High and low resolution video streams

ip_address:6554/stream-0
ip_address:6554/stream-1
ip-address:6554

Command port (use login user and password – configuration and control items)

ip_address:9527/index.htm
ip_address:9527/index1.html
ip_address:9527/jpeg.html
ip_address:9527/snapshot.htm
ip_address:9527/status.htm – Device status
ip_address:9527/ip.htm – Basic Network Settings - Obtain IP from DHCP Server (uncheck for manual), http port: 9527
ip_address:9527/wireless.htm – Wireless LAN - Using Wireless Lan (check) - SSID, Authentication
ip_address:9527/ddns.htm – DDNS Service activation, parameters
ip_address:9527/Onvif.htm – ONVIF Stream settings ‘open’
ip_address:9527/RTSP.htm – RTSP Stream ‘open’ - port 10554 (must be wrong, should be 6554)
ip_address:9527/ptz.htm – PTZ - not available
ip_address:9527/multidev.htm – Multi-Device Settings (accessible from Internet)
ip_address:9527/user.htm – Administrator, Operator, Visitor
ip_address:9527/alias.htm – Alias Settings - IPCAM
ip_address:9527/datetime.htm – Timezone, NTP Server
ip_address:9527/recordpath.htm – Local record path - file length, time, reserved space, cover
ip_address:9527/recordsch.htm – Record schedule SD card format, capacity, recording options, time schedule
ip_address:9527/voice.htm – Voice setting (Mute, English, Chinese)
ip_address:9527/alarm.htm – Motion detect, audio detect, mail notification, upload image, arming time schedule
ip_address:9527/mail.htm – Mail service settings
ip_address:9527/ftp.htm – FTP service settings
ip_address:9527/log.htm
ip_address:9527/ipc_reboot_dev.cgi?next_url=reboot.htm
ip_address:9527/ipc_reset.cgi?next_url=rebootme.htm
ip_address:9527/upgrade.htm – Upgrade Device Firmware, Embedded Web UI (Browse)

ip_address:9527/get_ipc_status.cgi
ip_address:9527/ipc_control_video.cgi?loginuse=admin&loginpas=admin&param=xxxx&value=yyyy
param=18&value=1
param=17&value=1
param=14&value=0 PIR off
param=14&value=1 PIR on
ip_address:9527/ipc_control_ptz.cgi
ip_address:9527/get_ipc_status.cgi
ip_address:9527/get_ipc_params.cgi
ip_address:9527/get_ipc_encode_params.cgi
ip_address:9527/get_ipc_factory_param.cgi
ip_address:9527/get_ipc_record.cgi
ip_address:9527/videostream.cgi?loginuse=admin&loginpas=admin -
ip_address:9527/snapshot.cgi?loginuse=admin&loginpas=admin - get jpeg image (704x576)


Get a jpeg image (for motion detection)

curl “http://192.168.1.250:9527/snapshot.cgi?loginuse=admin&loginpas=admin” -o test.jpeg


get_status.cgi? -> admin/ - reset
login.cgi
get_camera_params.cgi

public.cgi
get_ipc_loginmessage.cgi
jquery/jquery.min.js
public.js

This is my configuration

and this is the openhab’s log… the camera is online but not images, not moving etc…

2019-11-08 10:27:42.701 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.22/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:42.733 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:42.739 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened the closed channel:0 GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:42.751 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: failure(java.lang.IllegalArgumentException: a header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f: ,), version: HTTP/1.1)

HTTP/1.1 200 OK

Server: GoaHead

2019-11-08 10:27:42.802 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 URL:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.701 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.22/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.726 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.729 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened the closed channel:0 GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:47.739 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: failure(java.lang.IllegalArgumentException: a header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f: ,), version: HTTP/1.1)

HTTP/1.1 200 OK

Server: GoaHead

2019-11-08 10:27:47.791 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 URL:/snapshot.cgi?loginuse=admin&loginpas=admin

==> /var/log/openhab2/events.log <==

2019-11-08 10:27:52.648 [vent.ItemStateChangedEvent] - Azimuth changed from 153.9958881237165 ° to 154.24468189742086 °

2019-11-08 10:27:52.661 [vent.ItemStateChangedEvent] - Elevation changed from 23.964394694529478 ° to 24.04038843790722 °

2019-11-08 10:27:52.670 [vent.ItemStateChangedEvent] - Diffuse_Radiation changed from 105.94218879750758 W/m² to 106.08175261299178 W/m²

2019-11-08 10:27:52.678 [vent.ItemStateChangedEvent] - Total_Radiation changed from 267.8630844990612 W/m² to 269.08593069868414 W/m²

==> /var/log/openhab2/openhab.log <==

2019-11-08 10:27:52.701 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Sending camera: GET: http://192.168.0.22/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:52.715 [TRACE] [ipcamera.internal.MyNettyAuthHandler] - MyNettyAuthHandler is now setup for GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:52.719 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Have re-opened the closed channel:0 GET:/snapshot.cgi?loginuse=admin&loginpas=admin

2019-11-08 10:27:52.729 [TRACE] [ing.ipcamera.handler.IpCameraHandler] - DefaultHttpResponse(decodeResult: failure(java.lang.IllegalArgumentException: a header name cannot contain the following prohibited characters: =,;: \t\r\n\v\f: ,), version: HTTP/1.1)

HTTP/1.1 200 OK

Server: GoaHead

2019-11-08 10:27:52.781 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - commonCameraHandler closed channel:0 URL:/snapshot.cgi?loginuse=admin&loginpas=admin

What i’m wrong? Someone could help me?

HIgher Resolution on SnapShot Images

I’ve been running this binding for a few years now; works fantastic! I have the HIKVision system connected to it and I’d like to get better resolution on the SnapShot image item.

My 8 cameras are setup in PaperUI tied through a NVR.

Is this possible? If so, how?

Best, Jay

Hi. I upgraded to the newest version of the binding and created two things that connect to Hikvision cameras. The resolution of the camera picture is 4K, downloaded picture sizes are around 250k each, update interval 4s. The problem is that after a few hours all java heap is consumed and OH stops working. Also, the ongoing load is above 115% of 4-core RPI (while without the IP camera things it is 15%). Something apparently is consuming memory and CPU time. How can I help to diagnose that?

@ppieczul
You need to turn off the image channel from updating, I find it halves the CPU load and also stops a memory leak. This is covered in the readme for the binding and as it literally turns off 1 line of code that sends the snapshot to the Openhab Image item I am certain this is in the Openhab framework and not the binding. The Image item was never designed to take large pictures changing often.

@jwiseman
Ask HIK support, it will be a change in the cameras settings.