IpCamera: New IP Camera Binding

Could anyone kindly help to implement Dahua VTO3211 capabilities into this binding?
What is working for this video door bell with this binding:
MPEG stream, motion alarm from VTO, ALARM_INPUT2 (reacts to exit button press), ALARM_OUTPUT1, snapshot image.
What is not implemented:

  • built-in motion detection level set (table.MotionDetect[0].Level=3)
  • access card reactions (getting card numbers or unsuccessful attemps is rather important for security and presence detection)
-------- This is the first message on Mifare proximity card
Code=DoorCard;action=Pulse;index=0;data={
"Check" : [ 0, 0 ],
"Number" : "CARDNUMBER",
"Type" : 0
}
-------- This appears only if the card is in internally set trusted cards list
Code=AccessControl;action=Pulse;index=0;data={
"CardNo" : "CARDNUMBER",
"CardType" : null,
"ErrorCode" : 0,
"Method" : 1,
"Name" : "OpenDoor",
"Password" : "",
"ReaderID" : "1",
"RecNo" : 25,
"SnapURL" : "",
"Status" : 1,
"Type" : "Entry",
"UserID" : "9901"
}
  • reaction to door’s open/close sensor
Code=DoorStatus;action=Pulse;index=0;data={
"DoorIndex" : 0,
"Status" : "Close"    --- or "Open if the door/contact is open"
}
  • reaction to ALARM_IN contact
