IpCamera: New IP Camera Binding

camera
ip-cam
onvif
Tags: #<Tag:0x00007f0147ed0810> #<Tag:0x00007f0147ed2480> #<Tag:0x00007f0147ed3790>

(Skinah) #381

Yes it is that and also in your sitemap there is a refresh on the item, I changed both. Here is an example of how I run two cameras for days on end with no issues. The exact cause I do not know yet, but if you confirm this makes a difference to you I can start narrowing down the cause.

things

Thing ipcamera:HIKVISION:002 [IPADDRESS="xxx.xxx.xxx.xxx", PASSWORD="foo", USERNAME="bar", POLL_CAMERA_MS=2000]

items

Image CamImage { channel="ipcamera:HIKVISION:002:image" }

sitemap

Image url="http://google.com/leaveLinkAsThis" item=CamImage refresh=2000

(Matt) #382

Got it. I’ve actually never configured a site map. I just make HabPanels and that’s the only UI that I use on a regular basis. So in that case, it would be the refresh rate specified in the habpanel widget rather than sitemap, right?


(Skinah) #383

Yes but I don’t use habpanel yet, have a tablet ready to play with it soon.


(Kim Andersen) #384

Can you give me an example on how to set it up as HTTPONLY.
Browsing foscam, there is a specific URL for fetching jpg snapshot:

http://ip address:port/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=admin&pwd=xxx

How would this be setup in the ipcamera.things file?


(Skinah) #385

try this, but I suspect the url is wrong as that is for HD foscams. This link may have one that works, but please try entering it into a browser first to prove that the url works.

Thing ipcamera:HTTPONLY:002 [ IPADDRESS="192.168.1.22", PASSWORD="suitcase123456", USERNAME="admin", SNAPSHOT_URL_OVERIDE="http://192.168.1.22/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=admin&pwd=suitcase123456", PORT=80]

(Kim Andersen) #386

Could be the above is for the newer HD cams. Foscam isn´t quite clear on this, since latest firmware is newer than the old mentioned methode.

The other options I found is using

http://snapshot.cgi?usr=[USERNAME]&pwd=[PASSWORD]
or

resolution 320x240: http://ip:port/snapshot.cgi?&amp;resolution=8
resolution 640x480: http://ip:port/snapshot.cgi?&amp;resolution=32

These are from Foscam forum in a thread beeing 5 years old.
I guess I just have to try :smiley:


(Kim Andersen) #387

These are fully working url´s for Foscam FI8918W, (and probably same age Ipcameras from Foscam). In case others might be interested:

http://IP/snapshot.cgi?usr=admin&pwd=password

And this is URL for video stream: (not an option through the binding).

http://IP/videostream.cgi?user=admin&pwd=password" encoding="mjpeg"

This is the things file:

Thing ipcamera:HTTPONLY:001 [ IPADDRESS="IP adress", PASSWORD="password", USERNAME="admin", SNAPSHOT_URL_OVERIDE="http://IP adress/snapshot.cgi?usr=admin&pwd=password", PORT=80]

(Skinah) #388

@Pedals2Paddles

For anyone that gets OOME (out of memory errors) with the java heap space, then this is how I solved it to allow me to drop the refresh down to 1000ms. I have had my two cameras running for >24 hours without issues. I suspect this has to do with javas garbage collection not running often enough to deal with the large amounts of data passing through the image item if you are running your system close to the max allocated heap size.

In the openhab console run this command (optional just for your info)

shell:info

It gives you output like this…

Karaf
  Karaf version               4.1.5
  Karaf home                  /usr/share/openhab2/runtime
  Karaf base                  /var/lib/openhab2
  OSGi Framework              org.eclipse.osgi-3.12.50.v20170928-1321

JVM
  Java Virtual Machine        OpenJDK Client VM version 25.152-b76
  Version                     1.8.0_152
  Vendor                      Azul Systems, Inc.
  Pid                         418
  Uptime                      13 hours 15 minutes
  Total compile time          12 minutes
Threads
  Live threads                175
  Daemon threads              71
  Peak                        199
  Total started               6482
Memory
  Current heap size           183,100 kbytes
  Maximum heap size           243,520 kbytes
  Committed heap size         238,552 kbytes
  Pending objects             0
  Garbage collector           Name = 'Copy', Collections = 8778, Time = 4 minutes
  Garbage collector           Name = 'MarkSweepCompact', Collections = 437, Time = 7 minutes
Classes
  Current classes loaded      20,333
  Total classes loaded        20,509
  Total classes unloaded      176
Operating system
  Name                        Linux version 4.14.52-v7+
  Architecture                arm
  Processors                  4

Run this in linux to open the file for editing after typing in logout to exit the console. (required: this is changing the heap size)

sudo nano /etc/default/openhab2

Change the already existing line to have this if it is empty. The -Xmx512m gives the heaps more space to grow up to a max of 512mb. (required: this is changing the heap size)

EXTRA_JAVA_OPTS="-XX:+HeapDumpOnOutOfMemoryError -Xmx512m"

