IpCamera: New IP Camera Binding

Yes, as @matt1 surmised, the reason I set the expire was initially in my rules I was using “update” and was flooded with notifications, so I set an expire for the trigger items. Later I did modify the rules to use “changed to ON” but never made the connection that I no longer need to expire the trigger items. I am all for reducing code complexity so I am going to modify my items and drop the expire timer.

Thanks for the insight.

@matt1, I still have a question though regarding the use of the PIR Alarm and the motionAlarm. Before the 7-14 update both channels were available and worked independently. Now however, after 7-14 update, the PIR Alarm seems dead and only the motionAlarm is working. So I have FFmpegAlarm and MotionAlarm, but no separate PIRAlarm trigger. If this is how it is I can live with it, but incase this is a bug I wanted to make your aware of it because the bindings from late June seemed to work differently.

Hi @matt1

I am using this in my rules:

		var String Responseorg = sendHttpGetRequest("http://admin:Secret@192.168.192.82/ISAPI/System/Video/inputs/channels/1/overlays/text/1")
		var String Responserest = Responseorg.replaceAll("<displayText/>","<displayText>Front Motion</displayText>")
		var String Responseres = Responserest.replaceAll("<displayText>.*</displayText>","<displayText>Front Motion</displayText>")
		sendHttpPutRequest("http://admin:Secret@192.168.192.82/ISAPI/System/Video/inputs/channels/1/overlays/text/1","application/x-www-form-urlencoded; charset=UTF-8",Responseres)
´´´ 
Is that possible to get into the binding?

/Mike

Hi Matt,

i changed the camera now to Instar IN8015 and now i have the proble that the camera is moving from left to right and up and down but always to the endpoint and wont stop for steps.

How can i manage this?

I have activated the continous mode, but in my log i see

==> /var/log/openhab2/openhab.log <==

2020-07-15 17:31:24.270 [DEBUG] [ing.ipcamera.handler.IpCameraHandler] - Trying to move with new PTZ Absolute move.

2020-07-15 17:31:24.272 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Sending ONVIF request:AbsoluteMove

2020-07-15 17:31:24.289 [DEBUG] [nding.ipcamera.onvif.OnvifConnection] - Unhandled Onvif reply is:<?xml version="1.0" encoding="UTF-8"?><s:Envelope xmlns:s=“http://www.w3.org/2003/05/soap-envelope” xmlns:e=“http://www.w3.org/2003/05/soap-encoding” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:wsa=“http://www.w3.org/2005/08/addressing” xmlns:xmime=“http://www.w3.org/2005/05/xmlmime” xmlns:tns1=“http://www.onvif.org/ver10/topics” xmlns:xs=“http://www.w3.org/2001/XMLSchema” xmlns:xop=“http://www.w3.org/2004/08/xop/include” xmlns:tt=“http://www.onvif.org/ver10/schema” xmlns:wsnt=“http://docs.oasis-open.org/wsn/b-2” xmlns:wstop=“http://docs.oasis-open.org/wsn/t-1” xmlns:tds=“http://www.onvif.org/ver10/device/wsdl” xmlns:tan=“http://www.onvif.org/ver20/analytics/wsdl” xmlns:trt=“http://www.onvif.org/ver10/media/wsdl” xmlns:tev=“http://www.onvif.org/ver10/events/wsdl” xmlns:tptz=“http://www.onvif.org/ver20/ptz/wsdl” xmlns:timg=“http://www.onvif.org/ver20/imaging/wsdl” xmlns:ter=“http://www.onvif.org/ver10/error” xmlns:tmd=“http://www.onvif.org/ver10/deviceIO/wsdl” xmlns:hikwsd=“http://www.onvifext.com/onvif/ext/ver10/wsdl” xmlns:hikxsd=“http://www.onvifext.com/onvif/ext/ver10/schema” ><s:Body>tptz:AbsoluteMoveResponse</tptz:AbsoluteMoveResponse></s:Body></s:Envelope>

New build 2020-07-16 Has these changes:

  • Hikvision got a tidy up to make it easier to maintain.
  • Hikvision can now do text overlays. @tnemrap thanks for suggesting and providing a clear example to follow. You may need to turn on the overlay 1 text in the cameras web page settings before this will work.
  • Onvif events now has a new channel called cellMotionAlarm @John_Siemon It was not a bug. See https://github.com/Skinah/IpCamera/issues/61
  • Big clean up of the naming seen in PaperUI for the names of channels.

