Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't get currently recognized plate #77

Open
GitKiller-HA opened this issue Feb 15, 2023 · 1 comment
Open

I can't get currently recognized plate #77

GitKiller-HA opened this issue Feb 15, 2023 · 1 comment

Comments

@GitKiller-HA
Copy link

Hi,

There is an example how to compare the currently read plate with the definition of "wached_plates", but how can I get the currently read plate as a sensor ?

I try something like below to get currently read plate and confidence of read:

current_plate_recognizer:
value_template: "{{ state_attr('image_processing.platerecognizer_xxxcamera', 'vehicles').plate }}"

current_plate_recognizer_confidence:
value_template: "{{ state_attr('image_processing.platerecognizer_xxxcamera', 'vehicles').confidence }}"

but I get warning:

Template variable warning: 'list object' has no attribute 'plate' when rendering '{{ state_attr('image_processing.platerecognizer_xxxcamera', 'vehicles').plate }}'

Template variable warning: 'list object' has no attribute 'confidence' when rendering '{{ state_attr('image_processing.platerecognizer_xxxcamera', 'vehicles').confidence }}'

Regards,
Grzegorz

@goedh452
Copy link

goedh452 commented Mar 6, 2023

I encountered the same issue. The warming is because the result is a list. Below the template sensor I created in Home assistant:

sensor:
  unique_id: plate_recognizer_plates
  name: License plates
  icon: mdi:car
  state: >-
    {%- if (state_attr('image_processing.platerecognizer_parking', 'vehicles') |count) == 0 %}
    None
    {% else %}
      {%- for i in range(0, (state_attr('image_processing.platerecognizer_parking', 'vehicles') |count) )%}
      {{- state_attr('image_processing.platerecognizer_parking', 'vehicles')[i].plate | upper}}
      {% endfor %}
    {% endif %}```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants