Condition with an abbtribute and a contains

I have an automation with facial recognition (via Deepstack) where I want to perform a service conditionally on a part of an attribute.
The attribute I want to use consists of not only the name (if recognized) but also a part with the reliability (in percentage). This percentage can change up to 2 decimal places per call. It is hard to automate that. So I want to test on a part of the attribute by asking if the desired name is in it. But so far (even after a long search and trying) I still can’t get it done. With the current test the ‘notify’ will not be executed. The value_template does result in a ‘True’.
At a later stage I want to ask more people to perform a specific action there as well.
Who has the solution?
This is what I’ve got so far by using the automation gui:

action:
  - service: image_processing.scan
    data:
      entity_id: image_processing.recon_attic
    entity_id: image_processing.recon_attic
  - event: image_processing.detect_face
    event_data:
      entity_id: image_processing.recon_attic
  - choose:
    - conditions:
      - condition: state
        entity_id: image_processing.recon_attic
        state: value_template: "{{ 'Rob' in state_attr( 'image_processing.recon_attic',
          'matched_faces' ) }}"
        attribute: matched_faces
      sequence:
      - service: notify.mobile_app_rob
        data:
          message: Text
          title: Title
    default: []
  mode: single

Your condition is wrong, you probably have an error in the log.

Change the condition to this:

- condition: template
  value_template: "{{ 'Rob' in state_attr('image_processing.recon_attic', 'matched_faces' ) }}"

I guess something went copying the condition but in my automation I have exactly what you have written down (I corrected my own above) but still doesn’t perform the action afterwards. I still think I need an ‘if’ and comparison with ‘true’ or ‘false’.

You don’t need an if statement for true/false condition.
What does this show in Developer Tools -> Templates? I have a smiliar template that works just fine like this.

state_attr('image_processing.recon_attic', 'matched_faces' )

Does it return a list or a string with comma separated values? Can you show an example output for this attribute?

It gives me a ‘True’ when my face was recognized and a ‘False’ if not but the notify.service doesn’t fire in either case.

Maybe the image processing is not done yet when you check the condition.
Does it send a message when you remove the condition?
Also what is the event part in your action? I don’t think that’s even valid syntax for an action. What should this part do?
Are there any errors in your logs?

There are no errors in the log and the image processing is finished because I do have the conformation of that in my entity.
Are you sure you are on the right track? How do you distinguish between 'true’and sent a message and ‘false’ and don’t sent the message?
It does work when I remove the condition. Then I do get a message.

I just took a look at your corrected condition and this is still not correct, you only changed the quotes, but you still have condition: state instead of condition: template. And there’s no entity_id in a template condition and it’s not state, it’s value template.

Change to this:

- choose:
    - conditions:
      - condition: template
        value_template: "{{ 'Rob' in state_attr('image_processing.recon_attic', 'matched_faces') }}"
      sequence:
      - service: notify.mobile_app_rob
        data:
          message: Text
          title: Title

What you mean is that I can’t use the GUI for automations but I have to construct the automation yaml myself?
If that’s the case you might have solved my problem. I will give it a try.

Maybe, I only tried the automation editor in the beginning and back then it was too limited for me.
I can’t check at the moment, but is there no condition of type “template” in the aitomatiom editor?
Since v 0.117.0 you can also edit the yaml in the UI editor see here

It works. You should never do 2 things at the same time. I did just that and because I couldn’t get it to work, I overlooked the simple solution. ‘Template’ in my language is ‘Sjablone’ and I overlooked it all the time. So it can be solved with the GUI and it works perfectly.
Thanks for the help!
This is the end result including face recognition with Deepstack:

- id: '1604688175464'
  alias: Test
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.frontdoor_motion
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: image_processing.scan
    data:
      entity_id: image_processing.recon_attic
    entity_id: image_processing.recon_attic
  - delay: 00:00:01
  - event: image_processing.detect_face
    event_data:
      entity_id: image_processing.recon_attic
  - delay: 00:00:01
  - choose:
    - conditions:
      - condition: template
        value_template: '{{ ''Rob'' in state_attr(''image_processing.recon_attic'',
          ''matched_faces'') }} '
      sequence:
      - service: notify.mobile_app_droopy
        data:
          message: Testmessage
          title: Rob
      - service: tts.reversotts_say
        data:
          entity_id: media_player.slaapkamer
          message: Rob, this is a testmessage
    default: []
  mode: single

Since recently you can also use the shorthand notation to replace this:

- conditions:
      - condition: template
        value_template: '{{ ''Rob'' in state_attr(''image_processing.recon_attic'',
          ''matched_faces'') }} '

With this:

- conditions: "{{ 'Rob' in state_attr('image_processing.recon_attic', 'matched_faces') }} "