IpCamera: New IP Camera Binding

@andy294 A fix has been made in this PR

Hi @matt1, thank you for your PR, unfortunately it’s still the same issue on my side. I have

  • pulled the current main branch (checked, that the changes of the PR are there)
  • Created a new kar file for the IP Camera addon (4.3.0-SNAPSHOT)
  • Removed the installed IP Camera addon (4.2.1)
  • Removed temporary files and directories from /var/lib/openhab/tmp
  • Restarted openhab
  • Moved the new IP Camera addon to /usr/share/openhab/addons
  • Created a new Thing and passed the mjpeg url under advanced settings

Is there something, I can do more?

try leaving the port off ie
http://192.XXX.YYY.17/ISAPI/Streaming/channels/103/httpPreview

@matt1 You made my day !! It works now with your changes. Thank you :smiley: :+1:

Great thanks for reporting back as that means line 270 also needs the same change for it to be fully fixed. I just tested it and its working with the port specified now after the second change is made. Making another PR as some cameras may require the port for it to work so this needs to be fixed. I would just leave the port off for now, no need to change or test as I have HIK cameras here and could reproduce it and prove the fix.

1 Like

Hi, I can’t get my camera to work.
I have a Tapo C110. I have set her up as a ONVIF Thing with the following configuration:

UID: ipcamera:onvif:4361137307
label: ONVIF IP Camera
thingTypeUID: ipcamera:onvif
configuration:
  mjpegOptions: -q:v 5 -r 2 -vf scale=640:-2 -update 1
  ipAddress: 192.168.2.218
  updateImageWhen: "0"
  gifPreroll: 0
  onvifPort: 2020
  ffmpegLocation: /usr/bin/ffmpeg
  ipWhitelist: DISABLE
  mp4OutOptions: -c:v copy -c:a copy
  pollTime: 1000
  password: ********
  port: 8888
  snapshotUrl: ffmpeg
  snapshotOptions: -an -vsync vfr -q:v 2 -update 1
  ptzContinuous: false
  onvifMediaProfile: 0
  ffmpegInput: rtsp://jbaudisch:pwdJBtpl!()2204@192.168.2.218:554/stream1
  gifOutOptions: -r 2 -filter_complex
    scale=-2:360:flags=lanczos,setpts=0.5*PTS,split[o1][o2];[o1]palettegen[p];[o2]fifo[o3];[o3][p]paletteuse
  hlsOutOptions: -strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy
    -hls_flags delete_segments -hls_time 2 -hls_list_size 4
  username: ******

And it is shown as “online”. On the Items I also get the imageURL and mjpegURL displayed:

http://192.168.2.220:8080/ipcamera/4361137307/ipcamera.jpg
http://192.168.2.220:8080/ipcamera/4361137307/ipcamera.mjpeg

When I access the jpg via browser, it works.
When I access the mjpeg via browser, it doesn’t.
When I access the mjpeg via VLC, it works.

Then I tried to add both as an image-card widget to my UI like this:

component: oh-image-card
config:
  item: ONVIF_IP_Camera_Image_URL
  refreshInterval: 3000
  lazy: true
  lazyFadeIn: true

and

component: oh-image-card
config:
  item: ONVIF_IP_Camera_MJPEG_URL
  lazy: true
  lazyFadeIn: true

But neither the ImageURL shows something, nor does the MjpegURL.

Hello,

after updating OH from 4.2.1 to 4.3 the items of a page won’t be updated, after a page with IP cam content was active. To rule out side effects from other components, I set up a new OH instance (4.3) and only installed the IP Camera Binding. I can reproduce it up to 100%, when a page has at least 4 x MJPEG streams provided by this Binding.

STR’s:

  • Open page ‘Overview’ and refresh by browser (refresh is important)
  • Open page with IP cams
  • Navigate back
  • Open page with items => All controls stays in initial state and don’t show the current item states (after manually refreshing page all controls shows the right item states)

I have the following IP cams in use:

  • 3 x HikVision clones
  • 1 x DoorBird

When I enter directly the URL’s of the IP cams (and don’t use the MJPEG url of this binding) and reproduce the STR’s, everything works fine. So I could imagine that it has something to do with this binding.

What I have alredy tried:

  • Cleared cache and tmp files by
openhab-cli clean-cache
  • Cleared cookies and website data of the browser
  • Checked with Firefox on Win11 and Safari on iOS
  • Activated log level ‘Debug’ for this binding (nothing special visible)
  • Checked the console of the browser tools (no errors visible)

Does anyone else have similar problems or ideas on how to narrow down or solve the problem?

For reproducing this issue, here the code of my pages:

config:
  label: Overview
