📦 AI Automation Suggester — v1.3.3
2025‑05‑03
✨ New & Improved
Area Change
Config / Options True options flow support — the integration now reads its settings first from Options, then from initial Data (via the new _opt() helper). This means you can edit an existing entry (max‑tokens, model, etc.) without deleting & recreating it. Fixes #90.
Token control Added separate budgets for prompt and completion:
max_input_tokens & max_output_tokens (both exposed in the Options dialog). If you don’t set them, the old max_tokens value is used automatically.
Robustness • Registries are guaranteed to be loaded before first refresh, eliminating the 'NoneType' object has no attribute 'update' crash. Fixes #83, #87.
• Uniform error handling across providers — any API error is surfaced via last_error (sensor attribute & logs).
• Unknown provider selection now logs a clear error instead of crashing.
Ollama / Perplexity Provider handlers cleaned up & aligned with the new budget logic (Perplexity handler finalised; addresses #94).
Sensor attributes The Suggestions sensor now exposes:
description, yaml_block, and last_error for easier automations & dashboards.
Code Health Large internal refactor of coordinator.py:
‑ common helpers (_budgets, _opt),
‑ tighter prompts,
‑ consistent API payloads/headers,
‑ extensive linting.
🐛 Bug‑fixes
Fixed options not persisting after modifying an existing entry (#90).
Fixed coordinator crash when entity/device/area registries were still None (#83, #87).
Fixed Perplexity provider import / key errors (#94).
Fixed sensors occasionally showing stale “Suggestions Available” after new content.
Several minor syntax / indentation issues caught during live testing.
🔧 Upgrade Notes
Update the custom component (HACS → Reload or manual copy).
Restart Home Assistant.
(Optional but recommended) Go to Settings → Devices & Services → AI Automation Suggester → Configure → Options to review the new Input/Output token fields. Leave blank to keep previous behaviour.
No breaking changes; existing configurations migrate automatically.