I am trying to determine what the user is searching for. I have tried the items below.
{#% set q = (
(intent_input if intent_input is defined else '') ~ ' ' ~
(input.text if input is defined and input.text is defined else '') ~ ' ' ~
(trigger.text if trigger is defined and trigger.text is defined else '') ~ ' ' ~
(query if query is defined else '') ~ ' ' ~
(message if message is defined else '')
) | lower %#}
{#% set q = (trigger.slots.text
if trigger is defined
and trigger.slots is defined
and trigger.slots.text is defined else '') | lower %#}
{% set q = (
intent_input
| default(trigger.slots.text | default(trigger.text | default('')))
) | lower %}
My branching instructions
{# ############################################### #}
{# #### Air quality CO2 #### #}
{# ############################################### #}
{% if 'co2' in q or 'carbon' in q %}
CO2 / AIR QUALITY CONTEXT:
{{ states('sensor.llm_co2_context') }}
{% endif %}
{# ############################################### #}
{# #### Temperature #### #}
{# ############################################### #}
{% if 'temp' in q or 'temperature' in q or 'rain' in q %}
TEMPERATURE CONTEXT:
{{ states('sensor.llm_temp_context') }}
{% endif %}
{# ############################################### #}
{# #### Internet #### #}
{# ############################################### #}
{% if 'internet' in q and 'speed' in q %}
NETWORK CONTEXT:
{{ states('sensor.llm_network_context') }}
{% endif %}
{# ############################################### #}
Sample Run
init_options:
start_stage: intent
end_stage: intent
input:
text: what is the co2 level
pipeline: 01jvfc2ewj8d4m3n9p1gep5eja
conversation_id: null
stage: done
run:
pipeline: 01jvfc2ewj8d4m3n9p1gep5eja
language: en
conversation_id: 01KQZRBPP6RZKN7VM105GN4Z36
runner_data:
stt_binary_handler_id: null
timeout: 300
events:
- type: run-start
data:
pipeline: 01jvfc2ewj8d4m3n9p1gep5eja
language: en
conversation_id: 01KQZRBPP6RZKN7VM105GN4Z36
runner_data:
stt_binary_handler_id: null
timeout: 300
timestamp: "2026-05-06T23:00:55.623205+00:00"
- type: intent-start
data:
engine: conversation.llama3_1_8b
language: en
intent_input: what is the co2 level
conversation_id: 01KQZRBPP6RZKN7VM105GN4Z36
device_id: null
satellite_id: null
prefer_local_intents: true
timestamp: "2026-05-06T23:00:55.623289+00:00"
- type: intent-progress
data:
chat_log_delta:
role: assistant
content: Bed
timestamp: "2026-05-06T23:00:59.852092+00:00"
- type: intent-progress
data:
chat_log_delta:
content: room
timestamp: "2026-05-06T23:01:00.007217+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " CO"
timestamp: "2026-05-06T23:01:00.165368+00:00"
- type: intent-progress
data:
chat_log_delta:
content: "2"
timestamp: "2026-05-06T23:01:00.320834+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " is"
timestamp: "2026-05-06T23:01:00.475314+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " "
timestamp: "2026-05-06T23:01:00.630505+00:00"
- type: intent-progress
data:
chat_log_delta:
content: "666"
timestamp: "2026-05-06T23:01:00.789138+00:00"
- type: intent-progress
data:
chat_log_delta:
content: "6"
timestamp: "2026-05-06T23:01:00.945280+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " ppm"
timestamp: "2026-05-06T23:01:01.100358+00:00"
- type: intent-progress
data:
chat_log_delta:
content: ","
timestamp: "2026-05-06T23:01:01.258797+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " Kitchen"
timestamp: "2026-05-06T23:01:01.413887+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " CO"
timestamp: "2026-05-06T23:01:01.572286+00:00"
- type: intent-progress
data:
chat_log_delta:
content: "2"
timestamp: "2026-05-06T23:01:01.727171+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " is"
timestamp: "2026-05-06T23:01:01.882417+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " "
timestamp: "2026-05-06T23:01:02.037459+00:00"
- type: intent-progress
data:
chat_log_delta:
content: "188"
timestamp: "2026-05-06T23:01:02.193046+00:00"
- type: intent-progress
data:
chat_log_delta:
content: "8"
timestamp: "2026-05-06T23:01:02.347710+00:00"
- type: intent-progress
data:
chat_log_delta:
content: " ppm"
timestamp: "2026-05-06T23:01:02.503053+00:00"
- type: intent-progress
data:
chat_log_delta:
content: .
timestamp: "2026-05-06T23:01:02.658088+00:00"
- type: intent-progress
data:
chat_log_delta:
content: ""
timestamp: "2026-05-06T23:01:02.813293+00:00"
- type: intent-end
data:
processed_locally: false
intent_output:
response:
speech:
plain:
speech: Bedroom CO2 is 6666 ppm, Kitchen CO2 is 1888 ppm.
extra_data: null
card: {}
language: en
response_type: action_done
data:
success: []
failed: []
conversation_id: 01KQZRBPP6RZKN7VM105GN4Z36
continue_conversation: false
timestamp: "2026-05-06T23:01:02.813763+00:00"
- type: run-end
data: null
timestamp: "2026-05-06T23:01:02.813791+00:00"
started: 2026-05-06T23:00:55.623Z
intent:
engine: conversation.llama3_1_8b
language: en
intent_input: what is the co2 level
conversation_id: 01KQZRBPP6RZKN7VM105GN4Z36
device_id: null
satellite_id: null
prefer_local_intents: true
done: true
processed_locally: false
intent_output:
response:
speech:
plain:
speech: Bedroom CO2 is 6666 ppm, Kitchen CO2 is 1888 ppm.
extra_data: null
card: {}
language: en
response_type: action_done
data:
success: []
failed: []
conversation_id: 01KQZRBPP6RZKN7VM105GN4Z36
continue_conversation: false
finished: 2026-05-06T23:01:02.813Z