blocks:
  - component: oh-block
    config: {}
    slots:
      default:
        - component: oh-grid-row
          config: {}
          slots:
            default:
              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: oh-label-card
                      config:
                        title: IP cams
                        action: navigate
                        actionPage: page:page_Test1
              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: oh-label-card
                      config:
                        title: Items
                        action: navigate
                        actionPage: page:page_Test2
config:
  label: IP Cams
blocks:
  - component: oh-block
    slots:
      default:
        - component: oh-grid-row
          config: {}
          slots:
            default:
              - component: oh-grid-col
                slots:
                  default:
                    - component: oh-image
                      config:
                        url: http://192.XXX.YYY.215:8080/ipcamera/IPCam-1/ipcamera.mjpeg
              - component: oh-grid-col
                slots:
                  default:
                    - component: oh-image
                      config:
                        url: http://192.XXX.YYY.215:8080/ipcamera/IPCam-2/ipcamera.mjpeg
        - component: oh-grid-row
          config: {}
          slots:
            default:
              - component: oh-grid-col
                slots:
                  default:
                    - component: oh-image
                      config:
                        url: http://192.XXX.YYY.215:8080/ipcamera/IPCam-3/ipcamera.mjpeg
              - component: oh-grid-col
                slots:
                  default:
                    - component: oh-image
                      config:
                        url: http://192.XXX.YYY.215:8080/ipcamera/IPCam-4/ipcamera.mjpeg
config:
  label: Items
blocks:
  - component: oh-block
    config: {}
    slots:
      default:
        - component: oh-grid-row
          config: {}
          slots:
            default:
              - component: oh-grid-col
                config: {}
                slots:
                  default:
                    - component: oh-toggle-card
                      config:
                        item: TestItem

You should post this in your own thread and make sure to give the subject something generic that describes the issue. If the items actually update and it is only the UI not updating on the screen then it will have nothing to do with this binding and should not be posted in this thread where it will get lost. You can view the event.log in a number of ways including the developer sidebar or by using the linux command like
tail -f /var/log/openhab/openhab.log /var/log/openhab/events.log
You can break it down into the following steps the data has to take:

  1. Binding gets the data from the camera and sends to a channel.
  2. The core sends the data from the channel to an item, this gets logged.
  3. The main UI displays the changes of the item.
  4. The web browser has to keep the main UI working so the changes can be seen.

I suspect its something in 3 and 4 that is an issue.

The cam works with RTSPS.
From Unifi Protect i just get a URL like this:
rtsps://192.168.1.1:7441/abcdefghijklmnop?enableSrtp

How do i have to enter it to the IpCam Binding?
When i fill in the url in the field MJPEG URL i just get errors.

But when i test the connection in the cli of the docker container openhab is running in, it seems like the url an the connection is ok:

root@d01:/openhab# ffmpeg -i rtsps://192.168.1.1:7441/abcdefghijklmnop?enableSrtp -t 5 -f null -
ffmpeg version 5.1.6-0+deb12u1 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr --extra-version=0+deb12u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, rtsp, from 'rtsps://192.168.1.1:7441/abcdefghijklmnop?enableSrtp':
  Metadata:
    title           Fxxxxxxxxx_0
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Audio: aac (LC), 16000 Hz, mono, fltp
  Stream #0:1: Audio: opus, 48000 Hz, stereo, fltp
  Stream #0:2: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 2688x1512, 30 fps, 30 tbr, 90k tbn
Stream mapping:
  Stream #0:2 -> #0:0 (h264 (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    title           : Fxxxxxxxxx_0
    encoder         : Lavf59.27.100
  Stream #0:0: Video: wrapped_avframe, yuvj420p(pc, bt709, progressive), 2688x1512, q=2-31, 200 kb/s, 30 fps, 30 tbn
    Metadata:
      encoder         : Lavc59.37.100 wrapped_avframe
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc59.37.100 pcm_s16le
frame=  149 fps= 36 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed=1.21x    
video:69kB audio:938kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

And this is one configuration i tried as example:

Thing ipcamera:generic:MeineUnifiKamera "Meine UniFi Kamera" [
    ipAddress="192.168.1.1",
    port=7441,
    ffmpegInput="rtsps://192.168.1.1:7441/abcdefghijklmnop?enableSrtp",
    snapshotUrl="ffmpeg",
    ffmpegInputOptions="-rtsp_transport tcp"
]

Hi @matt1,

thank you for your feedback. I have opened a new thread for this issue:

Hi @matt1,
After upgarde from Openhab 4.2 to 4.3.1 for Reolink camera stop working setting push, email notifications and Set white led.

In log, I have following entries:

2025-01-02 21:29:57.125 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetWhiteLed is not handled currently by the binding, please report this message
2025-01-02 21:24:27.996 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetPush is not handled currently by the binding, please report this message

2025-01-02 21:12:12.736 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetEmail is not handled currently by the binding, please report this message

