Can’t Update Helper With OpenAI Conversation Response Variable — Full Troubleshooting and Steps
Goal
I want to automatically update an input_text
helper with a one-sentence weather summary generated by the OpenAI Conversation integration (using openai_conversation.generate_content
).
Intended flow:
- Script calls OpenAI to generate a weather summary, stores it in a response variable.
- Script writes that result to an
input_text
helper (so it’s displayable on my dashboard). - (For debugging) Script can optionally send the result in a notification.
What Works
- Directly setting the
input_text
helper with a static string (e.g.,"test"
) works instantly and reliably. - Setting the helper with a simple template (e.g.,
{{ now() }}
) also works—proves templating and helper updating are fine in general. - Sending the OpenAI response variable as a notification (e.g., via
persistent_notification.create
) works and the response is displayed as expected. This proves the variable does contain the correct data.
What Doesn’t Work
-
When I try to set the
input_text
helper’s value with the OpenAI response variable (e.g.,{{ ai_weather.text }}
), it never updates.- No errors.
- No update on the helper.
- The notification step (with the same value) works and displays the correct response.
- Defining a
variables:
block after the OpenAI call and then setting the helper with that variable also fails.
Step-by-Step Details & Scripts
System:
- Home Assistant Core:
2025.6.0
(Container install) - OpenAI Conversation integration (official, up-to-date)
- All helpers/scripts created via UI and YAML
Entities:
input_text.ai_weather_summary
(helper)- Script(s) as shown below
1. Static Value Test — Works
sequence:
- service: input_text.set_value
data:
entity_id: input_text.ai_weather_summary
value: "Direct static test"
mode: single
Result: Helper updates instantly.
2. Template Value Test — Works
sequence:
- service: input_text.set_value
data:
entity_id: input_text.ai_weather_summary
value: "{{ now() }}"
mode: single
Result: Helper updates instantly with the current timestamp.
3. OpenAI Response to Notification — Works
sequence:
- service: openai_conversation.generate_content
data:
config_entry: <REDACTED>
prompt: Summarise the current weather in Sydney in a friendly and casual one-sentence message.
response_variable: ai_weather
- service: persistent_notification.create
data:
title: "AI Weather Response"
message: "{{ ai_weather.text if ai_weather is defined else 'No response from AI.' }}"
mode: single
Result: Notification pops up with a perfectly formatted AI response (e.g., “Hey there! Sydney’s feeling pretty nice today with plenty of sunshine and a lovely breeze—perfect for a stroll outside!”).
4. OpenAI Response to Helper — Does NOT Work
sequence:
- service: openai_conversation.generate_content
data:
config_entry: <REDACTED>
prompt: Summarise the current weather in Sydney in a friendly and casual one-sentence message.
response_variable: ai_weather
- service: input_text.set_value
data:
entity_id: input_text.ai_weather_summary
value: "{{ ai_weather.text if ai_weather is defined else 'No response from AI.' }}"
mode: single
Result: No update. Helper value remains unchanged. No error.
5. Variable Block Test — Also Does NOT Work
sequence:
- service: openai_conversation.generate_content
data:
config_entry: <REDACTED>
prompt: Summarise the current weather in Sydney in a friendly and casual one-sentence message.
response_variable: ai_weather
- variables:
weather_text: "{{ ai_weather.text if ai_weather is defined else 'No response from AI.' }}"
- service: input_text.set_value
data:
entity_id: input_text.ai_weather_summary
value: "{{ weather_text }}"
mode: single
Result: Same as above: Helper is not updated.
6. Both Notification and Helper (in Same Script) — Notification Works, Helper Does NOT
sequence:
- service: openai_conversation.generate_content
data:
config_entry: <REDACTED>
prompt: Summarise the current weather in Sydney in a friendly and casual one-sentence message.
response_variable: ai_weather
- service: persistent_notification.create
data:
title: "AI Weather Only Text"
message: "{{ ai_weather.text if ai_weather is defined else 'No response from AI.' }}"
- service: input_text.set_value
data:
entity_id: input_text.ai_weather_summary
value: "{{ ai_weather.text if ai_weather is defined else 'No response from AI.' }}"
mode: single
Result: Notification works perfectly (displays the weather summary text). Helper does not update, stays unchanged.
What I’ve Already Checked
- Tried both the Home Assistant UI and raw YAML mode.
- Confirmed the helper is editable and not read-only.
- Changing the helper’s value manually or via simple scripts always works instantly.
- All other Home Assistant services and helpers are working as expected.
- No relevant errors in logs.
- OpenAI response is always present and readable (as proven by notifications).
Screenshots
(Available on request, but I have screenshots for every stage if needed.)
Summary
- openai_conversation.generate_content response variable is available for notifications and template evaluation in the same script, but NOT for setting a value in
input_text.set_value
. - Direct values and regular templates work for updating the helper.
- This looks like either a bug or an architectural limitation in how Home Assistant handles service response variables when passing them to helpers.
Questions
- Is this a known limitation with script variables and the
input_text.set_value
service? - Is there any known workaround (other than external scripts, Node-RED, or API calls)?
- Is this a bug that should be reported to GitHub, or is this expected behaviour due to Home Assistant’s script variable scoping/lifetime?
- Has anyone managed to update a helper directly from an OpenAI (or other) service response variable?
Thanks for any ideas, and happy to provide more info or run tests if needed!