Supergiovane / node-red-contrib-hikvision-ultimate

A native set of node for Hikvision Cameras, Doorbells, Alarms, Radars etc.
https://www.facebook.com/supergiovaneDev
MIT License
49 stars 11 forks source link

ANPR - Repeating Old Plates #67

Closed jpgnz closed 5 months ago

jpgnz commented 5 months ago

Good Evening!

I've just stumbled across this add-on while trying to build this manually in NodeRED, great find! I've been able to immediately connect my camera and it is reading plates, however it seems to be constantly repeating the last plate that went past the camera.

To Reproduce

  1. Added add-on as per instructions
  2. When I added the camera, deployed and reloaded page
  3. ANPR Node connects, but then cycles through the previous plate, see screenshots:

Expected behavior Doesn't repeat.

Screenshots 1 image

2 image

3 image

4 image

Then, go back to 3 after 20 seconds (default) and repeat.

image

node-red-contrib-hikvision-ultimate 1.1.16 Node-RED 17.0.11 Core 2024.4.0 Supervisor 2024.04.0 Operating System 12.2 Frontend 20240403.1

Camera iDS-2CD7A46G0/P-IZHSY

Supergiovane commented 5 months ago

Hi Great camera the iDS-2CD7A46G0/P-IZHSY, i wish to have one also.

The camera repeats the plate while the car is passing, so the node is filtering the multiple reads.

jpgnz commented 5 months ago

Hey thanks for your quick reply!

Currently, there is no vehicle passing the site at all, PME512 last passed the camera at 5:46pm. No vehicles have passed since.

It is like the Node is repeating the last seen plate? I also have the camera connected to NX Witness and it only seems to bookmark once.

Supergiovane commented 5 months ago

Hi it could be either a new firmware behaviour (i've an older anpr camera to test with), or a different datetime format. The camera records a list of plates and puts the last seen plate on the top of that list. The node must pull this list (there is no other way) and filter by either datetime and file number (the file is the screenshot of the plate). Can you check the datetime format on the camera and assure, that is the same format as your node-red machine?

jpgnz commented 5 months ago

Ok understood.

NodeRed is running as a HomeAssistant Addon. HomeAssistant has the correct time, as does NodeRed. The camera itself is also correct, everything synced to same NTP server.

Is this the format you expect?

curl -X POST "http://camera.ip:80/ISAPI/Traffic/channels/1/vehicleDetect/plates" \
     -H "Content-Type: application/xml" \
     --data-raw "<AfterTime><picTime></picTime></AfterTime>" \
     --max-redirs 20 \
     --max-time 5 \
     --location \
     --digest \
     -u "login:pass"
<?xml version="1.0" encoding="UTF-8"?>
<Plates version="2.0" xmlns="http://www.hikvision.com/ver20/XMLSchema">
<Plate>
<snipped>
</snipped>
</Plate>
<Plate>
<captureTime>20240416T174516+1200</captureTime>
<plateNumber>DSF234</plateNumber>
<picName>202404161745168960</picName>
<country>ATN</country>
<laneNo>1</laneNo>
<direction>reverse</direction>
<matchingResult>otherlist</matchingResult>
</Plate>
<Plate>
<captureTime>20240416T174653+1200</captureTime>
<plateNumber>PME521</plateNumber>
<picName>202404161746538570</picName>
<country>ATN</country>
<laneNo>1</laneNo>
<direction>reverse</direction>
<matchingResult>otherlist</matchingResult>
</Plate>
</Plates>
Supergiovane commented 5 months ago

Hi yes, is that was i'm expecting. Let me test your XML, because my camera uses xml api schema version 1.0, while yours the 2.0. I revert to you asap...

Supergiovane commented 5 months ago

Hi, are you able to replace a file into home assistant's node-red installation? If yes, please find ANPR-config.js and replace it with the content of this zip, then restart node-red. If you're unable, i'll publish an update, but it will take some time to show up in the node-red palettes. ANPR-config.js.zip

jpgnz commented 5 months ago

Hey @Supergiovane - I have SSH access, easier for me to just manually modify the file, which I've done, and it looks to be resolved:

image

Now I just need to wait for a vehicle... :) Thanks.

Supergiovane commented 5 months ago

You're wellcome and thank you to you for providing me the XML!!

jpgnz commented 5 months ago

Amazing response time, much appreciated.

Supergiovane commented 5 months ago

You're wellcome! :-)

jpgnz commented 5 months ago

Can confirm, lots of traffic today, fix worked as expected, thanks!

Supergiovane commented 5 months ago

Thanks to you for the feedback.