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
Official PyTorch implementation of "Meta-Learning with Task-Adaptive Loss Function for Few-Shot Learning" (ICCV2021 Oral)

MeTAL - Meta-Learning with Task-Adaptive Loss Function for Few-Shot Learning (ICCV2021 Oral) Sungyong Baik, Janghoon Choi, Heewon Kim, Dohee Cho, Jaes

Sungyong Baik 44 Dec 29, 2022
From a body shape, infer the anatomic skeleton.

OSSO: Obtaining Skeletal Shape from Outside (CVPR 2022) This repository contains the official implementation of the skeleton inference from: OSSO: Obt

Marilyn Keller 166 Dec 28, 2022
Machine learning Bot detection technique, based on United States election dataset

Machine learning Bot detection technique, based on United States election dataset (2020). Current github repo provides implementation described in pap

Alexander Shevtsov 4 Nov 20, 2022
🔥3D-RecGAN in Tensorflow (ICCV Workshops 2017)

3D Object Reconstruction from a Single Depth View with Adversarial Learning Bo Yang, Hongkai Wen, Sen Wang, Ronald Clark, Andrew Markham, Niki Trigoni

Bo Yang 125 Nov 26, 2022
reimpliment of DFANet: Deep Feature Aggregation for Real-Time Semantic Segmentation

DFANet This repo is an unofficial pytorch implementation of DFANet:Deep Feature Aggregation for Real-Time Semantic Segmentation log 2019.4.16 After 48

shen hui xiang 248 Oct 21, 2022
Code To Tune or Not To Tune? Zero-shot Models for Legal Case Entailment.

COLIEE 2021 - task 2: Legal Case Entailment This repository contains the code to reproduce NeuralMind's submissions to COLIEE 2021 presented in the pa

NeuralMind 13 Dec 16, 2022
FedGS: A Federated Group Synchronization Framework Implemented by LEAF-MX.

FedGS: Data Heterogeneity-Robust Federated Learning via Group Client Selection in Industrial IoT Preparation For instructions on generating data, plea

Lizonghang 9 Dec 22, 2022
Codes for AAAI22 paper "Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum"

Paper For more details, please see our paper Learning to Solve Travelling Salesman Problem with Hardness-Adaptive Curriculum which has been accepted a

14 Sep 30, 2022
Differentiable architecture search for convolutional and recurrent networks

Differentiable Architecture Search Code accompanying the paper DARTS: Differentiable Architecture Search Hanxiao Liu, Karen Simonyan, Yiming Yang. arX

Hanxiao Liu 3.7k Jan 09, 2023
El-Gamal on Elliptic Curve (Python)

El-Gamal-on-EC El-Gamal on Elliptic Curve (Python) References: https://docsdrive.com/pdfs/ansinet/itj/2005/299-306.pdf https://arxiv.org/ftp/arxiv/pap

3 May 04, 2022
Unofficial PyTorch implementation of MobileViT based on paper "MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer".

MobileViT RegNet Unofficial PyTorch implementation of MobileViT based on paper MOBILEVIT: LIGHT-WEIGHT, GENERAL-PURPOSE, AND MOBILE-FRIENDLY VISION TR

Hong-Jia Chen 91 Dec 02, 2022
AniGAN: Style-Guided Generative Adversarial Networks for Unsupervised Anime Face Generation

AniGAN: Style-Guided Generative Adversarial Networks for Unsupervised Anime Face Generation AniGAN: Style-Guided Generative Adversarial Networks for U

Bing Li 81 Dec 14, 2022
TargetAllDomainObjects - A python wrapper to run a command on against all users/computers/DCs of a Windows Domain

TargetAllDomainObjects A python wrapper to run a command on against all users/co

Podalirius 19 Dec 13, 2022
An efficient 3D semantic segmentation framework for Urban-scale point clouds like SensatUrban, Campus3D, etc.

An efficient 3D semantic segmentation framework for Urban-scale point clouds like SensatUrban, Campus3D, etc.

Zou 33 Jan 03, 2023
Official Pytorch implementation of "Unbiased Classification Through Bias-Contrastive and Bias-Balanced Learning (NeurIPS 2021)

Unbiased Classification Through Bias-Contrastive and Bias-Balanced Learning (NeurIPS 2021) Official Pytorch implementation of Unbiased Classification

Youngkyu 17 Jan 01, 2023
ArcaneGAN by Alex Spirin

ArcaneGAN by Alex Spirin

Alex 617 Dec 28, 2022
FAVD: Featherweight Assisted Vulnerability Discovery

FAVD: Featherweight Assisted Vulnerability Discovery This repository contains the replication package for the paper "Featherweight Assisted Vulnerabil

secureIT 4 Sep 16, 2022
A check for whether the dependency jobs are all green.

alls-green A check for whether the dependency jobs are all green. Why? Do you have more than one job in your GitHub Actions CI/CD workflows setup? Do

Re:actors 33 Jan 03, 2023
Flexible Option Learning - NeurIPS 2021

Flexible Option Learning This repository contains code for the paper Flexible Option Learning presented as a Spotlight at NeurIPS 2021. The implementa

Martin Klissarov 7 Nov 09, 2022