IpCamera: New IP Camera Binding

Tags: #<Tag:0x00007fe7323538f8> #<Tag:0x00007fe732353768> #<Tag:0x00007fe732353628>

Frankly I don’t know what to look for. There is no option for what API is exposed in the DVR. At the same time there are alarms that can be configured. Also, the access to the DVR by specifying input channel works fine and binding can retrieve the paths to video and image. Can it have something to do with the fact that I unlinked all the alarm channels? Or maybe DVRs can have different capabilities and binding could take that into account? As a workaround I will increase the log severity to error.

This thread may interest users of this binding. It would be great to get an idea of how hard it is to get this running on different cameras and on a raspberry Pi.

after the binding installation the log tells me this…
why?

Interesting, what brand and model camera and what is the snapshot URL that the binding is using? It could possibly be that the URL is a “subscribe” to a snapshot and not asking for only a single jpg file. The camera is sending multiple jpg files without the binding asking for it, at least that small amount of the log indicates this.

New feature to discuss in new thread linked below. Love to hear from anyone who has been using or trying to setup Habpanel with cameras…

New Build 2019-03-10-Beta, has these changes which INCLUDES BREAKING CHANGES.

  • New streaming server ability which is described in more detail in the post/thread just above this one. This is turned off by default and the binding should work the same as ever with this turned off, but consider this BETA the moment you enable the proxy server feature by chaning the port from -1.
    To use the new streaming features you need to change the new SERVER_PORT config from -1 to a valid and unused port number. Warnings in the log should guide you as well. This only works on 1 stream at a time and it is Beta but it appears fine for a single stream to gain feedback. Your camera needs to produce a MJPEG stream and for it to be useful until ffmpeg support is added. Only known issue at this point is you need to reboot if you change the port for it to take effect, possibly other settings are the same so if in doubt, reboot.

example textual setup for a things file is…

Thing ipcamera:DAHUA:001 [IPADDRESS="192.168.1.2", PASSWORD="password", USERNAME="foo", POLL_CAMERA_MS=2000, SERVER_PORT=54321, IP_WHITELIST="(192.168.1.120)(localhost)(192.168.1.33)(192.168.1.74)", IMAGE_UPDATE_EVENTS=0]
  • Fix typo in multiple config names that contained OVERIDE ie. SNAPSHOT_URL_OVERIDE is now SNAPSHOT_URL_OVERRIDE. If you used config files, it should be as easy as opening the file adding the extra letter and saving.

  • Changed multiple channel names to now be camelCase so they are now consistent and all the same format.If you used item files, it should be as easy as opening the file and using find and replace. All the important channels did not change so it is unlikely it will effect many people.

  • videourl channel is now rtspUrl to save confusion with the new channel for streaming. Since it was not useful I this change won’t effect many people.

Note: If using paperUI to setup the cameras and not textual config you probably will hit issues until you delete the camera and setup from scratch, this is due to new channels and multiple changes outlined above. I can’t stress enough how much easier it is with textual config when a binding is changing often.

I have tried for several hours to get my FOSCAM P1 camera connected to openhab but it won’t work.

I tried to configure the camera via text configuration and also via de paper UI. In the paper UI when I input all settings and click save it it says error500 request failed. Im able to acces the log files but I can’t make heads or tails of it.

I’m from holland so my English may be a bit off sometimes…

Thank you for all your help.

My camera does support ONVIF an API support as far as I can see. Help setting up this camera would be nice. Where to start?

Update

After some fooling around with the camera I noticed the following thing:

Adding a simple HTTPONLY camera gives the same result, upon adding and clicking safe it says connection error. Saving an second time gives a 409 conflict error. When trying to setup my camera with a android ONVIF app it errors out on trying to connect via RTSP over HTTP, then it defaults to RTSP over TCP and succeeds… This might be usefull to know? Im on Ubuntu 18.04 btw. Installed Openhab via ubuntu. NOT Manually.

Thank you for any help.

Hi,

I have received a Hikam A7 from the 2nd Generation for a very cheap price. This supports ONVIF but I am not completely able to add it to my OpenHab.

I have installed your binding. I used the information from the camera vendor itself: http://supportus.hi-kam.com/en/support/solutions/articles/16000072606-how-to-watch-live-streams-with-onvif-clients-for-s6-a7-2018-version-

I took the generic ONVIF setting in your binding. It seems to work so the Video URL was recognized automatically:
video_url

But where can I get the live stream or a picture from the camera?

Edit: Maybe is it possible to run FFMPEG directly on the Openhabian for the convertion of the RTSP to HTTP?

This shows that you are not using the latest build which has the first of a number of streaming features. I have updated the readme and documentation so they are now only accurate with the latest build due to the breaking changes I listed in my post above…