Save and exit using the commands listed at the bottom of the screen, then…

sudo reboot

Lastly you can check the ram usage with this command… (optional)

free -h

example output after doing the above and a reboot on a pi2 is

              total        used        free      shared  buff/cache   available
Mem:           976M        373M        374M        9.7M        228M        545M
Swap:           99M          0B         99M


(Matt) #389

Still bombing out.

I can run one camera thing and corresponding image item. Refresh set to 2000ms. Works fine. If I add a second camera thing and item, even with refresh intervals sets set for 5000ms, it keels over and dies with heap space errors. Could this be an SD card issue? You’re able to do it just fine, so I’m inclined to believe there is something wrong on my end. All cameras are Hikvisions FYI.


(Skinah) #390

Yes it could be SD card as corruption can cause any kind of problem with any symptom, however since you can get 1 going fine I would not go looking at that first.
What happens if you try only the 2nd camera by itself ? Unfortunately not all HIK cameras are the same due to hacked firmwares being very common, also they are all different Megapixel amounts.
You are going to have to try and narrow the cause down.
Is it only 1 camera that does it?
Does removing all other bindings allow it to work?
What java and hardware do you use? I know very little about your setup.

Best you open a new thread and post more details in it as any serious look into something like this needs a thread so things dont get lost amoung other peoples replys.


(Skinah) #391

New Build 26-07-2018 has following changes:

  • Amcrest: fix for older firmwares that was stopping alarms from being seen.
  • Hikvision: fix for external alarm input feature.
  • Readme updated with better info and examples for items and sitemaps.

All other cameras should not be effected and if your working fine, no need to change.


(_) #392

Hello All,

i’m planning to buy Dahua ipcam with face detection but in any of API ( i found 1,67 newest - https://www.telecamera.ru/bitrix/components/bitrix/forum.interface/show_file.php?fid=1022477&action=download)

I can’t see any face detection part.


(Elie Hanna) #393

Hello,

First of all many thanks for the effort to release such binding.

However i have a Hik Vision NVR, and i started the configuration to integrate the Cameras connected to the NVR with Openhab. At first i struggled to make them worked then after my several trials by changing some parameters i found that the cameras worked normally and i could configure 4 cameras. But later on i found them gone again. in the front tail logs this message keeps pop up

2018-08-01 21:58:16.878 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - !!! Channel was found idle but could not located it to close it down
2018-08-01 21:58:16.882 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Can’t find ch when removing handler URL:null

The IP Cameras Things are all time online but am not able to see the images again.

Please help !!


(Skinah) #394

@Hollako
First reboot your server, then with frontail do a search for warn and error as often things eariler on in the log can cause other things to break. Does a reboot fix it? If not then please feel free to send me some TRACE level log output via personal message to keep this thread cleaner and I can use that to look for any issues that may steam from something ‘unique’ that your camera does. The first post in this thread explains how to change the log to TRACE and back again.


(Jozef Samijn) #395

I have just installed openhab2 on a rasp pi1. I can’t get the image to update. I store all the images and videos on a NAS within the configuration of my hikvision camera’s. Is there something I should change in the Openhab things setup? I am using paperui as I am new to this. Maybe the below extact from the log will help.

2018-08-05 00:44:51.931 [ERROR] [l.internal.messaging.saaj.client.p2p] - SAAJ0008: Bad Response; Bad Request
2018-08-05 00:44:52.065 [ERROR] [ing.ipcamera.handler.IpCameraHandler] - Camera replied with NULL when trying to get a list of the media profiles
2018-08-05 00:44:52.139 [WARN ] [ing.ipcamera.handler.IpCameraHandler] - Following NPE occured when trying to connect to the camera with ONVIF.java.lang.NullPointerException


(Skinah) #396

With HIKVISION the onvif is disabled and you also need to create a user and pass before it accepts connections. In the first post of this thread is a video link that shows it being done. The api is also disabled by default and needs to be enabled.


(Jozef Samijn) #397

@matt1 thanks, image works now. With the hikvision cameras I have, there is also an intrusion detection. Is this available in your binding. If not can I help to get it in the binding?
cheers,
Jef


(Skinah) #398

My camera has the same alarm so happy to add that which is around a one hour change for me to make. Not sure when I will have the time but should be able to look at it in the next week or two. Been busy getting my server running on an odroid c2 to give me a lot more ram for the cameras and this now seems to be up and running. The other features I am considering are Flash card features have to do a review of all brands to plan how best to implement it in a consistent way between brands.


(Antanas) #399

Hello,
does anyone face the challange seeing camera’s feed (picture) in PaperUI (locally and via myopenhab.org) however not able to see picture via mobile app?

thanks


(Kiril Tsvetanov) #400

I’m using an model trx-jo013mpx-13 camera.
You can see the camera here!

When i use:
https://www.telecamera.ru/bitrix/components/bitrix/forum.interface/show_file.php?fid=1022477&action=download from above i was able to see it with
““AMCREST” IP camera with ONVIF and API support.”
but i can’t connnect an “item” to the “thing”. What i need to type in my “conf” files?