AFAIK no functionality was removed in recent changes. Is it possible that the controls still function and the warn is what is new? Ie the warn was never logged before. It would be helpful to see TRACE level logs of when you try to use these controls. It may be the camera is replying “OK” and that message is what is triggering the warn.

If they are not working and did in previous builds you can always drop the older jar into the addons folder as I keep a range of them on my site for this reason so people don’t need to roll openhab back, they can just do the binding.

Hi, @matt1

Strange, after some time after start it start to working,m but I still have such entries in the log:

2025-01-03 08:06:11.934 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetPushV20 is not handled currently by the binding, please report this message
2025-01-03 08:06:20.079 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetPushV20 is not handled currently by the binding, please report this message
2025-01-03 08:06:31.024 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetEmailV20 is not handled currently by the binding, please report this message
2025-01-03 08:06:44.587 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetEmailV20 is not handled currently by the binding, please report this message
2025-01-03 08:06:57.494 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetWhiteLed is not handled currently by the binding, please report this message
2025-01-03 08:08:01.927 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetWhiteLed is not handled currently by the binding, please report this message
2025-01-03 08:10:12.504 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetWhiteLed is not handled currently by the binding, please report this message

Version of binding is “official” simply from 4.3.1.
I check the TRACE log later.

Hi, @matt1

Below is trace log:


2025-01-03 20:03:14.515 [TRACE] [amera.internal.onvif.OnvifConnection] - Sending ONVIF request: PullMessages to http://x.x.x.x:8000/onvif/PullSubManager?Idx=6345675
2025-01-03 20:03:16.088 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: POST: http://x.x.x.x:80/api.cgi?cmd=SetEmailV20&user=admin&password=xxx
2025-01-03 20:03:16.194 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result from /api.cgi?cmd=SetEmailV20&user=admin&password=xxx contains     :[
   {
      "cmd" : "SetEmailV20",
      "code" : 0,
      "value" : {
         "rspCode" : 200
      }
   }
]
:
2025-01-03 20:03:16.195 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetEmailV20 is not handled currently by the binding, please report this message
2025-01-03 20:03:17.693 [TRACE] [era.internal.handler.IpCameraHandler] - Sending camera: POST: http://x.x.x.x:80/api.cgi?cmd=SetEmailV20&user=admin&password=xxx
2025-01-03 20:03:17.814 [TRACE] [era.internal.handler.IpCameraHandler] - HTTP Result from /api.cgi?cmd=SetEmailV20&user=admin&password=xxx contains     :[
   {
      "cmd" : "SetEmailV20",
      "code" : 0,
      "value" : {
         "rspCode" : 200
      }
   }
]
:
2025-01-03 20:03:17.815 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetEmailV20 is not handled currently by the binding, please report this message
2025-01-03 20:03:17.970 [TRACE] [amera.internal.onvif.OnvifConnection] - ONVIF PullMessages reply is: <?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver20/media/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tad="http://www.onvif.org/ver20/analytics/wsdl"><SOAP-ENV:Header><wsa5:To SOAP-ENV:mustUnderstand="1">http://x.x.x.x:8000/onvif/PullSubManager?Idx=468057434</wsa5:To><wsse:Security><wsse:UsernameToken><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">dARLysxDxbm5ugPKYyj5QstvWTo=</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">ODk3MjgwNzA4</wsse:Nonce><wsu:Created>2025-01-03T19:03:09.908Z</wsu:Created></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header><SOAP-ENV:Body><tev:PullMessagesResponse><tev:CurrentTime>2025-01-03T19:03:11Z</tev:CurrentTime><tev:TerminationTime>2025-01-03T19:13:03Z</tev:TerminationTime></tev:PullMessagesResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

That’s what I was expecting as no code was removed or changed that would have removed functionality. The binding just does not understand the camera is giving the 200 OK code so the warn is wrong and should be considered a bug.

So in my setup I see at least 4 type of warning:

2025-01-04 08:25:44.141 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetPushV20 is not handled currently by the binding, please report this message
2025-01-04 08:25:44.195 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetEmailV20 is not handled currently by the binding, please report this message
2025-01-04 08:26:05.126 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=SetWhiteLed is not handled currently by the binding, please report this message
2025-01-04 08:26:47.253 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=AudioAlarmPlay is not handled currently by the binding, please report this message

@matt1 Do you want me to register a bug ?

Also similar warning is for this:

2025-01-05 10:01:30.448 [WARN ] [era.internal.handler.IpCameraHandler] - URL /api.cgi?cmd=AudioAlarmPlay is not handled currently by the binding, please report this message

Hi, @matt1 I registered a bug for unproper warnings in openhab log: https://github.com/openhab/openhab-addons/issues/18052

1 Like

I think there is a BUG on some part of the RTSP stream protocol management.
I described all in these post

I did not find a solution, yet. Someone there who could help me with this issue?