License Plate Recognition API with platerecognizer.com

edit - got this working pretty reliably and announcing on registrations

thanks for the work on this, got it working so reolink vehicle detection is notifying and automation running are showng the numberplates (although not always reading them yet by platerecognizer despite being clear in picture)
has anyone got an automation prepared to announce a newly scanned plate over a media player like alexa echo devices to announce the scanned registration and the last screen grab saved by my reolink camera? trying but struggling to get the state correctly from the last scanned sensor and have an image show up in notification, appreciate any help
thanks

Did you find how to do that ?

Hi! This is my code, in my file binarysensors.yaml:

    - state_topic: "BI/AI/Bil"
      name: "Bil på garageuppfarten"
      device_class: motion
      payload_on: "ON"
      off_delay: 10

Hi,

I use this for more than a year, and it work like a charm, with sensors for each watched plates.

Beside, is there a way of easily manage watched plate, eg an input text or a file etc ? Something manageable from the UI ?

When you want to add a plate it is a little pain in the ass, as for now I have the watched plates in configuration file, then a sensor for each and finally an automation for each to open the gate. Something that is heavy to add from the phone and for me, need a computer each time.

In my mind it would be a card with a list of input text so you can write the plate, and a switch to activate it or not.

Thank for your ideas !

1 Like

It’s been a while since I wrote any HA integrations. I think if I was doing this now I would implement a standalone app, similar to Frigate, with a full UI. For now, it’s a config file job unless someone is keen to update and add a service for adding plates

1 Like

I might have misse something obvious, so forgive me if there is an obvious solution!

I have two cameras I want to run the automation on. I’ve tried setting up two configs like shown below. But then HA complaints about “duplicate key “image_processing””.

How do I do this correctly?

**Note that one of the “processors” run and work fine.

image_processing:
 - platform: platerecognizer
   api_token: ***
   regions:
     - dk
   save_file_folder: /config/www/plates
   save_timestamped_file: True
   always_save_latest_file: True
   source:
     - entity_id: camera.1
     
image_processing:
 - platform: platerecognizer
   api_token: ***
   regions:
     - dk
   save_file_folder: /config/www/plates
   save_timestamped_file: True
   always_save_latest_file: True
   source:
     - entity_id: camera.2

Hello.
Is there a way to use this integration as a one-way integration? I only need to import the last registered license plate and snapshot into Home Assistant since I am using Frigate → PlateRecognizer instead. It could potentially be triggered through a webhook, which I already have control over.
Regards

Hi All,

I have configure this number plate recognition , However it;s not working for me as expected . I must be missing something.

After initial config , I did ran a trail and it worked.
After the initial config the status of the of the image processor is unknown

Once the number plate detected on my drive way its became 1 and the number plate sensor became True from state False.

Problem 1- Every reboot of HA make the image processor status unknown. At some point after the reboot now its not changing the state from unknown. While checking the https://platerecognizer.com/
I found that for every instance the number plate scan happened and state was true. Even the Image processor is not updating the API Calls count . It getting the updated if I reboot the HA.Its also not storing the snapshot (PIC) which was uploaded to the API during the image scan.

Problem 2 - Once the number plate sensor state change from True from False my automation triggers . However the sensor state are not getting back to false . How can I get it reset automatically after a certain time such as , if the state change from False to True then remain true for 30sec or 2 min then became False . so that next time when the image scan happen it may change to true bases on the number plate.

my configuration are as below :


#Number Plate Recognizer
image_processing:
  - platform: platerecognizer
    api_token: !secret plate_recognizer_token
    regions:
      - au #replace with your region
    watched_plates:
      #- !secret number_plate
      - ABCD
      - EFGH
    save_file_folder: /config/www/plate_recognizer #replace with your location if you have a different one
    save_timestamped_file: true
    always_save_latest_file: true
    source:
      - entity_id: camera.driveway_cam_main #replace entity id

I have defined the api_token in the secret.yaml

plate_recognizer_token: xxxxxxxxxxxxxxxxx

Sensors :

- platform: template
    sensors:
      plate_recognizer:
        friendly_name: "ABCD"
        value_template: "{{ state_attr('image_processing.platerecognizer_driveway_cam_main', 'watched_plates').ABCD }}"
      plate_recognizer_1:
        friendly_name: "EFGH"
        value_template: "{{ state_attr('image_processing.platerecognizer_driveway_cam_main', 'watched_plates').EFGH }}"

