I’m certain this is going to be a simple fix and just comes down to my inability to wrap my head around YAML multiline rules, despite trawling all the documentation I can find on Jinja2.
Here is a valid call I’m making to LLM Vision with a successful response:
action: llmvision.data_analyzer
data:
provider: *****
message: >-
Summarize what's happening in the camera feed (one sentence max). Don't
describe the scene! If there is a person, describe what they're doing and
what they look like. If they look like a courier mention that! If nothing is
happening, say so, along with the name of the camera from the corner of the
feed.
sensor_entity: input_text.ai_result
image_entity:
- camera.front_door_frame
max_tokens: 20
temperature: 0.1
include_filename: false
target_width: 1280
detail: low
I’m trying to dynamically change what is sent in the image_entity field based on a trigger inside the automation which makes this call. The wall I’m hitting is the YAML syntax (the if logic itself has been tested separately and is valid)
image_entity:
{% if trigger.to_state.attributes.friendly_name == 'Front Door' %}
- camera.front_door_frame
{% endif %}
Result: Incorrect syntax (obv)
image_entity: >
{% if trigger.to_state.attributes.friendly_name == 'Front Door' %}
- camera.front_door_frame
{% endif %}
Result: Failed to perform the action llmvision.data_analyzer. Entity - does not exist.
Just gave up trying to understand multiline syntax and went all out:
image_entity: >
image_entity: >+
image_entity: >-
image_entity: |
image_entity: |+
image_entity: |-
All with the same result.
Help me Obi Wan Kenobi…