IpCamera: New IP Camera Binding

@matt1 should there be a possibility to see camera feed via mobile app or only via PaperUI?
thanks

@ArC
I find the feed does not work in the IOS app for me, but works extremely well on my tablet with the Android app. I have seen people post that the IOS app is not updated or maintained as often as the Andriod app so check if a bug is listed for this on github. It is possible that it does not display if the image is larger than the screen size and the image can be resized with extra switches which are explained in the openhab documentation, have not looked at this in depth to see if there is a work around or what the cause is.

Also NEVER expose the image to the openhab.org cloud connector, the moment it is exposed it will constantly send data out and use bandwidth from your connection as well as the community server even if you have no apps or UI’s open it will still be spamming the server.

@Kiril_Tsvetanov
See the readme it has examples of what to put in your conf files.

Thanks @matt1, seems that’s a problem with IOS app.
p.s. not sure about exposing the image (have not configured anything specific in PaperUI, just created an Image item and have it in my sitemap. Once I open my sitemap via Cloud - I can see the picture).

Will try to check how to disable it if that’s possible.

thanks for an answer!
cheers

Hello, I am new to OH2 and there is a problem with my binding. I am looking to bind my camera to bind to OH2 and i have followed your guide on GitHub. However, in the PaperUI under Things, the device is online but i am unable to view the camera stream. All the channels appear to be link except Video URL and Image URL. I used textual configuration following GitHub but they do not link to Video URL and Image URL.

I am using a RaspberryPi 3 and the model of my camera is NVSIP-IPC. Please help. Thank you.

Hi @Ahmed_Saad,
Seems like I have the same cheap Chinese camera, so you can create a simple Image object in your sitemap: Image url="http://admin:admin@192.168.8.101/tmpfs/auto.jpg?" refresh=1000 and you’ll get a picture from the camera (feed is taken from /web/mobile.html source).

regards

1 Like

Hey @matt1,
thanks a lot for your awesome binding. I works very well with my Foscam C1 & C1 Lite cameras.
I’m just missing one option: Turn on/off the Infrared Night LEDs. It is possible to implement such channel?
With the foscam cgi API it is already possible to control this state (foscam manual page 71)

Thank you!
It is working with url but the sliders is not working Ex: zoom

2018-08-11 15:03:34.075 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1__zoom' for widget org.eclipse.smarthome.model.sitemap.Slider

2018-08-11 15:03:34.081 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1__zoom' for widget org.eclipse.smarthome.model.sitemap.Slider

2018-08-11 15:03:34.085 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Slider

2018-08-11 15:03:34.091 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1_enableMotionAlarm' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.095 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1_enableMotionAlarm' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.099 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.105 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1__motionAlarm' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.109 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1__motionAlarm' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.113 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.119 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1_audioAlarm' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.123 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'ipcamera_ONVIF_739b35e1_audioAlarm' for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.128 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Switch

2018-08-11 15:03:34.454 [ERROR] [ersey.server.ServerRuntime$Responder] - An I/O error has occurred while writing a response message entity to the container output stream.

Looks like it is not yet in the API.
It is no where in the API documents PLUS it does not show up when using this URL which lists all the supported event triggers. Only what is listed at this URL is what the camera can do via the API.
http://192.168.1.6/ISAPI/Event/triggers

I also tried enabling it and then watching for it with this link, but it would not trigger
http://192.168.1.9/ISAPI/Event/notification/alertStream

You will need to email Hikvision and ask them if/when it will be in the API.

New Build 14-08-2018 changes are:

  • HIKVISION new alarm for PIR models. https://github.com/Skinah/IpCamera/issues/10
  • Foscam new ability to determin if the infraLED is turned on or off. @OzZy_HH I took a look at page 71 and the API only has the ability to OPEN and CLOSE the infrared filter, I believe this is not the same as turning the LED on and off. Can you test it please? Just enter the URL into any brower and watch what happens, if it does work then tell me the exact URL and I can add it to the same control I just added. Other brands do not have the ability to turn the LED on and off nor determine the state of the LED so this appears to be a foscam only feature.

Hi matt1,
thanks for the implementation. At the moment the “enableLED” channel reflects the current state of infrared LED lights.
I can change the sate with these requests:

root@raspberrypi:~# curl "http://foscam02:88/cgi-bin/CGIProxy.fcgi?cmd=closeInfraLed&usr=admin&pwd=xxx"
<CGI_Result>
    <result>0</result>
    <ctrlResult>0</ctrlResult>
</CGI_Result>
root@raspberrypi:~# curl "http://foscam02:88/cgi-bin/CGIProxy.fcgi?cmd=openInfraLed&usr=admin&pwd=xxx"
<CGI_Result>
    <result>0</result>
    <ctrlResult>0</ctrlResult>
</CGI_Result>

The foscam cloud app on my mobile also changes the infrared led state when I execute them.

There are two more options for infrared LED:
automatic and scheduled

root@raspberrypi:~# curl "http://foscam02:88/cgi-bin/CGIProxy.fcgi?cmd=getInfraLedConfig&usr=admin&pwd=xxx"
<CGI_Result>
    <result>0</result>
    <mode>1</mode>
