Read number plates with https://platerecognizer.com/

Overview

HASS-plate-recognizer

Read vehicle license plates with https://platerecognizer.com/ which offers free processing of 2500 images per month. You will need to create an account and get your API token.

This integration adds an image processing entity where the state of the entity is the number of license plates found in a processed image. Information about the vehicle which has the license plate is provided in the entity attributes, and includes the license plate number, region/country, vehicle type, and confidence (in a scale 0 to 1) in this prediction. For each vehicle an platerecognizer.vehicle_detected event is fired, containing the same information just listed. Additionally, statistics about your account usage are given in the Statistics attribute, including the number of calls_remaining out of your 2500 monthly available.

Note this integration does NOT automatically process images, it is necessary to call the image_processing.scan service to trigger processing.

Home Assistant setup

Place the custom_components folder in your configuration directory (or add its contents to an existing custom_components folder). Then configure as below:

image_processing:
  - platform: platerecognizer
    api_token: your_token
    regions:
      - gb
      - ie
    save_file_folder: /config/images/platerecognizer/
    save_timestamped_file: True
    always_save_latest_file: True
    source:
      - entity_id: camera.yours

Configuration variables:

  • api_key: Your api key.
  • regions: (Optional) A list of regions/countries to filter by. Note this may return fewer, but more specific predictions.
  • save_file_folder: (Optional) The folder to save processed images to. Note that folder path should be added to whitelist_external_dirs
  • save_timestamped_file: (Optional, default False, requires save_file_folder to be configured) Save the processed image with the time of detection in the filename.
  • always_save_latest_file: (Optional, default False, requires save_file_folder to be configured) Always save the last processed image, no matter there were detections or not.
  • source: Must be a camera.

Video of usage

Checkout this excellent video of usage from Everything Smart Home

