I find that error catching in HASS is challenging to say the least but it seems to be even worse with AI task type automations… Can someone help me implement something that works for trapping errors with AI generative task?
I have a simple example AI type task automation for which I’m trying to implement error catching, because it throws errors and falls flat on its face more often than I’d like with (Gemini not to name it).
action: ai_task.generate_data
metadata: {}
data:
task_name: Fireplace Status
instructions: >-
Analyze the fireplace in this image of the living room and determine its
condition. Classify it strictly as one of flames, embers, cold or unknown.
structure:
condition:
selector:
select:
options:
- flames
- embers
- cold
- unknown
attachments:
media_content_id: media-source://camera/camera.tapo_xxxxxxxxxxxx
media_content_type: image/jpeg
entity_id: ai_task.google_ai_task
continue_on_error: true
response_variable: response << Crashes here...
Even though I have “continue_on_error: true”, the automation still belly flops when there’s an error due to the Gemini service not being available either from exceeding usage limits (…or God only knows reason)… not because it doesn’t continue but because it can’t continue since “response_variable” remains “undefined”, which causes the automation to crash anyway when I try to access it…