</CGI_Result>
root@raspberrypi:~# curl "http://foscam02:88/cgi-bin/CGIProxy.fcgi?cmd=setInfraLedConfig&mode=0&usr=admin&pwd=xxx"
<CGI_Result>
    <result>0</result>
</CGI_Result>
root@raspberrypi:~# curl "http://foscam02:88/cgi-bin/CGIProxy.fcgi?cmd=getInfraLedConfig&usr=admin&pwd=xxx"
<CGI_Result>
    <result>0</result>
    <mode>0</mode>
</CGI_Result>

I am not sure whether and how these options should be implemented

Ozzy

New build 05-08-2018 new changes are:

  • Update Image settings now have a number in brackets in paperUI so you know the value of the option for textual config.
  • Foscam only: new abilities with infrared LED control

@OzZy_HH
I have taken a guess on how to best implement this and how it will work is only a guess as I dont have the camera to try and the names of the URL are not what I would choose. IE is closed off or on? Let me know if I got it back to front


If you turn on or off the LED the auto control will move to the off position automatically. If you turn on the auto mode, then the other switch should move to indicate if the light is on or off.

Thanks a lot for the implementation. It works great and as expected. I can control the LED state with openhab, so I guess you used the correct commands (open=enable, close=disable). Also the “auto mode” control works well. The only thing I could complain is that it doesn’t get the updated/current state. So when I change automode by using the Foscam app it doesn’t change in Openhab. I’ve looked into the trace logs and couldn’t see the getInfraLedConfig request for pulling the current state.
Is this on purpose? (maybe to reduce the load?)

In general I’m already really happy with this binding :slight_smile:

Yes it was to reduce the load as Foscam at least some models can only answer four connections at once and I am not sure how that is counted. Have you tried using the openhab video element to display a high FPS video output in your sitemap? How does that work like in terms of displaying a picture in basic ui and the different openhab apps? Doing that I suspect counts as one of the four connections.

I’ve opened the stream in openhab and a second tab with the video grabbed the picuture with cmd=snapPicture2 command multiple times. During this peak time I still was able to send request by using curl. So I wasn’t able to reach a limit on my camera and couldn’t see any errors in trace log. Would it be possible to just pull once a minute (on low frequence)?

Hi Guys, once I setup the habpanel widgets for my webcam why the camera is showing over the widgets frame size. It won’t adjust to the widget frame size automatically. How can I change the resotion That will fit the camera image with on the frame size. I m running openhab on raspberry pi 3.

Thanks

@OzZy_HH
Open up the video stream in 5 different tabs of a browser, I have heard the 5th one will not work with foscam. Not sure which models and this limit may only apply to the video stream and the API connections may be unlimited. See if your camera can handle 4-5 video streams at the same time as the binding is polling it and let me know. Other brands also have limits, my amcrest has 10 connections with the ability to extend it to 20
 Yes I have thought about putting into the frame work two different groups of URLs to poll. The approach I have been toying with is to have a list that may be 10 URLs long and each time the camera polls the alarms it will choose 1 from the low priority list to poll.

Hi there,
I have the same IP Camera from Ahmed. I use this code in Sitemap, but I have to authenticate all time, as soon as I authenticate is working pretty fine, but I wouldn’t like to authenticate everytime.

Webview url="http://192.168.0.104/web/mobile.html" height=16

It is not possible to disable the authentication or at least pass the log in through the address???

With “http://user:passw@192.168.0.104/web/mobile.html” is not working for this camera. So, this mean that I have to use IMAGE and refresh, instead of VIDEO?

Thank you.

Hi

With webview you’ll need to authenticate each time to see camera output from mobile.html feed which is refreshed picture, not video stream.
To achieve that you need Image item: Image url="http://admin:admin@192.168.8.101/tmpfs/auto.jpg?" refresh=1000

This camera gives you rtsp feed as video, but it’s not very stright forward how to get Video working especially using mobile Openhab app.

i.e rtsp://192.168.1.100/11 gives you channel 11 rstp data. Works with vlc.

This camera(at least mine) does not have any controls like move or zoom even there are buttons available.

Regards

Well, I do get video streaming from “mobile.html” in Sitemap, but I have to authenticate everytime, that is my problem. This is the point. But of course you can get live streaming through mobile.html in Sitemap. It works. The problem is that admin:admin does not work in the URL “/
/mobile.html”

I have tried that, but if you use “auto.jpg”, you do not need authentication “admin:admin”, at least I do not need it. It is working fine without authentication but only “auto.jpg”


That url format will only work if the camera supports BASIC auth, not for cameras that use DIGEST auth. Out of interest what happens if you use this binding as a HTTPONLY thing and supply the address for the snapshot as this


http://192.168.8.101/tmpfs/auto.jpg

Leave off the login details and see what the binding reports in the logs in TRACE. The binding will tell you if it is using digest or basic auth for your camera as well as what the camera is sending back.

I understand you are trying to get the video or webview working, but you may learn something about the camera by trying that.