Open GitKiller-HA opened 1 year ago
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 %}```
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