Comments
  • Empty pictures when using nest camera

    Empty pictures when using nest camera

    Hi

    I’m using outdoor nest cameras that are 24/7 powered. I have setup the integration correctly but when start the image proccessing the png saved doesn’t have a picture. The file is there in the confit folder but there is no picture, it’s just white

    I don’t have a car to test with this evening, does a car need to be in the frame of the camera for the image processing event to generate a picture?

    opened by henrikrox 5
  • This worked once but now I'm getting an error in the HA log.

    This worked once but now I'm getting an error in the HA log.

    Any idea's what is causing this?

    Logger: homeassistant.helpers.entity Source: custom_components/platerecognizer/image_processing.py:124 First occurred: 16:24:45 (10 occurrences) Last logged: 17:07:22

    Update for image_processing.platerecognizer_driveway_top fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update raise exc File "/usr/src/homeassistant/homeassistant/components/image_processing/init.py", line 132, in async_update await self.async_process_image(image.content) File "/usr/src/homeassistant/homeassistant/components/image_processing/init.py", line 112, in async_process_image return await self.hass.async_add_executor_job(self.process_image, image) File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/platerecognizer/image_processing.py", line 124, in process_image self._image = Image.open(io.BytesIO(bytearray(image))) File "/usr/local/lib/python3.8/site-packages/PIL/Image.py", line 2958, in open raise UnidentifiedImageError( PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7fa2e30c20>

    opened by healeydave 5
  • get_orientations error: 'orientation'

    get_orientations error: 'orientation'

    Getting following error get_orientations error: 'orientation'. Getting this everytime a platrecognizer is triggered

    Source: custom_components/platerecognizer/image_processing.py:94

    Running release 1.1.0 of Plate and HA 2021.5.2

    opened by greberg 4
  • Watched Plates Sensor Issue

    Watched Plates Sensor Issue

    I can get plate recognizer to work with my home assistant however I am having issue when adding watched plates sensor

    Below is my sensor code

    sensor:

    • platform: template sensors: plate_recognizer: friendly_name: "abc12d" value_template: "{{ state_attr('image_processing.platerecognizer_1', 'watched_plates').abc12d }}"

    Home Assistant having this warning in the log image

    When I scan plate-recognizer, it can detect my license plate but the sensor does not change state. My home assistant version is core-2021.9.0b6.

    opened by htiennhan 3
  • All attributes missing from image_processing entity

    All attributes missing from image_processing entity

    Since updating to 2022.4.b0 All attributes missing from image_processing entity. State works OK and is showing the number of plates.

    Set logging to debug and only shows this:

    2022-03-31 17:38:12 DEBUG (SyncWorker_17) [custom_components.platerecognizer.image_processing] Config: {"detection_rule": "strict", "region": "False"}

    opened by holdestmade 2
  • Coordinates of detected plate box

    Coordinates of detected plate box

    Looking on Platerecognizer's website, it says it returns coordinates of the detected plate box, is this possible to add ?

    The centre of the box would suffice, I would like to check where each plate is detected (drive or road)

    results/box | Bounding box for the license plate. Coordinates in pixel of the top left and bottom right corners of the plate. -- | --

    opened by holdestmade 2
  • Thank you /

    Thank you /

    Hey Rob

    Firstly, thank you so much for this. We live on a large rural property in Australia and are using this to work out who is at our gate and automatically open the gate if we like them :)

    I wondered if you had considered allowing the intergration to connect to a on-premise instance of plate recogniser (running in a docker container).

    https://app.platerecognizer.com/sdk/

    I wish I knew how to code, in which case I would raise a PR and not an issue.

    Please keep up the great work.

    P.S. I have been working with Plate Recogniser to get a more affordable plan for plan for us all. The new plan pricing will work for Cloud and SDK licenses.

    opened by dalewright 2
  • [Feature Request] - Url or file as source instead of camera

    [Feature Request] - Url or file as source instead of camera

    It would be great to be able to use an url or a file for source instead of camera.

    Use case I'm using Frigate as NVR- software and when using the official HA-component for Frigate it creates all cameras in HA with a max height of 277px. I've found that that is a little bit to small for my setup when running plates. It would be great to be able to set an url directly to my Frigate instance where I can access a full resolution image of the camera feed.

    opened by thrawnarn 2
  • SUGGESTION: Change /config/images/platerecognizer/ to /config/www/images/platerecognizer/ in readme

    SUGGESTION: Change /config/images/platerecognizer/ to /config/www/images/platerecognizer/ in readme

    Love the integration, but in my opinion this would be a better default location, because then you can create local file cameras, and otherwise you can't do things like send the latest image in a notification via automation.

    opened by shanem2004 2
  • Add watched_plate arg

    Add watched_plate arg

    Parallels https://github.com/robmarkcole/HASS-Sighthound/issues/22

    Add a watched_plate arg that is a list of plates to watch for, allowing fuzzy matching. I.e. a matched plate will be detected when there is a good match of characters using regex. For each plate an attribute is exposed which is a binary sensor indicating if the plate was in the last scanned imaged or not. Add a watched_plate event as well?

    opened by robmarkcole 2
  • Issue plate start with number

    Issue plate start with number

    My country plate start with number like

    29a12345

    if I put this in template

    plate_recognizer: friendly_name: "29a12345" value_template: "{{ state_attr('image_processing.platerecognizer_frontgate', 'watched_plates').29a12345}}"

    will error

    Invalid config for [sensor.template]: invalid template (TemplateSyntaxError: expected name or number) for dictionary value @ data['sensors']['plate_recognizer']['value_template']. Got "{{ state_attr('image_processing.platerecognizer_frontgate', 'watched_plates').'29a12345' }}". (See ?, line ?).

    opened by chimcanhcut1112 1
  • Can i use multiple camera entity sources?

    Can i use multiple camera entity sources?

    Also, can i put image_processing in a file rather then configuration.yaml ?

    Finally, is the sensor configuration new style or old style?

    Thanks for your help!

    opened by atv2016 1
  • Update for image_processing.platerecognizer_doorbell_main_proxy fails

    Update for image_processing.platerecognizer_doorbell_main_proxy fails

    Any idea what would cause this?

    This error originated from a custom integration.

    Logger: homeassistant.helpers.entity
    Source: custom_components/platerecognizer/image_processing.py:224
    Integration: platerecognizer (documentation)
    First occurred: 16 November 2022 at 21:27:27 (884 occurrences)
    Last logged: 16:02:06
    
    Update for image_processing.platerecognizer_doorbell_main_proxy fails
    Traceback (most recent call last):
      File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
        return complexjson.loads(self.text, **kwargs)
      File "/usr/local/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
        return _default_decoder.decode(s)
      File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 373, in decode
        raise JSONDecodeError("Extra data", s, end, len(s))
    simplejson.errors.JSONDecodeError: Extra data: line 1 column 4 - line 1 column 15 (char 3 - 14)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/config/custom_components/platerecognizer/image_processing.py", line 206, in process_image
        ).json()
      File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
        raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Extra data: line 1 column 4 (char 3)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state
        await self.async_device_update()
      File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update
        raise exc
      File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 163, in async_update
        await self.async_process_image(image.content)
      File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 144, in async_process_image
        return await self.hass.async_add_executor_job(self.process_image, image)
      File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/config/custom_components/platerecognizer/image_processing.py", line 224, in process_image
        _LOGGER.error(f"platerecognizer api response: {response}")
    UnboundLocalError: local variable 'response' referenced before assignment
    

    This is my config

      - platform: platerecognizer
        api_token: xxxxxxx
        regions:
          - gb
        save_file_folder: /config/images/platerecognizer/
        save_timestamped_file: True
        always_save_latest_file: True
        watched_plates:
          - xx67xxx
        mmc: True
        detection_rule: strict
        region: strict
        server: https://myhostname.com/v1/plate-reader/
        source:
          - entity_id: camera.doorbell_main_proxy
    
    opened by totalitarian 3
  • Using region no (Norway) results in error -

    Using region no (Norway) results in error - "no" is registered as boolean "false"

    Hi, Thanks for the effort.

    I am trying to use this integration with the region "no", and i get the following error message in the system log: platerecognizer api response: {'regions': ['Region "False" does not exist. List of regions: http://docs.platerecognizer.com/#countries']}

    My yaml contains the following:

    regions: - no

    Workaround is to use: regions: - dk

    opened by laabak84 1
  • build sensor last found plate (attributes not working?)

    build sensor last found plate (attributes not working?)

    I want to make an sensor where I can se the last plate found NOT known.

    here is what I have been trying.

    in developer tools:

    {{ state_attr('image_processing.platerecognizer_garage_2' , 'vehicles') }}

    output

    [{'plate': 'nkeXXXX', 'confidence': 0.683, 'region_code': 'pl', 'vehicle_type': 'Big Truck', 'box_y_centre': 116.0, 'box_x_centre': 1563.0}]

    so I want to show attribute 'plate'

    {{ state_attr('image_processing.platerecognizer_garage_2' , 'vehicles').plate }}

    output

    none

    expected output

    nkeXXXX

    is there something I am missing ?

    opened by koburg 0
  • Image filenames are very long and dont display well

    Image filenames are very long and dont display well

    Can the filenames generated be customized? I just need the format to be shorter to display neatly in my gallery browser card but the generated filename is something like platerecognizer_driveway_cam_jpg_2022-07-22_10-04-48 which is really long and messes us how things are displayed with text for thumbnails overlaying on top of each other etc.

    opened by craigueh 3
