IpCamera: New IP Camera Binding

Is this the line that determins the line crossed? EDIT: sorry re-read your post and you already answered it.
Thanks for posting this as it would be great if my camera has this ability. Will have a look into it soon.

Yes! I re-read my post a few times and made some edits to clarify. Give it a try… i was trying to figure out the ISAPI URL for controlling the MIN/MAX object sizes that trigger smart events and came across this.

Here’s what i did to alter these values:

/usr/bin/curl -k --silent -H 'Content-Type:application/xml' -X PUT -d "
<LineItem>
<id>2</id>
<enabled>false</enabled>
<sensitivityLevel>50</sensitivityLevel>
<directionSensitivity>any</directionSensitivity>
<CoordinatesList>
<Coordinates>
<positionX>530</positionX>
<positionY>999</positionY>
</Coordinates>
<Coordinates>
<positionX>530</positionX>
<positionY>100</positionY>
</Coordinates>
</CoordinatesList>
</LineItem>" http://$IP/ISAPI/Smart/LineDetection/1/lineitem/2 --digest -u $username:$password

Update $IP, $USERNAME and $PASSWORD to reflect your camera and login information.

You can see the lines added if you enable RULES on your NVR. Here was my test (the verticle line down my driveway) which works. Im pretty excited to have multiple lines now :smiley:

image

1 Like

Did this work for your camera’s ?

Not sure when I will get some time as I want to update the firmware first and then do some testing and setup on the latest firmware. I want to have multiple lines, so should not be too long and I expect it will work as the firmware is now made generic and not compiled for each camera anymore.

Hey guys!
i’m using this binding with my door bell with these cam.things:

Thing ipcamera:generic:Entry
[
    ipAddress="192.168.178.151", password="yes", username="admin", pollTime=1000, serverPort=54323,
    snapshotUrl="http://192.168.178.151:8080/?action=snapshot",
    mjpegUrl="http://192.168.178.151:8080/?action=stream"
]

and there cam.items:

String HttpOnlyMjpegStreamUrl "Mjpeg Stream" (Group_HabPanel_Dashboard)  { channel="ipcamera:generic:Entry:mjpegUrl" }
String HttpOnlyImageUrl "Image Url" { channel="ipcamera:generic:Entry:imageUrl" }

with Habpanel i was able to display the video with a image widget and the HttpOnlyMjpegStreamUrl item.
i have tried the same with the new MainUI and it still works with a Image Card. is that the right way to display the stream or will this cause too much load for my rpi?

Image card works well, but these have more features especially if the camera has PTZ.

OH3 Widget: Building a camera widget - Add-ons / UIs - openHAB Community

1 Like

Have someone a working configuration with an “old” mobotix camera ?

And also. how you are managing to browse through the history of you events and videos ?

Hi all, I am on OH3 on my rasberry pi 4b.

I have 3 or 4 habpanel dashboards on tablets across the house and would like one to display the cameras from my hikvision nvr when the corresponding dashboard is selected

I have installed the binding.
The nvr appears online.
I tried using the string created by the channel to display but nothing coming through.

Q1 - does ffmpeg need to be installed;
Q2 - what is the best scenario cpu wise; I don’t need the cameras when I am not looking at the dash.

Thanks!

I was using this widget on habpanel just have not gotten around to creating something for the new main UI yet.

The reason for this is I use telegram to send an off site copy of the events so they are safe if someone steals the NVR. Very easy to review them in real-time from a phone without opening ports ina firewall.

I also like pushover as it can display a moving gif without needing to unlock or touch your phone. At work it was great as you just have the phone pointed towards you.

No but some features do require it. What URL were you wanting to display? Snapshots and autofps mjpeg streams do not need ffmpeg if your camera can supply a snapshot.

The lowest impact on your system would be the autofps.mjpeg since your cameras have motion detection in them. The ipcamera.mjpeg should also work if you setup the camera as per the docs and won’t need ffmpeg either. Just give them a try to see what U prefer.

hi @matt1 the url that the system is giving me is as

i am also repeating incase i wasnt clear that i am on an NVR (h.264) encoding. For now I want something that only looks at the cameras of the NVR (channel0?) and only when i look at the habpanel dashboard. I am pretty sure the nvr doesnt support mjpeg

@Python I see that you were in the same situation as I am now. Were you able to get a 2.5.x IP Camera Binding add-on that had the alarm event fixes?

My story:
I’m using Dahua IVS cameras. motionAlarm items work, but lineCrossingAlarm and fieldDetectionAlarm event items are never triggered. The Dahua NVR sees them, but OH does not. Nothing in the trace logs either.

From reviewing your comments (and @hoggm2) I see that these missing alarms were fixed in the Mar 2021 IP Camera release. But I tried all the 3.x build releases and unfortunately are not compatible with my OH2. Upgrading to OH3 is a long term goal, but for now I am hoping to find a way to resolve this on my Openhabian OH2.

  • Thomas

Yes I searching for something to show the alert videos which are stored on the openhabserver. The best would be with the new UI.

Second Question :
From my dahua cam , I get now alerts via the API ?

Third question can you help with an mobotix cam ?

