License Plate Recognition API with platerecognizer.com

For anyone who wants a simple notification if new cars are scanned.
You will need to create an input_text which holds last state with plates, I’ve named it: “current_cars_in_driveway”. You will also need to change the push service :slight_smile:
If you want to ignore some plates you can add it inside the [] in the variable ignored_plates

- id: '1613380190443'
  alias: New cars in driveway
  description: ''
  trigger:
  - platform: event
    event_type: platerecognizer.vehicle_detected
  condition: []
  action:
  - service: input_text.set_value
    data:
      value: '{{ updated_plates | join('','') }}'
    entity_id: input_text.current_cars_in_driveway
  - choose:
    - conditions:
      - condition: 'template'
        value_template: '{{ new_plates|length > 0 }}'
      sequence:
        - service: notify.push
          data:
            message: '{{ ''A new car on driveway! Plate: '' + (new_plates | join('', '')) }}'
  mode: single
  variables:
    ignored_plates: '{{ [] }}'
    old_plates: '{{ states(''input_text.current_cars_in_driveway'').split('','') | list }}'
    updated_plates: '{{ state_attr(trigger.event.data.entity_id, ''vehicles'') | map(attribute=''plate'') | list }}'
    new_plates: '{{ updated_plates | reject(''in'', old_plates) | reject(''in'', ignored_plates) | list }}'
3 Likes