The binding will handle snapshots very well but if the camera does not report a url via ONVIF then you will need to manually enter the snapshot url until rtsp features are added. The same goes for the mjpeg http based stream, it will need to be manually entered for cameras that are not HIK, Dahua or Amcrest until further features are added to give rtsp.

Create your own thread and include in it your items and things file contents (remove passwords).

I suspect the conflict errors are from you trying to modify with PaperUI after you have already setup items and things files, the readme warns you against this, so please take the time to read the readme file at the github project, link found in first post of this thread.

Thank you for your reply, but I tried both ways (PaperUI & Files) But I could not get it to work. Out of pure frustration (other things didn’t work either) I deleted the whole stuff and started from scratch again… hahah. But thank you for your reply.

You mean the beta?

Yes the beta is only marked that way as the new features are not running very well on slower hardware for me, under a fast machine it works fine. If you run it with the newer features disabled I would not call it beta and it will work as good as any previous build.

Because of the breaking changes I would only use the beta so you do not need to deal with them as I have updated all examples and readme for the new changes.

New Build 2019-03-16 has following changes.

  • Removed a bottleneck that was slowing down the video streams on older/slower CPUs. This has also lowered CPU usage over all previous builds even if only doing snapshots. Possible that one change may cause issues on non english setups, so please report if the previous BETA works and this build does not work for snapshots. The two builds can be swapped easily as no new channels or config items were changed.

  • Security improvements made for streaming. Will only return a stream if the request is GET:ipcamera.mjpeg , the port is correct and the IP is in the whitelist, it also only listens to local IP’s and wont work for external IP requests. DISCLAIMER: The new feature provides access to the video stream without authentication, If you do not know how to keep your internal network secure and care about the camera feeds, please do not enable the new streaming features. The feature is disabled by default.

  • Multiple streams can now be used around multiple tablets and the camera only sees a single stream. It is common for cameras to have a limit of 4 streams or even less. This binding will now remove that limitation. This is one reason why with a Foscam camera that can work streaming directly you may wish to use the binding as some are limited to 4 streams only.

  • Foscam now has streaming url hardcoded in, see readme for special setup info…

For any discussion on the new streaming features please use this thread:

Hi,

This shows that you are not using the latest build which has the first of a number of streaming features. I have updated the readme and documentation so they are now only accurate with the latest build due to the breaking changes I listed in my post above…

The binding will handle snapshots very well but if the camera does not report a url via ONVIF then you will need to manually enter the snapshot url until rtsp features are added. The same goes for the mjpeg http based stream, it will need to be manually entered for cameras that are not HIK, Dahua or Amcrest until further features are added to give rtsp.

tried again with the last version but it looks that my camera isn’t supported is it?
1

Or is there anything else I can do? Is there a way to transform the streams? For now images would be enough for me.

Thanks

No idea, I would need DEBUG log output when the binding tries to connect to see what is going on.
I would recommend you install ONVIF device manager and see if it detects and reports a snapshot url.
I believe for a camera to call itself ONVIF compatible it is required to support a snapshot.

Since the binding was reporting a RTSP link, you should look at the other thread you already posted in and I replied in, currently the binding does not support RTSP as it is still being worked on as I find spare time.

I would recommend you install ONVIF device manager and see if it detects and reports a snapshot url.

I already installed it. I can check my live stream but where I can see an Image link? Can you advise?

@matt1, I can personally confirm that the Fosbaby p1 is working. What I have tested so far is:

  • pan/tilt camera.
  • Image (2seconds interval).
  • Still Image which can be refreshed.
  • Livestream
  • Turn sound detection on/off
  • Sound detection

Other things are still being tested/configured. I will update my list when needed.
Great work on the binding! :clap: :+1:

1 Like

New Build 2019-03-21 has these changes:

  • Fixed issue with server port not changing unless rebooted, should now change and allow the streaming server to stop without needing a reboot.

  • Fixed logs to stop errors/warnings when a phone is displaying a stream and the phone locks and stops accepting the stream without a clean stop.

  • Improved the setup config names in PaperUI so they are consistent with what logs ask you to do.

  • Some performance improvements made

@onacvooe
Thanks for the kind words, be sure to check out the examples in the readme as I have put in what I use for a baby monitor in there…

@matt1, Thank you for your update, I will install it shortly,

At the moment I’m not able to get the live stream to work with my camera. Still trying but any help would be nice. I have read your readme but there are a few things which I don’t get. First off, the port… Where do I find that port? I cannot use an ONVIF Device manager because I don’t have a windows machine. And the stream URL contains of http://IPADRESS:PORT/ipcamera.mjpeg but where does the IPCAMERA.MJPEG come from? Especially the IPCAMERA name… These things might differ from my setup. Can you help me with that?

Could it be that it is not supported? / Not functioning on my device?

Never mind, I just found out where ipcamera and port came from.