2021-09-28 18:55:24.824 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Starting ffmpeg with this command now:-f mjpeg -hide_banner -loglevel warning -i rtsp://admin:********@192xxxx/stream0/mobotix.mjpeg -q:v 5 -r 2 -vf scale=640:-2 -update 1 http://127.0.0.1:54322/ipcamera.jpg
Thing ipcamera:generic:cam_door
[
    ipAddress="192.168.xxxx",
    username="admin",
    password="xxx",
    serverPort=54322,
    snapshotUrl="http://192.xxx//record/current.jpg",
    ffmpegInputOptions="-f mjpeg",
    ffmpegInput="rtsp://192.xxx/stream0/mobotix.mjpeg"
]

I commited to upgrading to OH3

You mention that your on a Hikvision NVR, please read the notes on how to setup these in the bindings documentation in the setup section. To learn more as to why it is not working you need to use DEBUG mode or TRACE, which how to do this is covered in the very top of the docs on what to do if you need help.

they are not compatible, and why it became a new major version number. This is due to how OH3 got rid of eclipse framework which should make it easier to move the project forward quicker. OH3 is a lot better.

Sorry I dont understand what you are asking.

I notice your using a mjpeg stream as the source, is that the only option? Can you use a h264 stream instead? There are a number of untested paths the binding can take and I probably have never tested a mjpeg stream getting split into snapshots as most cameras can create a snapshot. Does your camera have snapshot urls?

Is the double slash a typo mistake? It is interesting as the DEBUG output seems to indicate you have not supplied the snapshot url but the thing file shows you have. If it does not work, let me know and I can run some tests as it has been a while since I tested certain parts of the binding.

@Python & @matt1: Thanks for the quick replies. Not surprised, but I was praying for a OH2 miracle.

  • Thomas

Sorry : I have an dahua cam , which I have connect with this

Thing ipcamera:dahua:cam_carport
[
    ipAddress="192.168.XX.XX",
    username="admin",
    password="pwd",
    serverPort=54321
]

But on the channel , I am not receiving any Event

Switch gCamCarport_MotionAlarm "Motion detected" (gCamCarport) { channel="ipcamera:dahua:cam_carport:motionAlarm" }

@the.neon:
As far as I can see your textual .Things Thing and .Items Switch are defined correctly. At least what you show is how it’s done in my OH2 installation.

If your Thing configuration is reported to be Online then I suspect the issue is in the Dahua camera’s settings. Besides enabling the motion alarm (Video Detection tab) you also need to set the Area (active region) and Period (time schedule). Depending on the camera model there might be more settings involved.

But if the thing configuration is reported to Offline then that hints trouble with the Thing settings.

  • Thomas

To learn more as to why it is not working you need to use DEBUG mode or TRACE, which how to do this is covered in the very top of the docs on what to do if you need help. The logs will tell you if the event stream is not staying connected and it will log all events that come back in and if any are not known to the binding.

There was also a bug that stopped some events getting seen, not sure the exact version the change was made but if your using 3.1 Stable or newer it should be good, older and you should upgrade to get the changes that were made.

@matt1 I want to say Thank You for all the work you’ve put into the IP Camera Binding. Despite still running on OH2, I finally had success using IVS (intrusion & tripwire) events from a Dahua camera.

In case it helps anyone else, here’s a summary of my IP Camera journey:

My goal was to use a Dahua camera to trigger an Alexa TTS message. Basically to voice announce that naughty animals are in the garden. I needed Dahua’s IVS features (intelligent tripwire and intrusion detection) because standard video motion detection creates too many false alarms. I don’t use the binding’s video streaming or snapshot functions.

My OH installation is Openhabian 2.4. So I installed org.openhab.binding.ipcamera-2.5.10-SNAPSHOT.jar in its addons folder. No issues, setup went smooth. Configuration was textual using .things and .items files.

I successfully received video motion alarms from the Dahua IPC-HDBW1435E-W WiFi dome camera. But never any tripwire (lineCrossingAlarm) or intrusion (fieldDetectionAlarm) events. As learned from reviewing this discussion, this issue affected some cameras (I think due to json format) and was fixed in OH3. So no joy for me since I run OH2.

I eventually discovered that the binding’s lastMotionType event string was working. Which would have been a workaround for detecting the IVS events. But by a stroke of luck I found a better solution.

The solution involved changing cameras. I had a Amcrest IP5M-T1179EW POE turret camera that did not support the special IVS features. Dahua manufactures the Amcrest brand and they have a firmware update that can run on the Amcrest. So I flashed the Amcrest and turned it into a Dahua model with IVS functions. This simple act converted a $50 camera into a $125 camera.

And as luck would have it, the IP Camera binding works perfectly with the re-flashed Amcrest camera. All the camera’s alarm events are functional. Alexa is now announcing when there are critters in the garden.

BTW, I’ve decided to tackle the OH2 to OH3 upgrade. I’ve ordered new hardware (RPI4) and have watched several OH3 videos. The conversion looks like a tremendous amount of work. But with luck my reliable / trusty OH2 system will get a well deserved OH3 makeover.

  • Thomas

No problems, glad its working for you and it only gets better as you move to the newer versions.

It’s not really that much work, as you can still use all the same things,item and rule files. Sitemap files work just as they did in OH2.x, but the newer mainUI is worth using/learning.
Rule files need to have any time lines converted to the new yoda time.
Probably the only difficult part would be if you have to move from a oh1 binding to a newer binding.
Then there is a few weird ones like the expire binding is no more and you have to add metadata to do the same thing… :slight_smile: Take it one bite at a time and since you have new hardware it allows you to slowly move it across as you have time. The tutorial will help.

1 Like