@SaschaQ88
Instar needs to move either via PRESETS which is the easiest way, or use CONTINUOUS which the readme has an example of this and the command OFF must be sent to stop the movements. If your using Habpanel, there is a widget in the gallery that makes it very easy.

2 Likes

Hi matt,

thy for your reply. I am using it now with continous moving but i am using the sitemap to control.

In the readme is no usable example for continuous.

I have created setpoint items in the sitemap for pan and tilt. But its not intuitiv, because when you send a value to pan under 50 it moves left,over 50 right. For tilt under 50 down and over 50 up.

When its moving you need an additional switch item to send off. Thats very complicated to control.

Do you have an idea how to make a little bit more comfortable to control in the Basic UI.

I have built a rule to move with the values 49 and 51 to pan and tilt with switch items right, left, up and down and send a stop command. But when i move up and down, the camera is alway moving also left and up or right and up. Which value i have to send or is the right oder left value in the cache of onvif?

Thx in advance.

Use Presets, that is the only easy way.
I updated the readme with a tested way for sitemaps, but really the habpanel way is so much nicer and easier.

okay thanks a lot.

do you know why the camera is not only up or down when i sent 49 or 51. The camera is always moving right or left and the up or down.

Your camera only suppprts continuous movements so don’t send anything else or that happens. As mentioned presets are what I would recommend and you can use mappings to create a short list with friendly names.

okay thx. One question.

The MJPEG stream picture is very small, is there a possibility to get it a little bit bigger?

i tried it with the HLS Stream but i got this error message:

==> /var/log/openhab2/openhab.log <==

2020-07-16 13:26:36.377 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Guessed Channel Layout for Input Stream #0.1 : mono

2020-07-16 13:26:36.383 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [aac @ 0x23851e0] Too many bits 8832.000000 > 6144 per frame requested, clamping to max

2020-07-16 13:26:36.387 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [rtsp @ 0x2369370] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)

2020-07-16 13:26:36.389 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hls @ 0x2386520] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

2020-07-16 13:26:36.408 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hls @ 0x2386520] pkt->duration = 0, maybe the hls segment duration will not precise

==> /var/log/openhab2/openhab.log <==

2020-07-16 13:26:45.443 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - Last message repeated 199 times

2020-07-16 13:26:45.445 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hls @ 0x2386520] Cannot use rename on non file protocol, this may lead to races and temporary partial files

2020-07-16 13:26:45.447 [DEBUG] [hab.binding.ipcamera.internal.Ffmpeg] - [hls @ 0x2386520] pkt->duration = 0, maybe the hls segment duration will not precise

My Thing configuration:

Thing ipcamera:INSTAR:XXXXXX “KBSQ-Kamera-Kinderzimmer-LAN”
[
IPADDRESS=“192.168.XXX.XX”,
PASSWORD=“XXXX”,
USERNAME=“admin”,
POLL_CAMERA_MS=1000,
SERVER_PORT=54323,
FFMPEG_OUTPUT="/usr/share/openhab2/cameratmpfs/camera3/",
PTZ_CONTINUOUS=false,
PORT=80,
ONVIF_PORT=8080,
STREAM_URL_OVERRIDE=“http://192.168.XXX.XX/cgi-bin/hi3510/mjpegstream.cgi?-chn=12&-usr=admin&-pwd=XXXXXXX”,
GIF_PREROLL=5,
FFMPEG_HLS_OUT_ARGUMENTS="-strict -2 -f lavfi -i aevalsrc=0 -acodec aac -vcodec copy -hls_flags delete_segments -hls_time 10 -hls_list_size 4",
GIF_POSTROLL=10
]

@matt1, Thanks for breaking out a separate channel that can be used with the PIR trigger. This works very well now, however I am now struggling to get the FFmpeg channel to work again with the 7-16 update. Is this something you can take a quick look to determine if it is a bug or is it something I need to look into on my end. It was working fine for me in the 7-14 update, but doesn’t seem to be working for me in the 7-16 update. Based on what I am seeing it looks as though FFmpegAlarm may overlap code for the cellMotion Alarm, but I am just guessing here. Thanks.

