Code Monkey home page Code Monkey logo

hass-plate-recognizer's Introduction

HASS-plate-recognizer

Read vehicle license plates with Plate Recognizer ALPR 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.

If you have a paid plan that includes MMC (Make/Model/Colour) data you can received the orientation of the vehicle in the entity attributes.

You can also forward the LPR results straight to ParkPow, a parking management software and sister-company to Plate Recognizer.

If you have a local SDK licence, you can optionally specify the server address.

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
    watched_plates:
      - kbw46ba
      - kfab726
    save_file_folder: /config/images/platerecognizer/
    save_timestamped_file: True
    always_save_latest_file: True
    mmc: True
    detection_rule: strict
    region: strict
    server: http://yoururl:8080/v1/plate-reader/

    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.

  • watched_plates: (Optional) A list of number plates to watch for, which will identify a plate even if a couple of digits are incorrect in the prediction (fuzzy matching). If configured this adds an attribute to the entity with a boolean for each watched plate to indicate if it is detected.

  • 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.

  • mmc: (Optional, default False, requires a paid plan with the MMC (Make, Model, Colour) feature enabled.) If enabled returns the orientation of the vehicle as a separate attribute containing Front/Rear/Unknown.

  • detection_rule: (Optional) If set to strict, the license plates that are detected outside a vehicle will be discarded.

  • region: (Optional) If set to strict, only accept the results that exactly match the templates of the specified region. For example, if the license plate of a region is 3 letters and 3 numbers, the value abc1234 will be discarded. For regions with vanity license plates (e.g. in us-ca), we do not recommend the use of Strict Mode. Otherwise, the engine will discard the vanity plates.

  • server: (Optional, requires a paid plan Provide a local server address to use On-Premise SDK

  • source: Must be a camera.

Making a sensor for individual plates

If you have configured watched_plates you can create a binary sensor for each watched plate, using a template sensor as below, which is an example for plate kbw46ba:

sensor:
  - platform: template
    sensors:
      plate_recognizer:
        friendly_name: "kbw46ba"
        value_template: "{{ state_attr('image_processing.platerecognizer_1', 'watched_plates').kbw46ba }}"

Video of usage

Checkout this excellent video of usage from Everything Smart Home

hass-plate-recognizer's People

Contributors

robmarkcole avatar holdestmade avatar hdurdle avatar supajason avatar gadget-man avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.