License Plate Recognition API with platerecognizer.com

How do I make the binary sensor reset after x seconds?

Hi, when you say:

How is this done? In an automation, triggered by motion on a camera?
thanks!

Yes you can use automations, or trigger from the UI

So, this integration is not actively watching a camera feed for license plates but rather only does so when called by an automation? I think that this is good so that there is not an undue load on the cpu or the number of calls to the platerecognizer service. Sorry, but I do not see an example of an automation action that calls this service? Am I missing something?
thanks for the help!

Here’s mine, it detects when my doorbell detects motion, and 1 second later it scans 1 still image from my other camera. I also use other automations and sensors to send notifications if someone i know is here.

alias: DoorBird Motion Plate
description: ''
trigger:
  - platform: event
    event_type: doorbird_doorbird_motion
condition: []
action:
  - delay:
      hours: 0
      minutes: 0
      seconds: 1
      milliseconds: 0
  - service: image_processing.scan
    target:
      entity_id: image_processing.platerecognizer_gate_camera_2
mode: single

Edit: And for the notifications, I first set up watched plates in configuration.yaml

watched_plates:
     - EXAMPLEPLATE
     - EXAMPLEPLATE

Then, I configured a Template Sensor for each one of my plates:

  - platform: template
    sensors:
      plate_recognizer:
        friendly_name: "Yukon"
        value_template: "{{ state_attr('image_processing.platerecognizer_gate_camera_2', 'watched_plates').EXAMPLEPLATE }}"
        unique_id: 'sensor.yukon_plate'

Now i have a sensor for each one of the license plates I want Plate Recognizer to watch for. image
Next, I used this to create an automation like this, that sends a notification to everyone’s phone when the camera detects a familiar car.

alias: one of the plate sensors detected
description: ''
trigger:
  - platform: state
    entity_id: sensor.plate_recognizer_1
    from: 'False'
    to: 'True'
  - platform: state
    entity_id: sensor.plate_recognizer_2
    from: 'False'
    to: 'True'
condition: []
action:
  - service: notify.notify_all
    data:
      message: '{{ trigger.to_state.name }} has been detected at the gate!'
      title: License Plate Detection
      data:
        channel: plate
        color: green
        image: /local/images/platerecognizer/platerecognizer_gate_camera_2_latest.png
        attachment:
          url: >-
            /local/images/platerecognizer/platerecognizer_gate_camera_2_latest.png
          content-type: jpg
          hide-thumbnail: false
mode: single

Final Result:

2 Likes

Thanks for the example. Exactly what is was looking for!

1 Like

License plate

It runs platerecognizer scan service when motion detected by door bird sensor

1 Like

Hello,
i am trying to install this Haks.
but I always have these errors in starting home Assistat OS:
version = 1.4.1

2022-01-06 16:11:57 WARNING (MainThread) [homeassistant.components.image_processing] Setup of image_processing platform platerecognizer is taking over 10 seconds.
2022-01-06 16:12:44 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: image_processing.platerecognizer
2022-01-06 16:12:47 ERROR (MainThread) [homeassistant.components.image_processing] Setup of platform platerecognizer is taking longer than 60 seconds. Startup will proceed without waiting any longer.

my config is:
image_processing:

  • platform: platerecognizer

    api_token: xxxxxx

    regions:

    • it

watched_plates:

- ed485kc

- kfab726

save_file_folder: /config/www/plates

save_timestamped_file: True

always_save_latest_file: True

source:

  - entity_id: camera.Camera1

suggestions?

Tnx Mauro

image_processing:
  - platform: platerecognizer
    api_token: xxx
    regions:
      - it 
#    watched_plates:
#      - ed485kc
#      - kfab726
    save_file_folder: /config/www/plates
    save_timestamped_file: True
    always_save_latest_file: True 
    source:
      - entity_id: camera.Camera1
 

@robmarkcole If the license plate has a leading number the sensor template will not process. Dutch licence plates often lead with a number

Example this works:

- platform: template
  sensors:
    plate_recognizer:
      friendly_name: "Audi"
      value_template: '{{ state_attr("image_processing.platerecognizer_driveway", "watched_plates").abcde }}'

But this does not (different license plate):

- platform: template
  sensors:
    plate_recognizer:
      friendly_name: "Audi"
      value_template: '{{ state_attr("image_processing.platerecognizer_driveway", "watched_plates").4xjz58 }}'

The only difference is a number is leading the license plate.

This gives a template error in HASS:

Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected token ‘end of print statement’, got ‘xjz58’) for dictionary value @ data[‘sensors’][‘plate_recognizer’][‘value_template’]. Got ‘{{ state_attr(“image_processing.platerecognizer_driveway”, “watched_plates”).4xjz58 }}’. (See ?, line ?).

see Plates starting with a number recognized by ALPR but not recorded by HA ¡ Issue #58 ¡ robmarkcole/HASS-plate-recognizer ¡ GitHub

This seems to be a different issue; After calling the service the state of this license plate = true (see also screenshot) so this all works fine. it’s the sensor template that does not render when there is a leading number

Hello. It doesn’t work for Spanish license plates. If it does not start with a letter, the sensor gives an error and does not allow the automation to be saved.
Any solution?. Thank you.

Hi,

First of all really great job!
I’m using it since today and works very nicely. Still I have a question: if I understand it right we can’t directly send a picture (link of a picture) through this integration ?
Because for some cameras it would be nice if we could send a picture.
I have the Netatmo Outdoor Camera. This camera detects movement and even recognize when it is a vehicle. It then sends via webhook a sliced image with only the car that has moved. Is it possible to send this image directly to platereconizer?

Thanks

If you can display that image as a camera in home-assistant, then it can be processed with this integration. I’m not sure how you would do it with webhook, perhaps using an automation, I am not too familiar with best practice using web hooks

HI,

I have just installed your project and it is very fine.

my question are: is it possible to show recognized plates in HA?

BR

All the recognised plates are in the attributes

Found that. Thanks.

I can’t get the plate out of the entity. just a newbie.

Is there a way to show last 10 plates? I can’t find it anywhere.

BR

Add this to a template sensor, it will list all the detected plates.
Probably a better way, but it will get you started

You’ll need to change the image_processing entity to whatever yours is called

    - name: "Detected Plates Drive"
      icon: mdi:numeric
      state: >-
        {% set vehicles = state_attr('image_processing.platerecognizer_drive_last_motion', 'vehicles') %}
        {% if (states('image_processing.platerecognizer_drive_last_motion') !=0 and states('image_processing.platerecognizer_drive_last_motion') !='unavailable' and states('image_processing.platerecognizer_drive_last_motion') !='unknown') %}
            {% for x in range((vehicles)|length) %}
                {{ vehicles[x]['plate'] | upper }}
            {% endfor %}
        {% endif %}

If you have the sensor in the recorder, the history will show the plates over time

And have a look above there’s a post on how to do it:

Is there an easy way to limit the amount of license plates it saves? I guess i could turn off the save options, but i’d still like a certain amount to be saved.