Releases(1.4.1)
Owner
Robin
Physics PhD, python dev, data science and engineering, interests include deep learning & IOT
Robin
This project uses reinforcement learning on stock market and agent tries to learn trading. The goal is to check if the agent can learn to read tape. The project is dedicated to hero in life great Jesse Livermore.

Reinforcement-trading This project uses Reinforcement learning on stock market and agent tries to learn trading. The goal is to check if the agent can

Deepender Singla 1.4k Dec 22, 2022
Designing a Minimal Retrieve-and-Read System for Open-Domain Question Answering (NAACL 2021)

Designing a Minimal Retrieve-and-Read System for Open-Domain Question Answering Abstract In open-domain question answering (QA), retrieve-and-read mec

Clova AI Research 34 Apr 13, 2022
ESP32 python application to read data from a Tilt™ Hydrometer for homebrewing

TitlESP32 ESP32 MicroPython application to read and log data from a Tilt™ Hydrometer. Requirements A board with an ESP32 chip USB cable - USB A / micr

IoBeer 5 Dec 1, 2022
Read Like Humans: Autonomous, Bidirectional and Iterative Language Modeling for Scene Text Recognition

Read Like Humans: Autonomous, Bidirectional and Iterative Language Modeling for Scene Text Recognition The official code of ABINet (CVPR 2021, Oral).