My automation-1 looks like this : - it will trigger once there is a vechile motion detected on my drive way.

alias: Number Plate Scan
description: Scan the number plate when there is vehicle motion detected on diveway
trigger:
  - type: motion
    platform: device
    device_id: 8e61e2afb7f7b978d561184a04a6f205
    entity_id: 2df8477fd76faf731eae3c218dae48d1
    domain: binary_sensor
condition:
  - condition: not
    conditions:
      - type: is_motion
        condition: device
        device_id: 8e61e2afb7f7b978d561184a04a6f205
        entity_id: 2df8477fd76faf731eae3c218dae48d1
        domain: binary_sensor
        for:
          hours: 0
          minutes: 1
          seconds: 0
action:
  - action: image_processing.scan
    metadata: {}
    data: {}
    target:
      entity_id: image_processing.platerecognizer_driveway_cam_main
mode: single

My automation-2 looks like this : - it will open the garage door once the number plate sensor status change from false to true.


alias: RegoSensorOPENGararage
description: Garage Door will be open once the Rego is detected
trigger:
  - platform: state
    entity_id:
      - sensor.plate_recognizer
      - sensor.plate_recognizer_1
    to: "true"
    from: "false"
condition:
  - condition: device
    device_id: 9a02c9bb3454b78fdb35c68b4eec7521
    domain: cover
    entity_id: 1867f92c91fc70e41d684d4f35b84080
    type: is_closed
action:
  - device_id: 9a02c9bb3454b78fdb35c68b4eec7521
    domain: cover
    entity_id: 1867f92c91fc70e41d684d4f35b84080
    type: open
mode: single

Hi Everyone ,

I figured out that if I manually change the Plate_Recognizer state then this is not working . I had to restart , then its working again .

But the problem is once the HA restarted image scan process status change from 0 or 1 to unknown .one number plate detected and status changes to 1 only its again starting to work.

I have to fix 2 problem . 1- after a reboot the image processing status should not be resetting to unknown. 2- The Plate recognizer sensor needs to go back to False after a status true so that my automatons will work. Manually changing the state of any sensor is breaking the hole things.

Hi!
New idea a triggering of automation based on generated event, without a template sensors, my example:

alias: dzwonek stilo_psr67j9
description: ""
trigger:
  - platform: event
    event_type: platerecognizer.vehicle_detected
    event_data:
      plate: psr67j9
condition: []
action:
  - action: notify.persistent_notification
    metadata: {}
    data:
      message: stilo
mode: single

1 Like

Been playing around with it a couple of weeks created something similar, as trying to use the “Watched plate” attribute was challenging to use for me at least.

Created a Template Helper “Detected Plate” to track if a Number Plate was being detected

{{state_attr('image_processing.platerecognizer_driveway_clear','vehicles')[0]['plate']}}

Then I used that in an automation:

alias: Notification - ALPR - Watched Plate Detection
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.detected_plate
condition:
  - condition: template
    value_template: >-
      {{ state_attr('image_processing.platerecognizer_driveway_clear',
      'vehicles')| map(attribute='plate') | list is search('xxx123|zzz456')}}
action:
  - action: notify.pushover
    metadata: {}
    data:
      target: David
      title: ALPR detection from Driveway
      message: >-
        Rego
        {{state_attr('image_processing.platerecognizer_driveway_clear','vehicles')[0]['plate']}}
        has been detected on the driveway! With a confidence Level of
        {{(state_attr('image_processing.platerecognizer_driveway_clear','vehicles')[0]['confidence']
        * 100) | round (2) }}% at
        {{state_attr('image_processing.platerecognizer_driveway_clear' ,
        'last_detection') }}
mode: single

The condition statement, validates that it is one of my plates I’m tracking and then goes to the action, right now a Pushover message, but intent is to open the electric gate / door.

If a unknown plate is detected I have currently a separate automation to send me an message with that plate details.

Next step is to combine the two automation into a single automation which should be simply a “Choose” action

I’m using Rob’s integration with Frigate+ which does a pretty good job of getting an image of a license plate at the right moment due to the built in smarts. (I was never quite able to get this with the motion detection trigger)
Is there a way to get this image identity (e.g. image.license_plate_car) processed and sent to platerecognizer instead of triggering a camera snapshot (and regularly miss the plate)?