Code=ProfileAlarmTransmit;action=Start;index=8001;data={  ------ action=Stop when contact is changing from closed to opened
"AlarmType" : "FireAlarm",
"DevSrcType" : "Digit",
"SenseMethod" : "FireAlarm",
"UTC" : 16588:

What does the TRACE level log give you? It should list any alarms that are unknown / unimplemented and the info that is needed to add them.

This is from TRACE log.
Will this be ok to search for content in data=section?

            case "AccessControl":
                if ("Pulse".equals(action)) {
                    if (content.contains("\"Method\" : 1")) {
                        String value = ipCameraHandler.returnValueFromString(content, "CardNo");
                        ipCameraHandler.setChannelState(CHANNEL_ACCEPTED_CARD_NUMBER, PercentType.valueOf(value));
                        ipCameraHandler.setChannelState(CHANNEL_DOOR_UNLOCK, OnOffType.ON);
                    } else {
                        if (content.contains("\"Method\" : 5")) {
                            ipCameraHandler.setChannelState(CHANNEL_DOOR_UNLOCK, OnOffType.ON);
                        }
                        if (content.contains("\"Method\" : 4")) {
                            ipCameraHandler.setChannelState(CHANNEL_DOOR_UNLOCK, OnOffType.ON);
                        }
                    }
                }
                break;
            case "DoorStatus":
                if ("Pulse".equals(action)) {
                    if (content.contains("\"Relay\" : true")) {
                        ipCameraHandler.setChannelState(CHANNEL_DOOR_UNLOCK, OnOffType.OFF);
                    }
                    else if (content.contains("\"Status\" : close")) {
                        ipCameraHandler.setChannelState(CHANNEL_DOOR_CONTACT, OnOffType.ON);
                    }
                    else if (content.contains("\"Status\" : open")) {
                        ipCameraHandler.setChannelState(CHANNEL_DOOR_CONTACT, OnOffType.OFF);
                    }
                }
                break;

You can use the lastEventData channel.

[ipcamera] Add channel to show adv event and object detection data · Issue #11391 · openhab/openhab-addons (github.com)

The code you wrote looks pretty good.

1 Like

Even more data from VTO:

 HTTP Result back from camera is  :--myboundary
Content-Type: text/plain
Content-Length:199

Code=ProfileAlarmTransmit;action=Stop;index=8001;data={
   "AlarmType" : "DoorMagnetism",
   "DevSrcType" : "Digit",
   "SenseMethod" : "DoorMagnetism",
   "UTC" : 1658937760,
   "UserID" : "8001"
}

That is a reaction to opened door while the lock is closed.

I have a 16 Channel Hikvision NVR and when i try to add my 10th camera i get the following error: “{nvrChannel=The value must not be greater than 9.}”

How can I upload changes I made to be available for everyone?

Sorry to ask here but… haven’t fount this information anywhere else in the doc or in the forum…

Is there any way to Switch On/Off a IP camera from the Binding in OpenHab?
I’ve seen a privacy mode feature which can be a similar option but limited to few models only (Amcrest/Dahua).

Thanks in advance,
Marco

No to that exact question. You should ask in a new thread and with a more open ended question then someone may suggest other ways like turning off the POE with a different binding.

You create a PR on github, which this page has links and info on how to get started
Developer Guide | openHAB

any ideas @matt1 ?

DahuaVTO could stream two subtypes in one channel, one of lower quality, good for widget, mjpeg and sip, second of a better quality, good for security recordings. How to implement that feature into binding?

I have need received any feedback from reolink. Did you implement changes into the binding which I could help testing?

Hi Juergen,

i received a knife package for Reolink 810A camera which solved the issue.

Reolink couldn’t disclose at that point in time any release date for official builds.

Personally i added some changes to the binding:

  • support of multiple messages within one packet (also solving the issue)

  • support of AI indication (person, pet, car)

Skinah asked me to share those changes as he’s working on the binding as well.

Unfortunatelly i faced issues with github token, hence i wasn’t able to raise a pull request on short notice.

Instead i shared a diff (quite limited still) with Skinah via email.

Seems Skinah has limited email connectivity, haven’t heard anything whether the changes made it into the code :frowning:

Best regards,

Dieter

i never got any email and it is preferred if you create your own github PR.

Hi Skinah,

Of course i send you couple of emails and i even asked you whether you have been able to merge the snippets.

I took below screen shot from here: https://community.openhab.org/t/setting-up-nvr-based-reolink-cameras/136752/22

Might be that forum cuts off email at a certain lenght.

But I’m the new one here, and in this case i would have expected a bit more verbose reaction.

Regards,

Dieter

I have not been sent real emails.
I have not gotten any useful diff outputs that have not been cut short and bad formatting.
GitHub is where all contributions should be made, where multiple people can help.
I won’t waste My time posting multiple times that a diff appears to not be complete, it should be obvious to you that the post does not contain all your hard work.

Thank you for making the changes and testing, thank you for wanting to contribute. We are all not paid and have multiple more important things in our lives, so please use GitHub and don’t post in a forum in a totally different thread where the history is now split.

I’ve installed pytapo library on my openhabian and finally I can control my tapo cam privacy mode and alarm with a simple script. maybe someone of the ipcamera binding can integrate the library on ipcamera addon.

First install the library with this command (mine is and openhabian on rpi):

python3 -m pip install pytapo

once installed, create a .py script like this:

$ cat enable_priv_tapo.py

from pytapo import Tapo

user = “admin” # always admin when using your cloud tapo account
password = “” # password from your cloud tapo account
host = “192.168.0.238” # ip of the camera, example: 192.168.0.238

tapo = Tapo(host, user, password)

tapo.setPrivacyMode(True) #enable the privacy mode (True or False)
tapo.setAlarm(False) #Disable camera alarm (True or False)


there are also many other functions on the pytapo library you can test and add to your script.

Also you can test and run this script from the command line or from a dsl rule on the openhab gui. Example:

executeCommandLine(“/usr/bin/python3 /etc/openhab/scripts/enable_priv_tapo.py”)

cheers!

I may have just found an issue with reconnects with ONVIF cameras that may be your cause of issues. I’m in the middle of testing a fix at the moment.

The other thing you could do is use an older version to work out when exactly the issue started to occur. You can download a few builds I keep for this purpose here
Index of /openhab/IpCameraBinding/OldVersions/ (pcmus.com)

You need to uninstall the merged binding and install the telstick binding to take care of the needed dependencies, then just drop the jar into the addons folder unzipped. You can jump around the versions, but dont go older then the one marked dual servers as there was a big breaking change to the urls that the binding serves the files on at that point in time.

Having an issue with a Barlus ONVIF camera that is not a true PTZ it does not pan tilt or zoom, it uses PTZ Presets 233,242, 243, 244, 245, 250 and 251 for controlling its white and infrared lights… these Presets are not seen by IpCamera and can’t be set via pulldown, Preset 1 and 2 work fine.

The pulldown list shows Presets 1 -127 and when setting the above Presets the trace log gives an notification that the number is incorrect. I’m guessing anything that isn’t sen in the pull down is rejected.

If you change the presets you either have to send a refresh command or pause and unpause the camera to scan and update the list. There is no npn stop polling to check if the preset list has changed but you can set this yourself to occur with a REFRESH command.

A trace log would also help.