The idea is to use each camera for zone presence detection, say to answer queries like: āWhere is Cedric?ā returning āCedric is in the kitchenā. Even as a doorbel type detection, this makes sense as you can output: āCedric and Luke are at the doorā.
The first face detected works like a charm. Tried to get a second face detected via a second sensor with this:
value_template: '{{ states.image_processing.kitchen.faces[1]["name"].title() }}'
but the sensor output remains āunknownā even with 2 faces detected.
Right now a second face matched will not show up on any template sensor even when one is present on the image_processing entity.
Adding ā.keysā returns:
<built-in method keys of dict object at 0x7f2195c40ee8>
Will have to play around with the developer tools templates section as you guys suggested a while more. If I get a positive, Iāll post back here.
Another way would be to do this directly in the component and have a logic where, if one face matched, write name in attribute face 1. If 2 faces matched, write names in attributes face 1 and face 2ā¦ If no face matched, write none in attributes face 1, face 2, face 3, etcā¦
Thanks again for the assistance!
Update:
Managed to get a second or third face detected to be output in a sensor as per Juanās suggestion:
value_template: '{{ states.image_processing.kitchen.faces[1]["name"].title() }}'
Now itās a matter of finding the right templating structure. Iām really struggling with the very complex matched_faces attributes. Here is the type of thing Iād like to do:
>
{% if is_state_attr('states.image_processing.kitchen.attributes.faces[0]["name"].title() ', 'Unknown') %}
None
{% else %}
{{ states.image_processing.garden.attributes.faces[0]["name"].title() }}
{% endif %}
Then add āand [ānameā]ā if more than one face is present.
A different attribute in the component for each matched face and storing the confidence level separately would make templating a breeze, even for noobs like me!