UPDATE: SOLVED: After several restarts of OH and rebooting the camera a few times, FFMpegMotionAlarm came to life. Problem solved. Also, from what I am seeing the complete rtsp url including Profile was not being found/properly specified. Maybe I was just not patient enough to allow everything to settle, but all working now. Thanks again for all of your efforts and sorry about the head fake on this one.

Thanks @matt1 for the text overlay.
Now it is just 2 more rules i want to get rid off :slight_smile:

Enable/disable Alarm input

var String Response = sendHttpGetRequest("http://admin:secret@192.168.192.85/ISAPI/System/IO/inputs/1")
    if (Motion_Pool_Enabled.state == ON){
        Response = Response.replace("<enabled>false</enabled>","<enabled>true</enabled>")
        sendHttpPutRequest("http://admin:secret@192.168.192.85/ISAPI/System/IO/inputs/1","application/x-www-form-urlencoded; charset=UTF-8",Response)
    } else {
        Response = Response.replace("<enabled>true</enabled>","<enabled>false</enabled>")
        sendHttpPutRequest("http://admin:secret@192.168.192.85/ISAPI/System/IO/inputs/1","application/x-www-form-urlencoded; charset=UTF-8",Response)

    } 

and externally trigger Alarm Input

	var String Response = sendHttpGetRequest("http://admin:secret@192.168.192.82/IO/inputs/1")
	if (Motion_Front_Trigger.state == ON){
		Response = Response.replace("<triggering>low</triggering>","<triggering>high</triggering>")
		sendHttpPutRequest("http://admin:secret@192.168.192.82/IO/inputs/1","application/x-www-form-urlencoded; charset=UTF-8",Response)
	} else {
		Response = Response.replace("<triggering>high</triggering>","<triggering>low</triggering>")
		sendHttpPutRequest("http://admin:secret@192.168.192.82/IO/inputs/1","application/x-www-form-urlencoded; charset=UTF-8",Response)
	}

DONE its added but needs testing as my camera has no alarm inputs.

https://github.com/Skinah/IpCamera/commit/7243e47145cb6278ca651dbc9463aad194f95f10

Does /ISAPI/System/IO/inputs/1 give you the same result?

EDIT: I am leaning towards calling it triggerExternalAlarmInput as what is does is change if it triggers on a high or a low state. Depending on which device you connect to the input it may be back to front…

I’m also interested in the use case of how you use that? Using it virtually instead of running real wires?

Is it correct that the HLS WEbview and Webstream is only working on mobile Phones?

I can see the stream on my mobile in my sitemap but not on my Chrome Browser on my Desktop PC.

It is some time since I created this rules and as I remembered /ISAPI/System/IO and /IO was not the same but I will test it.

The usecase is that i have a Cat and when trying Cameras Motion sensing i get alot of false alarms.
So instead i use Bosch Pet Friendly PIR on the Alarm Input. I have also put up some extra PIR’s connected to Z-Wave Binary input device in areas where the Camera covers but not the first PIR.
When this PIRS sense motion I activate the Alarm Input of the Camera and the Surveillance Station start recording and i use text overlay to show what activated the recording.

@SaschaQ88 Chrome doesn’t have native HLS, you will have to install a plugin from the chrome store

Yes it seems to work in the same manner.’

/Mike

So glad you bought this doorbell… been waiting for this integration to the binding for ages :muscle:
Getting a little lost in the thread as it’s so big now, where are you at now as I believed the events couldn’t be tapped into, hence why I originally started testing your mpeg motion detection.

I’m flashed with LaView firmware atm as the hik firmware didn’t support onvif at the time. Let me know any testing you want done

New build 2020-07-18 has these changes:

  • 2 New hikvision channels @tnemrap thanks for the suggestion, need this tested as my camera has no inputs.
  • New config to allow a low res RTSP stream to be used for the ffmpeg alarms since the stream is not watched this help lower the loads.

@delid4ve @John_Siemon @bgilmer

Thanks @matt1 is works.
Would it be possible to revert

TRIGGER high OFF/low ON

to

TRIGGER high ON/low OFF

/Mike

Only the labelling or also the functionality?