null 334 Dec 31, 2022
Must-read Papers on Physics-Informed Neural Networks.

PINNpapers Contributed by IDRL lab. Introduction Physics-Informed Neural Network (PINN) has achieved great success in scientific computing since 2017.

IDRL 330 Jan 7, 2023
Allele-specific pipeline for unbiased read mapping(WIP), QTL discovery(WIP), and allelic-imbalance analysis

WASP2 (Currently in pre-development): Allele-specific pipeline for unbiased read mapping(WIP), QTL discovery(WIP), and allelic-imbalance analysis Requ

McVicker Lab 2 Aug 11, 2022
An expansion for RDKit to read all types of files in one line

RDMolReader An expansion for RDKit to read all types of files in one line How to use? Add this single .py file to your project and import MolFromFile(

Ali Khodabandehlou 1 Dec 18, 2021
Read and write layered TIFF ImageSourceData and ImageResources tags

Read and write layered TIFF ImageSourceData and ImageResources tags Psdtags is a Python library to read and write the Adobe Photoshop(r) specific Imag

Christoph Gohlke 4 Feb 5, 2022
Metadata-Extractor - Metadata Extractor Script can be used to read in exif metadata

Metadata Extractor The exifextract script can be used to read in exif metadata f

null 1 Feb 16, 2022
Prompts - Read a textfile of prompts and import into anki via ankiconnect

prompts read a textfile of prompts and import into anki via ankiconnect Usage In

Alexander Cobleigh 2 Jul 28, 2022
Experimental Python implementation of OpenVINO Inference Engine (very slow, limited functionality). All codes are written in Python. Easy to read and modify.

PyOpenVINO - An Experimental Python Implementation of OpenVINO Inference Engine (minimum-set) Description The PyOpenVINO is a spin-off product from my

Yasunori Shimura 7 Oct 31, 2022
DiffQ performs differentiable quantization using pseudo quantization noise. It can automatically tune the number of bits used per weight or group of weights, in order to achieve a given trade-off between model size and accuracy.

Differentiable Model Compression via Pseudo Quantization Noise DiffQ performs differentiable quantization using pseudo quantization noise. It can auto

Facebook Research 145 Dec 30, 2022
A PyTorch implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks

SVHNClassifier-PyTorch A PyTorch implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks If

Potter Hsu 182 Jan 3, 2023
A Number Recognition algorithm

Paddle-VisualAttention Results_Compared SVHN Dataset Methods Steps GPU Batch Size Learning Rate Patience Decay Step Decay Rate Training Speed (FPS) Ac

null 1 Nov 12, 2021
Implementation of Uniformer, a simple attention and 3d convolutional net that achieved SOTA in a number of video classification tasks

Uniformer - Pytorch Implementation of Uniformer, a simple attention and 3d convolutional net that achieved SOTA in a number of video classification ta

Phil Wang 90 Nov 24, 2022
Pytorch Implementations of large number classical backbone CNNs, data enhancement, torch loss, attention, visualization and some common algorithms.

Torch-template-for-deep-learning Pytorch implementations of some **classical backbone CNNs, data enhancement, torch loss, attention, visualization and

Li Shengyan 270 Dec 31, 2022
Graph-total-spanning-trees - A Python script to get total number of Spanning Trees in a Graph

Total number of Spanning Trees in a Graph This is a python script just written f

Mehdi I. 0 Jul 18, 2022
Pseudo-rng-app - whos needs science to make a random number when you have pseudoscience?

Pseudo-random numbers with pseudoscience rng is so complicated! Why cant we have a horoscopic, vibe-y way of calculating a random number? Why cant rng

Andrew Blance 1 Dec 27, 2021
Linear algebra python - Number of operations and problems in Linear Algebra and Numerical Linear Algebra

Linear algebra in python Number of operations and problems in Linear Algebra and

Alireza 5 Oct 9, 2022