[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-ITSpecialist111--ai_automation_suggester":3,"tool-ITSpecialist111--ai_automation_suggester":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",160015,2,"2026-04-18T11:30:52",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",109154,"2026-04-18T11:18:24",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":67,"readme_en":68,"readme_zh":69,"quickstart_zh":70,"use_case_zh":71,"hero_image_url":72,"owner_login":73,"owner_name":74,"owner_avatar_url":75,"owner_bio":76,"owner_company":77,"owner_location":77,"owner_email":77,"owner_twitter":77,"owner_website":77,"owner_url":78,"languages":79,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":32,"env_os":92,"env_gpu":92,"env_ram":92,"env_deps":93,"category_tags":97,"github_topics":98,"view_count":32,"oss_zip_url":77,"oss_zip_packed_at":77,"status":17,"created_at":105,"updated_at":106,"faqs":107,"releases":142},9060,"ITSpecialist111\u002Fai_automation_suggester","ai_automation_suggester","This custom Home Assistant integration automatically scans your entities, detects new devices, and uses AI (via cloud and local APIs) to suggest tailored automations. It supports multiple AI providers, including OpenAI, Anthropic, Google, Groq, Ollama and more! The integration provides automation suggestions via HASS notifications","ai_automation_suggester 是一款专为 Home Assistant 设计的智能集成工具，旨在利用大语言模型（LLM）帮助用户轻松构建智能家居自动化。它能自动扫描家中的设备、实体区域及现有自动化规则，结合云端或本地 AI 服务（支持 OpenAI、Anthropic、Ollama 等多种提供商），为用户量身定制可立即使用的 YAML 代码建议。\n\n随着智能家居设备增多，用户常面临“不知如何联动”、“编写代码困难”或“设备利用率低”等痛点。ai_automation_suggester 恰好解决了这些问题：它像一位私人顾问，分析家庭状态后识别节能、安防或舒适度方面的提升机会，并直接生成具体的自动化脚本，让用户只需复制粘贴即可实现复杂功能。\n\n该工具非常适合希望深化智能家居体验但缺乏编程背景的普通用户，同时也能为开发者提供灵感参考。其独特亮点在于支持本地化 AI 部署以保障隐私，且能理解现有的自动化逻辑以避免冲突。通过将复杂的配置过程转化为简单的自然语言交互，ai_automation_suggester 让打造高效、舒适的智慧生活变得触手可及。","\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fwww.buymeacoffee.com\u002FITSpecialist\" target=\"_blank\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBuy&nbsp;me&nbsp;a&nbsp;coffee-Support&nbsp;Dev-yellow?style=for-the-badge&logo=buy-me-a-coffee\" alt=\"Buy Me A Coffee\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n# AI Automation Suggester\n\n[![Validate with hassfest](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FITSpecialist111\u002Fai_automation_suggester\u002Fhassfest.yaml?style=for-the-badge)]()\n[![HACS Validation](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FITSpecialist111\u002Fai_automation_suggester\u002Fvalidate.yaml?style=for-the-badge)]()\n[![GitHub release (latest by date)](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FITSpecialist111\u002Fai_automation_suggester?style=for-the-badge)]()\n[![hacs_badge](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHACS-Custom-41BDF5.svg?style=for-the-badge)]()\n\nAn **AI‑powered assistant** for Home Assistant that leverages large language models to understand your unique smart home environment – your entities, areas, devices, **and** existing automations. It proposes intelligent, actionable YAML suggestions tailored to your specific setup, helping you unlock your home's full potential.\n\n---\n\n## ✨ Why does this exist? (Purpose and Problem Statement)\n\nAs your Home Assistant setup grows, managing its complexity and identifying new opportunities for automation can become challenging. You might find yourself with:\n\n* **Too many possibilities:** Every new device adds countless potential interactions.\n* **Automation \"Writer's Block\":** Translating a complex idea into functional YAML can be daunting.\n* **Underutilized Potential:** Many devices sit idle or require manual control because the right automation hasn't been thought of or created.\n* **Maintenance Overload:** Keeping existing automations relevant as your home evolves is difficult.\n\nThe result is often an **under-automated house** despite having powerful hardware.\n\n### The Fix – Your Personal Automation Copilot\n\nThe AI Automation Suggester integration solves these challenges by acting as a personal automation consultant. It intelligently analyzes your Home Assistant instance to:\n\n1.  **Analyze your home's state:** Understand your devices, their capabilities, locations, and existing automations.\n2.  **Identify opportunities:** Spot gaps, synergies, and potential improvements for energy saving, security, comfort, and convenience.\n3.  **Draft ready-to-paste YAML:** Provide concrete, tailored automation ideas as YAML snippets you can review, tweak, and implement directly.\n\n**In essence,** this integration turns the complexity of a large Home Assistant environment into actionable insights and tangible benefits, guiding you toward a more efficient, comfortable, and secure smart home.\n\n---\n\n## 🚀 How It Works (The Solution)\n\nThe integration follows a simple, effective process:\n\n| Step | What happens? | Details |\n|------|---------------|---------|\n| **1&nbsp;· Snapshot** | Collects data about your home. | On manual trigger or schedule, the integration gathers information on your entities (including attributes), devices, areas, **and** existing automations. You can control the scope using filters and limits. |\n| **2&nbsp;· Prompt Building** | Structures the data for the AI. | This snapshot is embedded into a detailed system prompt describing your specific Home Assistant setup. You can enhance this with a *custom prompt* to steer suggestions towards specific goals (e.g., \"focus on presence lighting\"). |\n| **3&nbsp;· Provider Call** | Sends the prompt to the AI. | The crafted prompt is sent to your configured AI provider (OpenAI, Anthropic, Google, Groq, LocalAI, Ollama, Mistral, Perplexity). |\n| **4&nbsp;· Parsing** | Processes the AI's response. | The raw response from the AI is parsed to extract key information: a human-readable `description` of the suggestion, the actual `yaml_block` code, and potentially other details. This information is stored on sensor attributes. |\n| **5&nbsp;· Surface** | Delivers the suggestions. | Suggestions appear as Home Assistant persistent notifications. You can also use sensor attributes to display suggestions on custom dashboards for easy review and implementation. |\n\nRandomized entity selection (configurable) helps ensure each analysis run can surface fresh ideas rather than repeating the same suggestions.\n\n---\n\n## 📸 What to Expect (Screenshots)\n\nSuggestions are delivered directly within Home Assistant notifications:\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FITSpecialist111_ai_automation_suggester_readme_09452afe5f99.png\" alt=\"Notification example\" width=\"700\"\u002F>\n  \u003Cbr>\u003Cem>AI suggestions delivered right inside Home&nbsp;Assistant\u003C\u002Fem>\n\u003C\u002Fp>\n\nYou can also build custom dashboard cards to display suggestions using sensor attributes:\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FITSpecialist111_ai_automation_suggester_readme_406789a2df9b.png\" alt=\"Dashboard card example\" width=\"700\"\u002F>\n  \u003Cbr>\u003Cem>Dashboard showing human-readable description and extracted YAML block\u003C\u002Fem>\n\u003C\u002Fp>\n\nHere's an example of displaying suggestions on a dashboard:\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FITSpecialist111_ai_automation_suggester_readme_6e7a445869a6.png\" alt=\"Example Dashboard Implementation\" width=\"700\"\u002F>\n  \u003Cbr>\u003Cem>Example of a dashboard displaying AI-suggested automations\u003C\u002Fem>\n\u003C\u002Fp>\n\n---\n\n## 🏆 Benefits\n\nLeveraging the AI Automation Suggester provides several key benefits:\n\n* **Time Saving:** Reduces the effort and guesswork involved in designing complex automations.\n* **Context-Aware Suggestions:** Ideas consider your specific devices, areas, and current setup for realistic, tailored recommendations.\n* **Model-Agnostic Flexibility:** Supports cloud and local AI models, letting you choose based on cost, privacy, and performance preferences.\n* **Improved Usability:** Makes automation creation more accessible, even for users less familiar with YAML.\n* **Dynamic Inspiration:** Provides fresh ideas as your home and devices change, keeping your automations evolving.\n* **Enhanced Control:** Custom prompts, entity limits, and domain filters give you command over the suggestion generation process.\n* **Safe to Try:** Suggestions are presented for review; nothing is automatically implemented without your explicit action.\n\n---\n\n## 📦 Features\n\n* **Multi-Provider Support:** Connect to OpenAI, OpenAI Azure, Anthropic, Google, Groq, LocalAI, Ollama, Mistral, Perplexity, or OpenRouter with full configuration options:\n    * Temperature control for all providers (0.0 - 2.0)\n    * Model selection with provider-specific defaults\n    * Secure API key storage\n    * Custom endpoints for compatible providers\n    * Advanced options like Ollama's think mode control\n* **Customizable Prompts and Filters:** Tailor suggestions using system prompts, domain filters, and entity limits.\n* **Randomized Entity Selection:** Prevent repetitive suggestions and discover new opportunities.\n* **Context-Rich Insights:** Incorporates device and area information for smarter, more relevant ideas.\n* **Persistent Notifications:** Receive suggestions directly in your Home Assistant interface.\n* **Service Call Integration:** Manually trigger suggestions via the `ai_automation_suggester.generate_suggestions` service with full parameter control.\n* **Diagnostics Sensors:** Monitor suggestion status and provider connection health.\n* **Example Automations:** Includes built-in examples for new entity detection and weekly reviews. - This is found in the code base\n* **Dashboard-Friendly Output:** Sensor attributes provide description and YAML blocks ready for Lovelace cards.\n\n---\n\n## 🛠️ Prerequisites\n\n* **Home Assistant:** Version 2023.5 or later.\n* **AI Provider Setup:** You will need access to an AI model.\n    * For cloud providers (OpenAI, Anthropic, Google, Groq, Mistral, Perplexity), you’ll need API keys.\n    * For local models (LocalAI, Ollama), ensure the local servers are running and accessible from Home Assistant.\n\n---\n\n## ⬇️ Installation\n\n### HACS (Recommended)\n\n1.  **Install HACS** if you haven't already.\n2.  In HACS → **Integrations**, click the `+` button.\n3.  Search for `AI Automation Suggester`.\n4.  Select the integration and click **Download**.\n5.  **Restart Home Assistant**.\n6.  Go to Settings → Devices & Services → **+ Add Integration** and search for `AI Automation Suggester`.\n\n### Manual Installation\n\n1.  **Download** the contents of this repository.\n2.  **Copy** the `custom_components\u002Fai_automation_suggester` folder to your Home Assistant `custom_components` directory.\n    ```bash\n    \u003Chomeassistant_config_dir>\u002F\n    └── custom_components\u002F\n        └── ai_automation_suggester\u002F\n            ├── __init__.py\n            └── ... (other files)\n    ```\n3.  **Restart Home Assistant**.\n4.  Go to Settings → Devices & Services → **+ Add Integration** and search for `AI Automation Suggester`.\n\n---\n\n## ⚙️ Configuration\n\n1.  Add the integration via the Home Assistant UI: Settings → Devices & Services → **+ Add Integration** → `AI Automation Suggester`.\n2.  Follow the setup wizard:\n    * **Select your AI Provider:** Choose from the dropdown list.\n    * **Enter API Keys or Endpoint:** Provide the necessary credentials or local server URL based on your provider choice.\n    * **Select Model:** Choose the specific model variant you wish to use.\n    * **Set Max Tokens:** Define the maximum length for the AI's response (influences the length of suggestions).\n    * **(Optional) Custom System Prompt:** Provide an initial prompt to guide the AI's overall perspective (e.g., \"You are an expert in energy-saving automations for smart homes.\").\n\nYou can adjust these settings later via the integration options in Settings → Devices & Services.\n\n---\n\n## 🛠️ Advanced Configuration\n\n### Global Settings\n\n* **Temperature Control:**\n    * Available for all providers\n    * Range: 0.0 (more focused) to 2.0 (more creative)\n    * Default: 0.7\n    * Configurable in both initial setup and options\n\n* **Token Management:**\n    * Separate input\u002Foutput token limits\n    * Prevents excessive API usage\n    * Optimizes response length\n\n---\n\n## ✍️ Usage\n\n### Automatic Suggestions\n\nThe integration comes with example automations you can enable or adapt:\n\n* **On New Entities:** Automatically generates suggestions when new entities are added to Home Assistant, helping you quickly integrate them.\n* **Weekly Reviews:** Triggers a comprehensive analysis weekly (or at a custom interval you define in the automation), providing ongoing ideas.\n\nFind and enable these examples in Settings → Automations.\n\n### Manual Trigger\n\nYou can trigger the suggestion generation manually using the service call:\n\n1.  Go to Developer Tools → **Services**.\n2.  Select the service `ai_automation_suggester.generate_suggestions`.\n3.  Call the service. You can pass parameters to customize the request:\n    * `all_entities` (boolean, default: `false`): Set to `true` to consider all eligible entities, `false` to only consider entities added since the last successful run.\n    * `domains` (list of strings, optional): Limit the analysis to entities within specific domains (e.g., `['light', 'sensor']`).\n    * `entity_limit` (integer, optional): Set a maximum number of entities the AI should consider in this run. Useful for controlling prompt length and cost.\n    * `custom_prompt` (string, optional): Add a specific instruction for this particular run (e.g., \"Suggest security automations for doors and windows.\").\n\n### Dashboard Snippets\n\nThe main sensor (`sensor.ai_automation_suggestions_\u003Cprovider_name>`) exposes useful attributes for display on dashboards. Replace `\u003Cprovider_name>` with the name you gave the integration instance (e.g., `openai`, `ollama`).\n\n* **Displaying the Description:**\n    ```jinja\n    {{ state_attr('sensor.ai_automation_suggestions_\u003Cprovider_name>', 'description') }}\n    ```\n* **Displaying the YAML Block:**\n    ```jinja\n    {{ state_attr('sensor.ai_automation_suggestions_\u003Cprovider_name>', 'yaml_block') }}\n    ```\nYou can use Markdown cards or other card types to present this information cleanly in your Home Assistant dashboard.\n\n---\n\n## 📊 Monitoring & Diagnostics\n\nThe integration provides several sensors for monitoring:\n\n* **AI Automation Suggestions:** (`sensor.ai_automation_suggestions_\u003Cprovider_name>`)\n    * State: `No Suggestions`, `New Suggestions Available`, `Suggestions Available`\n    * Attributes:\n        * `description`: Human-readable suggestion description\n        * `yaml_block`: Ready-to-use automation YAML\n        * `last_update`: Timestamp of last update\n        * `entities_processed`: List of analyzed entities\n        * `entities_processed_count`: Number of entities analyzed\n\n* **AI Provider Status:** (`sensor.ai_provider_status_\u003Cprovider_name>`)\n    * State: `connected`, `error`, `disconnected`, `initializing`\n    * Attributes:\n        * `last_error_message`: Details of any errors\n        * `last_attempted_update`: Timestamp of last attempt\n\n* **Max Input\u002FOutput Tokens:** (`sensor.max_input_tokens_\u003Cprovider_name>`, `sensor.max_output_tokens_\u003Cprovider_name>`)\n    * Shows configured token limits\n    * Helps monitor API usage\n\n* **AI Model:** (`sensor.ai_model_in_use_\u003Cprovider_name>`)\n    * Shows current model configuration\n    * Useful for multi-instance setups\n\n* **Last Error:** (`sensor.last_error_message_\u003Cprovider_name>`)\n    * Detailed error tracking\n    * Includes stack traces for unexpected errors\n\n---\n\n## 🔍 Error Handling & Troubleshooting\n\n* **Stack Traces:**\n    * Detailed error logging for unexpected issues\n    * Available in Home Assistant logs\n    * Helpful for debugging API issues\n\n* **Common Error Scenarios:**\n    * API authentication failures\n    * Network connectivity issues\n    * Token limit exceeded\n    * Model availability problems\n    * Response parsing errors\n\n* **Error Monitoring:**\n    * Use the Last Error sensor for real-time error tracking\n    * Check Home Assistant logs for stack traces\n    * Monitor provider status sensor for connection issues\n\n---\n\n## 🔒 Security Notes\n\n* All API keys are stored securely using Home Assistant's secure storage\n* Password fields are properly masked in the UI\n* Local providers (Ollama, LocalAI) can be used for complete data privacy\n\n---\n\n## Customization and Advanced Usage\n\nBeyond the basic configuration and service call parameters, you can further customize the integration's behavior:\n\n### Random Entity Selection\n\nBy default, the integration uses randomized entity selection when `all_entities` is `true` (or the automatic weekly scan runs). This helps ensure variety in suggestions and prevents the AI from focusing only on the same initial set of entities.\n\n### Domain Filtering\n\nUse the `domains` parameter in the service call or your automation configuration to narrow the focus. This is very effective for getting suggestions for specific areas (e.g., only analyze `light` and `switch` entities in the `living_room` area - though area filtering is implicit based on the entities selected).\n\n### Entity Limit\n\nThe `entity_limit` parameter is crucial for managing prompt size, particularly with models sensitive to input length or cost. Experiment to find a limit that provides good suggestions without hitting token limits or incurring excessive costs.\n\n### Custom Prompts\n\nThe `custom_prompt` parameter allows you to be very specific about the type of suggestions you want for a particular run. Combine it with domain filtering for highly targeted results (e.g., `domains: ['climate'], custom_prompt: \"Suggest automations to optimize heating\u002Fcooling based on occupancy and weather.\"`).\n\n---\n\n## Implementing Automations\n\n1.  **Review Suggestions:** Check the persistent notifications or your dashboard card for new suggestions.\n2.  **Copy YAML:** The suggestions are provided as ready-to-use Home Assistant YAML snippets. Copy the `yaml_block` content.\n3.  **Add to Home Assistant:**\n    * Paste the YAML into your `automations.yaml` file and restart Home Assistant.\n    * Alternatively, use the Home Assistant Automation Editor UI: create a new automation, switch to YAML mode, and paste the snippet.\n4.  **Adapt as Needed:** While the suggestions are tailored, you may need to make minor adjustments to triggers, conditions, delays, or actions to perfectly match your preferences and devices.\n5.  **Test:** Always test new automations to ensure they function as expected before relying on them.\n\n---\n\n## Sensors\n\nThe integration provides two key sensors for monitoring:\n\n* **AI Automation Suggestions Sensor:** `sensor.ai_automation_suggestions_\u003Cprovider_name>`\n    * State indicates the status (e.g., `idle`, `generating`, `suggestions_available`).\n    * Attributes contain the latest suggestions, including `description`, `yaml_block`, and potentially other details depending on the AI provider's response format.\n* **AI Provider Status Sensor:** `sensor.ai_provider_status_\u003Cprovider_name>`\n    * State indicates the connection health (e.g., `connected`, `error`, `unavailable`).\n    * Attributes may provide additional details about the provider status or any errors encountered.\n\nMonitor these sensors to ensure the integration is functioning correctly.\n\n---\n\n## ⚠️ Important Notes\n\n* **Privacy Considerations:** If using cloud-based AI providers, be aware that entity data (names, states, attributes) is sent to their servers. Consider using local AI models (LocalAI, Ollama) for full data control if privacy is a major concern.\n* **API Costs:** Some cloud providers charge for API usage based on tokens processed. Be mindful of this and use features like `entity_limit` and scheduled run frequency to manage potential costs. Monitor your provider's billing.\n* **No Guarantees:** The AI's suggestions are based on patterns and logical inference from the data provided. They are not guaranteed to be perfect or the most efficient solution for every scenario. **Always review suggestions thoroughly before implementing them in your live system.**\n* **AI Limitations:** Large language models can sometimes hallucinate or provide illogical suggestions. Use your judgment and knowledge of your home setup when reviewing.\n* **Home Assistant dependency safety:** This integration uses plain HTTP calls and does not need the Python `openai` package. Avoid installing or pinning `openai` in your HA environment, as mismatched SDK versions can break the official OpenAI Conversation integration.\n\n---\n\n## 🧩 Troubleshooting\n\n| Symptom                                 | Check \u002F Action                                                                                                                               |\n|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| **No suggestions available** | - Verify API key is correct.\u003Cbr>- Check the `AI Provider Status` sensor for errors.\u003Cbr>- Check the Home Assistant logs for errors related to the integration.\u003Cbr>- Try triggering the service manually with a small `entity_limit` and no domain filters.\u003Cbr>- Ensure you have enough entities\u002Fdevices for meaningful suggestions. |\n| **AI Provider Status shows `error`** | - Inspect the Home Assistant log (`home-assistant.log`) for detailed error messages (look for `ai_automation_suggester` and `processing error`).\u003Cbr>- Check your network connection to the provider's server (if cloud-based) or your local server.\u003Cbr>- Confirm your API key is active and has permissions.\u003Cbr>- Ensure your local AI server is running and accessible. |\n| **Suggestion prompt is too long** | - Reduce the `entity_limit` parameter when triggering the service or configuring the automation.\u003Cbr>- Use the `domains` filter to narrow the scope of entities analyzed.\u003Cbr>- Shorten or simplify your `custom_prompt` if you are using one. |\n| **Unintended startup suggestions** | - Review your Home Assistant automations and scripts to ensure none are configured to call `ai_automation_suggester.generate_suggestions` on startup or via events you didn't intend. |\n| **Suggestions are repetitive** | - Ensure `all_entities` is used (e.g., in a weekly automation) and consider enabling randomized entity selection.\u003Cbr>- Try different `custom_prompt` values to steer the AI in a new direction.\u003Cbr>- Increase the `entity_limit` to give the AI more data points (if prompt length allows). |\n| **Image links are broken in HACS\u002FGitHub** | This has been addressed in this README version. Ensure the README file in your repository uses the corrected URLs provided. Clear your browser cache or wait for GitHub\u002FHACS to refresh. |\n\nIf you encounter issues not covered here, please open an issue on the GitHub repository with details from your Home Assistant logs.\n\n---\n\n## Roadmap\n\nFuture planned features and improvements:\n\n* **More Interactive Suggestions:** Explore feedback mechanisms to help the AI learn from user acceptance or rejection of suggestions.\n* **One-Click Automation Creation:** Streamline the process from reviewing a suggestion to creating the automation in Home Assistant.\n* **Expanded Localization:** Support for more languages through community contributions.\n* **Improved Entity\u002FDevice Context:** Enhance the information provided to the AI about device types, capabilities, and relationships.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n---\n\n## Acknowledgments\n\n* **Home Assistant Community:** For providing a robust and extensible smart home platform.\n* **AI Providers:** OpenAI, Anthropic, Google, Groq, LocalAI, Ollama, Mistral, and Perplexity for developing and providing access to powerful language models.\n* **Contributors and Users:** For valuable feedback, testing, and contributions that help improve this project.\n\n---\n\n## Contributions\n\nWe welcome contributions! If you have ideas for new features, improvements, bug fixes, or translations, please feel free to open an issue or submit a pull request on the GitHub repository. Please follow standard development practices.\n\n---\n\n## Disclaimer\n\nThis is a custom component developed independently. It is not affiliated with, endorsed by, or officially supported by Home Assistant, Nabu Casa, or any of the mentioned AI providers. Use at your own discretion.\n\n---\n\n## 🤝 Support the Project\n\nIf you find this integration helpful and it saves you time and effort in automating your home, please consider supporting its development. Your support helps with maintenance, adding new features, and covering any potential costs associated with development and testing.\n\n[\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBuy&nbsp;me&nbsp;a&nbsp;coffee-Support&nbsp;Dev-yellow?style=for-the-badge&logo=buy-me-a-coffee\" alt=\"Buy Me A Coffee\">](https:\u002F\u002Fwww.buymeacoffee.com\u002FITSpecialist)\n\n---\n\n## Additional Information\n\nFor further questions, discussions, or assistance, please visit the GitHub repository or the Home Assistant Community Forums thread (if one exists). Your feedback is highly valuable and helps shape the future direction of this project.\n\n---\n\n## ❓ FAQ\n\n**1. How do I update the integration?**\nIf installed via HACS, update directly through the HACS interface in Home Assistant. If installed manually, download the latest version of the files from the repository and replace the existing ones in your `custom_components\u002Fai_automation_suggester` folder, then restart Home Assistant.\n\n**2. Can I use this integration without a cloud API key?**\nYes! You can use local AI models like those provided by LocalAI or Ollama running on your local network. This requires setting up and running the local AI server separately.\n\n**3. Is my Home Assistant data safe?**\nWhen using cloud-based AI providers, specific entity data (names, states, attributes) is sent to the provider's API for processing. Refer to the privacy policies of your chosen AI provider. Using local models keeps all data processing within your local network.\n\n**4. I found a bug or have a feature request. What should I do?**\nPlease open an issue on the GitHub repository. Provide as much detail as possible, including steps to reproduce the bug, screenshots, and relevant logs. For feature requests, clearly describe the desired functionality and use case.\n\n**5. Can I get suggestions in languages other than English?**\nThe quality of suggestions in other languages depends heavily on the AI model used. The integration structures the prompt in English, but you can experiment with custom prompts in other languages and see how the model responds. Community translations of the integration's UI and documentation are welcome!\n\n---\n\nWith the AI Automation Suggester, you gain an AI-powered ally to help you unlock your home’s full potential. Instead of being overwhelmed by possibilities, receive thoughtful, context-aware suggestions that make your Home Assistant automations more impactful, efficient, and enjoyable.\n","\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fwww.buymeacoffee.com\u002FITSpecialist\" target=\"_blank\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBuy&nbsp;me&nbsp;a&nbsp;coffee-Support&nbsp;Dev-yellow?style=for-the-badge&logo=buy-me-a-coffee\" alt=\"Buy Me A Coffee\">\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n# AI 自动化建议工具\n\n[![使用 hassfest 验证](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FITSpecialist111\u002Fai_automation_suggester\u002Fhassfest.yaml?style=for-the-badge)]()\n[![HACS 验证](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FITSpecialist111\u002Fai_automation_suggester\u002Fvalidate.yaml?style=for-the-badge)]()\n[![GitHub 最新发布](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002FITSpecialist111\u002Fai_automation_suggester?style=for-the-badge)]()\n[![hacs_badge](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHACS-Custom-41BDF5.svg?style=for-the-badge)]()\n\n这是一个基于 **AI 的助手**，专为 Home Assistant 打造。它利用大型语言模型来理解您独特的智能家居环境——包括您的实体、区域、设备以及现有的自动化规则。该工具会根据您的具体配置，提出智能且可操作的 YAML 建议，帮助您充分发挥家居系统的潜力。\n\n---\n\n## ✨ 为什么需要这个工具？（目的与问题陈述）\n\n随着 Home Assistant 配置的不断扩展，管理其复杂性并发现新的自动化机会可能会变得颇具挑战。您可能会遇到以下情况：\n\n* **可能性太多：** 每新增一个设备，都会带来无数潜在的交互方式。\n* **自动化“写作障碍”：** 将复杂的构想转化为可用的 YAML 代码往往令人望而却步。\n* **潜力未被充分利用：** 许多设备长期闲置或需手动控制，因为尚未想到或创建合适的自动化方案。\n* **维护负担过重：** 随着家居环境的变化，保持现有自动化规则的相关性也十分困难。\n\n最终结果往往是，尽管硬件功能强大，但家庭自动化程度仍然较低。\n\n### 解决方案——您的个性化自动化助手\n\nAI 自动化建议工具通过充当您的私人自动化顾问，解决了上述难题。它能够智能地分析您的 Home Assistant 实例，从而：\n\n1.  **分析家居状态：** 了解您的设备、功能、位置以及现有自动化规则。\n2.  **识别机会：** 发现潜在的不足、协同效应以及在节能、安全、舒适和便利方面的改进空间。\n3.  **生成可直接使用的 YAML 代码：** 提供具体的、量身定制的自动化建议，以 YAML 片段的形式呈现，您可以直接查看、调整并实施。\n\n**简而言之，** 这一集成将庞大的 Home Assistant 环境中的复杂性转化为切实可行的洞察与实际收益，引导您打造更加高效、舒适和安全的智能家居。\n\n---\n\n## 🚀 工作原理（解决方案）\n\n该集成遵循一个简单而有效的流程：\n\n| 步骤 | 具体操作 | 详情 |\n|------|----------|------|\n| **1 · 快照** | 收集家居数据。 | 在手动触发或按计划运行时，该集成会收集关于您的实体（包括属性）、设备、区域以及现有自动化规则的信息。您可以通过过滤器和限制来控制数据范围。 |\n| **2 · 构建提示** | 将数据整理成适合 AI 处理的格式。 | 这些数据会被嵌入到一个详细的系统提示中，用于描述您的特定 Home Assistant 设置。您还可以添加 *自定义提示*，以引导建议朝向特定目标（例如：“专注于存在感应照明”）。 |\n| **3 · 调用 AI 服务** | 将提示发送至 AI 服务提供商。 | 构建好的提示会被发送到您配置的 AI 服务提供商处（OpenAI、Anthropic、Google、Groq、LocalAI、Ollama、Mistral、Perplexity 等）。 |\n| **4 · 解析响应** | 处理 AI 返回的结果。 | AI 的原始响应会被解析，提取关键信息：人类可读的建议 `description`、实际的 `yaml_block` 代码，以及其他可能的详细信息。这些信息会被存储在传感器属性中。 |\n| **5 · 展示建议** | 向用户展示建议。 | 建议将以 Home Assistant 的持久化通知形式呈现。您也可以使用传感器属性，在自定义仪表盘上显示建议，方便查看和实施。\n\n随机选择实体的功能（可配置）有助于确保每次分析都能提供新的想法，而不是重复相同的建议。\n\n---\n\n## 📸 使用效果（截图）\n\n建议会直接以 Home Assistant 通知的形式呈现：\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FITSpecialist111_ai_automation_suggester_readme_09452afe5f99.png\" alt=\"通知示例\" width=\"700\"\u002F>\n  \u003Cbr>\u003Cem>AI 建议直接呈现在 Home Assistant 中\u003C\u002Fem>\n\u003C\u002Fp>\n\n您还可以通过传感器属性构建自定义仪表盘卡片来展示建议：\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FITSpecialist111_ai_automation_suggester_readme_406789a2df9b.png\" alt=\"仪表盘卡片示例\" width=\"700\"\u002F>\n  \u003Cbr>\u003Cem>仪表盘显示人类可读的描述和提取出的 YAML 代码块\u003C\u002Fem>\n\u003C\u002Fp>\n\n以下是一个在仪表盘上展示建议的示例：\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FITSpecialist111_ai_automation_suggester_readme_6e7a445869a6.png\" alt=\"仪表盘实现示例\" width=\"700\"\u002F>\n  \u003Cbr>\u003Cem>仪表盘展示 AI 建议的自动化规则示例\u003C\u002Fem>\n\u003C\u002Fp>\n\n---\n\n## 🏆 优势\n\n使用 AI 自动化建议工具具有多项重要优势：\n\n* **节省时间：** 减少设计复杂自动化规则所需的努力和试错过程。\n* **上下文感知的建议：** 建议会考虑您的具体设备、区域和当前设置，从而提供更贴近实际需求的个性化推荐。\n* **模型无关的灵活性：** 支持云端和本地 AI 模型，您可以根据成本、隐私和性能偏好进行选择。\n* **提升易用性：** 即使对 YAML 不太熟悉的用户，也能更轻松地创建自动化规则。\n* **持续激发灵感：** 随着家居环境和设备的变化，工具会不断提供新的创意，让您的自动化始终保持活力。\n* **高度可控：** 通过自定义提示、实体数量限制和域过滤器，您可以完全掌控建议生成的过程。\n* **安全可靠：** 所有建议均需您亲自审核确认后方可实施，不会自动执行任何操作。\n\n---\n\n## 📦 功能\n\n* **多提供商支持：** 可连接 OpenAI、OpenAI Azure、Anthropic、Google、Groq、LocalAI、Ollama、Mistral、Perplexity 或 OpenRouter，并提供完整的配置选项：\n    * 所有提供商的温度控制（0.0 - 2.0）\n    * 模型选择，附带提供商特定的默认设置\n    * 安全的 API 密钥存储\n    * 兼容提供商的自定义端点\n    * 高级选项，如 Ollama 的思考模式控制\n* **可自定义的提示与过滤器：** 使用系统提示、领域过滤器和实体数量限制来定制建议。\n* **随机实体选择：** 防止重复性建议，发现新的可能性。\n* **丰富的上下文信息：** 结合设备和区域信息，生成更智能、更相关的创意。\n* **持久化通知：** 直接在 Home Assistant 界面中接收建议。\n* **服务调用集成：** 通过 `ai_automation_suggester.generate_suggestions` 服务手动触发建议，并完全控制参数。\n* **诊断传感器：** 监控建议状态和提供商连接健康状况。\n* **示例自动化：** 包含用于新实体检测和每周回顾的内置示例。- 这些内容位于代码库中\n* **仪表板友好输出：** 传感器属性提供描述和 YAML 块，可直接用于 Lovelace 卡片。\n\n---\n\n## 🛠️ 前置条件\n\n* **Home Assistant：** 版本 2023.5 或更高。\n* **AI 提供商设置：** 您需要访问一个 AI 模型。\n    * 对于云提供商（OpenAI、Anthropic、Google、Groq、Mistral、Perplexity），您需要 API 密钥。\n    * 对于本地模型（LocalAI、Ollama），请确保本地服务器正在运行，并且可以从 Home Assistant 访问。\n\n---\n\n## ⬇️ 安装\n\n### HACS（推荐）\n\n1. 如果您尚未安装 HACS，请先安装。\n2. 在 HACS → **集成** 中，点击 `+` 按钮。\n3. 搜索 `AI Automation Suggester`。\n4. 选择该集成并点击 **下载**。\n5. **重启 Home Assistant**。\n6. 转到设置 → 设备与服务 → **+ 添加集成**，搜索 `AI Automation Suggester`。\n\n### 手动安装\n\n1. **下载** 此仓库的内容。\n2. **复制** `custom_components\u002Fai_automation_suggester` 文件夹到您的 Home Assistant `custom_components` 目录。\n    ```bash\n    \u003Chomeassistant_config_dir>\u002F\n    └── custom_components\u002F\n        └── ai_automation_suggester\u002F\n            ├── __init__.py\n            └── ... (其他文件)\n    ```\n3. **重启 Home Assistant**。\n4. 转到设置 → 设备与服务 → **+ 添加集成**，搜索 `AI Automation Suggester`。\n\n---\n\n## ⚙️ 配置\n\n1. 通过 Home Assistant UI 添加集成：设置 → 设备与服务 → **+ 添加集成** → `AI Automation Suggester`。\n2. 按照设置向导操作：\n    * **选择您的 AI 提供商：** 从下拉列表中选择。\n    * **输入 API 密钥或端点：** 根据您选择的提供商，提供必要的凭据或本地服务器 URL。\n    * **选择模型：** 选择您希望使用的具体模型版本。\n    * **设置最大 token 数：** 定义 AI 响应的最大长度（影响建议的长度）。\n    * **（可选）自定义系统提示：** 提供初始提示以引导 AI 的整体视角（例如：“您是智能家居节能自动化方面的专家。”）。\n\n您可以在稍后通过设置 → 设备与服务中的集成选项调整这些设置。\n\n---\n\n## 🛠️ 高级配置\n\n### 全局设置\n\n* **温度控制：**\n    * 适用于所有提供商\n    * 范围：0.0（更专注）至 2.0（更具创造性）\n    * 默认值：0.7\n    * 可在初始设置和选项中进行配置\n\n* **Token 管理：**\n    * 分别设置输入和输出 token 上限\n    * 防止过度使用 API\n    * 优化响应长度\n\n---\n\n## ✍️ 使用方法\n\n### 自动建议\n\n该集成附带一些示例自动化，您可以启用或调整：\n\n* **新增实体时：** 当 Home Assistant 中添加新实体时，自动生成功能建议，帮助您快速将其集成。\n* **每周回顾：** 每周（或您在自动化中自定义的时间间隔）触发一次全面分析，持续提供创意。\n\n您可以在设置 → 自动化中找到并启用这些示例。\n\n### 手动触发\n\n您可以通过服务调用来手动触发建议生成：\n\n1. 转到开发者工具 → **服务**。\n2. 选择服务 `ai_automation_suggester.generate_suggestions`。\n3. 调用该服务。您可以传递参数来自定义请求：\n    * `all_entities`（布尔值，默认为 `false`）：设置为 `true` 以考虑所有符合条件的实体，设置为 `false` 以仅考虑自上次成功运行以来新增的实体。\n    * `domains`（字符串列表，可选）：将分析范围限制在特定领域的实体上（例如，`['light', 'sensor']`）。\n    * `entity_limit`（整数，可选）：设置本次运行中 AI 应考虑的最大实体数量。有助于控制提示长度和成本。\n    * `custom_prompt`（字符串，可选）：为本次运行添加特定指令（例如，“为门窗提出安全自动化建议。”）。\n\n### 仪表板片段\n\n主传感器（`sensor.ai_automation_suggestions_\u003Cprovider_name>`）暴露了可用于仪表板显示的有用属性。将 `\u003Cprovider_name>` 替换为您为集成实例指定的名称（例如，`openai`、`ollama`）。\n\n* **显示描述：**\n    ```jinja\n    {{ state_attr('sensor.ai_automation_suggestions_\u003Cprovider_name>', 'description') }}\n    ```\n* **显示 YAML 块：**\n    ```jinja\n    {{ state_attr('sensor.ai_automation_suggestions_\u003Cprovider_name>', 'yaml_block') }}\n    ```\n您可以使用 Markdown 卡片或其他类型的卡片，在 Home Assistant 仪表板上整洁地呈现这些信息。\n\n---\n\n## 📊 监控与诊断\n\n该集成提供了多个传感器用于监控：\n\n* **AI 自动化建议：** (`sensor.ai_automation_suggestions_\u003Cprovider_name>`)\n    * 状态：`无建议`、`有新建议`、`有建议`\n    * 属性：\n        * `description`：人类可读的建议描述\n        * `yaml_block`：可直接使用的自动化 YAML\n        * `last_update`：上次更新的时间戳\n        * `entities_processed`：已分析实体列表\n        * `entities_processed_count`：已分析实体数量\n\n* **AI 提供商状态：** (`sensor.ai_provider_status_\u003Cprovider_name>`)\n    * 状态：`已连接`、`错误`、`已断开`、`初始化中`\n    * 属性：\n        * `last_error_message`：任何错误的详细信息\n        * `last_attempted_update`：上次尝试更新的时间戳\n\n* **最大输入\u002F输出 Token 数：** (`sensor.max_input_tokens_\u003Cprovider_name>`、`sensor.max_output_tokens_\u003Cprovider_name>`)\n    * 显示配置的 Token 限制\n    * 帮助监控 API 使用情况\n\n* **AI 模型：** (`sensor.ai_model_in_use_\u003Cprovider_name>`)\n    * 显示当前模型配置\n    * 对于多实例设置非常有用\n\n* **上次错误：** (`sensor.last_error_message_\u003Cprovider_name>`)\n    * 详细的错误跟踪\n    * 包括意外错误的堆栈跟踪\n\n---\n\n## 🔍 错误处理与故障排除\n\n* **堆栈跟踪：**\n    * 针对意外问题的详细错误日志记录\n    * 可在 Home Assistant 日志中查看\n    * 有助于调试 API 问题\n\n* **常见错误场景：**\n    * API 认证失败\n    * 网络连接问题\n    * 超出 Token 限制\n    * 模型不可用\n    * 响应解析错误\n\n* **错误监控：**\n    * 使用“上次错误”传感器进行实时错误跟踪\n    * 查看 Home Assistant 日志以获取堆栈跟踪\n    * 监控提供商状态传感器以检测连接问题\n\n---\n\n## 🔒 安全注意事项\n\n* 所有 API 密钥均使用 Home Assistant 的安全存储功能进行安全保存\n* UI 中的密码字段已正确遮蔽\n* 可使用本地提供商（Ollama、LocalAI）以确保完全的数据隐私\n\n---\n\n## 自定义与高级用法\n\n除了基本配置和服务调用参数外，您还可以进一步自定义该集成的行为：\n\n### 随机实体选择\n\n默认情况下，当 `all_entities` 设置为 `true` 时（或每周自动扫描运行时），该集成会采用随机实体选择。这有助于确保建议的多样性，并防止 AI 只关注同一组初始实体。\n\n### 域过滤\n\n在服务调用或自动化配置中使用 `domains` 参数来缩小关注范围。这对于获取特定领域的建议非常有效（例如，仅分析 `living_room` 区域中的 `light` 和 `switch` 实体——尽管区域过滤是基于所选实体隐含的）。\n\n### 实体数量限制\n\n`entity_limit` 参数对于管理提示大小至关重要，尤其是在对输入长度或成本敏感的模型上。请通过实验找到一个既能提供良好建议又不会触及 Token 限制或产生过高成本的限制值。\n\n### 自定义提示\n\n`custom_prompt` 参数允许您针对特定运行明确指定所需的建议类型。将其与域过滤结合使用，可以获得高度定向的结果（例如，`domains: ['climate']，custom_prompt: \"根据人员存在和天气情况，建议优化供暖\u002F制冷的自动化方案。\"`）。\n\n---\n\n## 实施自动化\n\n1.  **查看建议：** 检查持久通知或仪表板卡片以获取新建议。\n2.  **复制 YAML：** 建议以可直接使用的 Home Assistant YAML 片段形式提供。复制 `yaml_block` 内容。\n3.  **添加到 Home Assistant：**\n    * 将 YAML 粘贴到 `automations.yaml` 文件中并重启 Home Assistant。\n    * 或者，使用 Home Assistant 自动化编辑器界面：创建新自动化，切换到 YAML 模式，然后粘贴代码片段。\n4.  **根据需要调整：** 虽然建议已经过定制，但您可能仍需对触发器、条件、延迟或动作进行小幅调整，以完美匹配您的偏好和设备。\n5.  **测试：** 在依赖新自动化之前，务必对其进行测试，以确保其按预期工作。\n\n---\n\n## 传感器\n\n该集成提供了两个关键传感器用于监控：\n\n* **AI 自动化建议传感器：** `sensor.ai_automation_suggestions_\u003Cprovider_name>`\n    * 状态指示当前状态（如 `空闲`、`生成中`、`有建议`）。\n    * 属性包含最新建议，包括 `description`、`yaml_block`，以及可能根据 AI 提供商响应格式而提供的其他详细信息。\n* **AI 提供商状态传感器：** `sensor.ai_provider_status_\u003Cprovider_name>`\n    * 状态指示连接健康状况（如 `已连接`、`错误`、`不可用`）。\n    * 属性可能提供有关提供商状态或遇到的任何错误的更多细节。\n\n请监控这些传感器，以确保集成正常运行。\n\n---\n\n## ⚠️ 重要提示\n\n* **隐私考虑：** 如果使用基于云的 AI 提供商，请注意实体数据（名称、状态、属性）会被发送到其服务器。如果隐私是主要顾虑，可考虑使用本地 AI 模型（LocalAI、Ollama）以完全掌控数据。\n* **API 成本：** 一些云提供商会根据处理的 Token 数量收取 API 使用费用。请注意这一点，并使用 `entity_limit` 和计划运行频率等功能来管理潜在成本。同时，请留意提供商的账单。\n* **无保证：** AI 的建议基于所提供数据中的模式和逻辑推断。它们并不保证在每种情况下都是完美或最高效的解决方案。**在将建议实施到实际系统之前，务必仔细审查。**\n* **AI 的局限性：** 大型语言模型有时可能会产生幻觉或给出不合逻辑的建议。在审查时，请结合您的判断力和对家庭环境的了解。\n* **Home Assistant 依赖安全性：** 该集成使用普通的 HTTP 调用，无需 Python 的 `openai` 包。请避免在 HA 环境中安装或固定 `openai` 版本，因为 SDK 版本不匹配可能会导致官方 OpenAI 对话集成失效。\n\n---\n\n## 🧩 故障排除\n\n| 症状                                 | 检查\u002F操作                                                                                                                               |\n|-----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| **没有可用的建议** | - 验证 API 密钥是否正确。\u003Cbr>- 检查 `AI Provider Status` 传感器是否有错误。\u003Cbr>- 检查 Home Assistant 日志中与该集成相关的错误。\u003Cbr>- 尝试手动触发服务，设置较小的 `entity_limit` 并不使用领域过滤器。\u003Cbr>- 确保您有足够的实体\u002F设备以获得有意义的建议。 |\n| **AI 提供商状态显示 `error`** | - 检查 Home Assistant 日志 (`home-assistant.log`) 以获取详细的错误信息（查找 `ai_automation_suggester` 和 `processing error`）。\u003Cbr>- 检查您与提供商服务器（如果是云端）或本地服务器的网络连接。\u003Cbr>- 确认您的 API 密钥处于激活状态且具有相应权限。\u003Cbr>- 确保您的本地 AI 服务器正在运行并可访问。 |\n| **建议提示过长** | - 在触发服务或配置自动化时，减少 `entity_limit` 参数。\u003Cbr>- 使用 `domains` 过滤器缩小分析的实体范围。\u003Cbr>- 如果您使用了自定义提示，请缩短或简化它。 |\n| **出现意外启动的建议** | - 检查您的 Home Assistant 自动化和脚本，确保没有配置在启动时或通过您未预期的事件调用 `ai_automation_suggester.generate_suggestions`。 |\n| **建议重复** | - 确保使用 `all_entities`（例如在每周自动化中），并考虑启用随机实体选择。\u003Cbr>- 尝试不同的 `custom_prompt` 值，引导 AI 朝新的方向发展。\u003Cbr>- 在提示长度允许的情况下，增加 `entity_limit` 以提供给 AI 更多数据点。 |\n| **HACS\u002FGitHub 中图片链接失效** | 此问题已在本 README 版本中修复。请确保您仓库中的 README 文件使用提供的修正 URL。清除浏览器缓存或等待 GitHub\u002FHACS 刷新。 |\n\n如果您遇到此处未涵盖的问题，请在 GitHub 仓库中提交包含 Home Assistant 日志详细信息的问题。\n\n---\n\n## 路线图\n\n未来计划的功能和改进：\n\n* **更具交互性的建议：** 探索反馈机制，帮助 AI 根据用户对建议的接受或拒绝进行学习。\n* **一键创建自动化：** 简化从查看建议到在 Home Assistant 中创建自动化的流程。\n* **扩展本地化支持：** 通过社区贡献支持更多语言。\n* **改善实体\u002F设备上下文：** 增强提供给 AI 的关于设备类型、功能和关系的信息。\n\n---\n\n## 许可证\n\n本项目采用 MIT 许可证授权。详情请参阅 LICENSE 文件。\n\n---\n\n## 致谢\n\n* **Home Assistant 社区：** 感谢其提供强大且可扩展的智能家居平台。\n* **AI 提供商：** OpenAI、Anthropic、Google、Groq、LocalAI、Ollama、Mistral 和 Perplexity，感谢他们开发并提供强大的语言模型。\n* **贡献者和用户：** 感谢大家提供的宝贵反馈、测试以及有助于改进本项目的贡献。\n\n---\n\n## 贡献\n\n我们欢迎任何形式的贡献！如果您有新功能、改进、错误修复或翻译方面的想法，请随时在 GitHub 仓库中提交问题或拉取请求。请遵循标准的开发流程。\n\n---\n\n## 免责声明\n\n本组件为独立开发的自定义组件，与 Home Assistant、Nabu Casa 或任何提及的 AI 提供商均无关联、背书或官方支持。请根据自身判断谨慎使用。\n\n---\n\n## 🤝 支持本项目\n\n如果您觉得此集成非常有用，并为您节省了自动化家居的时间和精力，请考虑支持其开发。您的支持将用于维护、添加新功能以及支付开发和测试的相关费用。\n\n[\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBuy&nbsp;me&nbsp;a&nbsp;coffee-Support&nbsp;Dev-yellow?style=for-the-badge&logo=buy-me-a-coffee\" alt=\"Buy Me A Coffee\">](https:\u002F\u002Fwww.buymeacoffee.com\u002FITSpecialist)\n\n---\n\n## 补充信息\n\n如需进一步咨询、讨论或协助，请访问 GitHub 仓库或 Home Assistant 社区论坛主题帖（如有）。您的反馈对我们非常重要，将帮助我们规划本项目的未来发展方向。\n\n---\n\n## ❓ 常见问题解答\n\n**1. 如何更新该集成？**\n如果通过 HACS 安装，可在 Home Assistant 的 HACS 界面中直接更新。如果手动安装，则从仓库下载最新版本的文件，替换您 `custom_components\u002Fai_automation_suggester` 文件夹中的现有文件，然后重启 Home Assistant。\n\n**2. 我可以在没有云 API 密钥的情况下使用此集成吗？**\n可以！您可以使用 LocalAI 或 Ollama 等在本地网络上运行的本地 AI 模型。这需要您单独设置并运行本地 AI 服务器。\n\n**3. 我的 Home Assistant 数据安全吗？**\n当使用基于云的 AI 提供商时，特定的实体数据（名称、状态、属性）会被发送到提供商的 API 进行处理。请参考您所选 AI 提供商的隐私政策。使用本地模型则可将所有数据处理保留在您的本地网络内。\n\n**4. 我发现了一个 bug 或有一个功能需求，我该怎么办？**\n请在 GitHub 仓库中提交一个问题。尽可能提供详细信息，包括重现 bug 的步骤、截图以及相关日志。对于功能需求，请清晰描述所需功能及其使用场景。\n\n**5. 我能否获得除英语之外其他语言的建议？**\n其他语言下的建议质量高度依赖于所使用的 AI 模型。该集成会以英文构建提示，但您可以尝试使用其他语言的自定义提示，观察模型的响应情况。欢迎社区参与对该集成 UI 和文档的翻译工作！\n\n---\n\n借助 AI 自动化建议器，您将拥有一位由 AI 驱动的助手，帮助您充分发挥家居的潜力。与其被各种可能性压得喘不过气，不如获得经过深思熟虑、贴合情境的建议，让您的 Home Assistant 自动化更加高效、实用且充满乐趣。","# AI Automation Suggester 快速上手指南\n\n**AI Automation Suggester** 是一个专为 Home Assistant 设计的 AI 驱动助手。它能利用大语言模型分析你的智能家居环境（实体、区域、设备及现有自动化），并生成量身定制的 YAML 自动化建议，帮助你挖掘智能家居的潜力。\n\n## 环境准备\n\n在开始之前，请确保满足以下前置条件：\n\n*   **Home Assistant 版本**：2023.5 或更高版本。\n*   **AI 模型访问权限**：你需要配置一个可用的 AI 服务提供商。\n    *   **云端服务**：如 OpenAI, Anthropic (Claude), Google (Gemini), Groq, Mistral, Perplexity 等，需准备对应的 API Key。\n    *   **本地部署**：如 Ollama, LocalAI 等，需确保本地服务已启动且 Home Assistant 能够访问其地址。\n\n## 安装步骤\n\n推荐使用 **HACS** (Home Assistant Community Store) 进行安装，操作最为简便。\n\n### 方法一：通过 HACS 安装（推荐）\n\n1.  确保已安装 HACS。\n2.  进入 HACS 面板，点击左侧菜单的 **集成 (Integrations)**。\n3.  点击右上角的 **+** 号按钮。\n4.  搜索 `AI Automation Suggester`。\n5.  选中该集成并点击 **下载 (Download)**。\n6.  下载完成后，**重启 Home Assistant**。\n7.  重启后，进入 **设置 (Settings)** -> **设备与服务 (Devices & Services)** -> 右下角点击 **+ 添加集成 (Add Integration)**。\n8.  搜索 `AI Automation Suggester` 并按向导完成配置。\n\n### 方法二：手动安装\n\n如果无法使用 HACS，可手动复制文件：\n\n1.  下载本项目的源代码压缩包。\n2.  将解压后的 `custom_components\u002Fai_automation_suggester` 文件夹复制到 Home Assistant 配置目录下的 `custom_components` 文件夹中。\n    ```bash\n    \u003Chomeassistant_config_dir>\u002F\n    └── custom_components\u002F\n        └── ai_automation_suggester\u002F\n            ├── __init__.py\n            └── ... (其他文件)\n    ```\n3.  **重启 Home Assistant**。\n4.  进入 **设置** -> **设备与服务** -> **+ 添加集成**，搜索并添加 `AI Automation Suggester`。\n\n## 基本使用\n\n安装完成后，通过以下步骤生成第一个自动化建议：\n\n### 1. 配置集成\n\n在添加集成的向导中，你需要提供以下信息：\n*   **选择 AI 提供商**：从下拉列表中选择（如 OpenAI, Ollama 等）。\n*   **凭证\u002F地址**：输入 API Key 或本地服务器的 URL。\n*   **选择模型**：指定要使用的具体模型名称。\n*   **最大 Token 数**：限制 AI 回复的长度。\n*   **(可选) 自定义系统提示词**：例如输入 \"你是一位专注于节能的智能家居专家\"，以引导建议方向。\n\n### 2. 手动触发建议生成\n\n配置完成后，你可以立即通过服务调用手动测试：\n\n1.  进入 **开发者工具 (Developer Tools)** -> **服务 (Services)**。\n2.  在服务列表中找到并选择 `ai_automation_suggester.generate_suggestions`。\n3.  点击 **调用服务 (Call Service)**。\n\n你也可以传递参数来定制本次请求（在 YAML 模式下编辑）：\n\n```yaml\nservice: ai_automation_suggester.generate_suggestions\ndata:\n  all_entities: false # 设为 true 则分析所有实体，false 仅分析新增实体\n  domains: [\"light\", \"sensor\"] # 仅分析特定领域的实体\n  entity_limit: 20 # 限制分析的实体数量，控制成本和长度\n  custom_prompt: \"请为我的门窗传感器生成安全相关的自动化建议。\"\n```\n\n### 3. 查看与应用建议\n\n生成完成后，建议将通过以下两种方式呈现：\n\n*   **持久化通知**：在 Home Assistant 主界面右上角的通知中心查看详细的建议描述和 YAML 代码。\n*   **仪表盘展示**：集成了一个传感器（例如 `sensor.ai_automation_suggestions_openai`），你可以在 Lovelace 仪表盘中通过模板卡片展示建议内容。\n\n**示例：在仪表盘卡片中显示建议描述和 YAML 代码**\n\n```yaml\ntype: markdown\ncontent: |\n  ### 🤖 AI 自动化建议\n  \n  **描述:**\n  {{ state_attr('sensor.ai_automation_suggestions_\u003Cyour_provider_name>', 'description') }}\n  \n  **YAML 代码:**\n  ```yaml\n  {{ state_attr('sensor.ai_automation_suggestions_\u003Cyour_provider_name>', 'yaml_block') }}\n  ```\n```\n*(请将 `\u003Cyour_provider_name>` 替换为你配置集成时命名的实例名称，如 `openai` 或 `ollama`)*\n\n审查建议无误后，你可以直接将 YAML 代码复制到 Home Assistant 的 `automations.yaml` 或通过 UI 的自动化编辑器导入使用。","刚搬进新家的智能家居爱好者李明，在 Home Assistant 中接入了数十个传感器和设备，却因不知如何编写复杂的联动逻辑，导致大部分设备仍处于手动控制状态。\n\n### 没有 ai_automation_suggester 时\n- **创意落地难**：虽然想到“离家自动关闭所有非必要电器”的需求，但面对繁琐的 YAML 语法和实体 ID 查找，迟迟无法动手编写。\n- **设备利用率低**：新买的温湿度传感器和存在探测器仅能在仪表盘显示数据，未能与空调或新风系统形成联动，沦为“数据看板”。\n- **维护成本高**：随着设备增加，担心手动编写的自动化规则会产生冲突或遗漏，每次新增设备都要重新审视现有逻辑，心理压力巨大。\n- **场景覆盖窄**：受限于个人经验，只能实现基础的开关控制，忽略了如“根据光照和人员活动动态调节灯光色温”等高级节能舒适场景。\n\n### 使用 ai_automation_suggester 后\n- **一键生成代码**：ai_automation_suggester 自动扫描家中实体，直接推送包含完整逻辑的 YAML 代码块，李明只需复制粘贴并微调即可实现“离家模式”。\n- **挖掘隐藏价值**：工具分析出传感器与执行器的潜在协同关系，主动建议并生成了“浴室湿度超标自动开启排气扇”等此前未想到的实用自动化。\n- **动态适配演进**：每当接入新设备，ai_automation_suggester 会重新评估整体环境，提示现有规则是否需要更新，确保系统随家庭变化而持续优化。\n- **拓展高级场景**：基于大模型对家居生活的理解，工具提供了结合天气、时间等多维度的复杂场景建议，显著提升了居住的舒适度与能效。\n\nai_automation_suggester 将复杂的配置门槛转化为智能的决策辅助，让用户从繁琐的代码编写中解放出来，真正享受全屋智能带来的便利。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FITSpecialist111_ai_automation_suggester_09452afe.png","ITSpecialist111","Graham Hosking","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FITSpecialist111_ee85bb5a.jpg","Technical engineer and AI expert",null,"https:\u002F\u002Fgithub.com\u002FITSpecialist111",[80,84],{"name":81,"color":82,"percentage":83},"Python","#3572A5",96.5,{"name":85,"color":86,"percentage":87},"JavaScript","#f1e05a",3.5,713,37,"2026-04-12T23:10:01","MIT","未说明",{"notes":94,"python":92,"dependencies":95},"该工具是 Home Assistant 的集成插件，并非独立运行的 AI 模型。它本身不需要本地 GPU 或大量内存，而是通过 API 调用外部 AI 服务（如 OpenAI、Anthropic、Google 等）或连接到用户自建的本地 AI 服务器（如 Ollama、LocalAI）。若使用本地 AI 模型，硬件需求取决于所选模型及本地服务器的配置，而非本插件本身。",[96],"Home Assistant>=2023.5",[14,15,13],[99,100,101,102,103,104],"ai","automations","builder-design-pattern","home-assistant","suggester","automatic-suggestions","2026-03-27T02:49:30.150509","2026-04-18T22:40:10.698183",[108,113,118,122,127,132,137],{"id":109,"question_zh":110,"answer_zh":111,"source_url":112},40645,"使用 Anthropic Claude API Key 时提示 API-Error 怎么办？","这通常是因为选择了过时的默认模型。请在配置下拉菜单中，将模型名称从默认的 `claude-2.1` 更改为最新的可用模型，例如 `claude-3-7-sonnet-20250219`。修改后重新添加集成即可解决。","https:\u002F\u002Fgithub.com\u002FITSpecialist111\u002Fai_automation_suggester\u002Fissues\u002F46",{"id":114,"question_zh":115,"answer_zh":116,"source_url":117},40646,"删除并重新安装集成后，配置 Ollama 时提示\"Already configured\"（已配置）如何解决？","如果删除集成后仍提示已配置，可能是残留配置未清理干净。建议尝试完全重启 Home Assistant 系统以刷新状态。如果问题依旧，请检查 `custom_components` 目录下是否还有遗留文件夹，必要时手动清理后再次重启。","https:\u002F\u002Fgithub.com\u002FITSpecialist111\u002Fai_automation_suggester\u002Fissues\u002F74",{"id":119,"question_zh":120,"answer_zh":121,"source_url":117},40647,"在 NAS 上运行 Ollama 响应缓慢或无建议，该如何优化模型选择？","NAS 通常缺乏强大的 GPU 和大内存，运行大模型会导致响应极慢或超时。建议在 Ollama 中安装轻量级模型，例如 `llama3.2:1b`（1B 参数版本）。在 AI Automation Suggester 的配置中，模型名称应填写为 `llama3.2:1b`，不要随意添加后缀除非你明确知道该模型的具体标签。",{"id":123,"question_zh":124,"answer_zh":125,"source_url":126},40648,"升级后出现\"AttributeError: version cannot be changed directly\"错误如何处理？","这是一个已知的主机兼容性迁移问题。最有效的解决方法是执行干净的重新安装：先彻底删除该集成，然后重新安装最新版本（如 v1.1.1 或更高）。此外，如果遇到连接超时或 CloudFlare 相关错误，尝试重启整个 Home Assistant 系统以清除网络缓存和状态。","https:\u002F\u002Fgithub.com\u002FITSpecialist111\u002Fai_automation_suggester\u002Fissues\u002F28",{"id":128,"question_zh":129,"answer_zh":130,"source_url":131},40649,"日志中出现\"NoneType... update trace\"或协调器（coordinator）报错怎么办？","这是由于集成在 Home Assistant 实体注册表初始化完成前就尝试刷新数据导致的竞争条件。请将集成升级到 v1.3.3 或更高版本，新版本已修复此问题，会等待系统注册表初始化完毕后再执行首次刷新。升级后请重启 Home Assistant。","https:\u002F\u002Fgithub.com\u002FITSpecialist111\u002Fai_automation_suggester\u002Fissues\u002F83",{"id":133,"question_zh":134,"answer_zh":135,"source_url":136},40650,"点击\"Configure\"按钮时出现\"500 Internal Server Error\"错误如何解决？","此错误通常由旧版本中的配置流（config flow）缺陷引起。请将 AI Automation Suggester 集成更新到最新版本（至少 v1.2.7 以上，推荐最新稳定版），更新后该配置加载错误通常会被修复。","https:\u002F\u002Fgithub.com\u002FITSpecialist111\u002Fai_automation_suggester\u002Fissues\u002F56",{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},40651,"如何正确配置 OpenAI Azure 自定义端点？","请使用集成版本 1.4.0 或更高版本，该版本已原生支持 OpenAI Azure 登录和配置。在配置界面选择 OpenAI Custom 或 Azure 选项，填入您的 Azure 端点 URL（例如 `https:\u002F\u002Fxxx.openai.azure.com\u002Fopenai\u002Fdeployments\u002Fgpt-4o\u002Fchat\u002Fcompletions?api-version=2025-01-01-preview`）、部署的模型名称（如 `gpt-4o`）以及 API Key 即可。","https:\u002F\u002Fgithub.com\u002FITSpecialist111\u002Fai_automation_suggester\u002Fissues\u002F117",[143,148,153,158,163,168,173,178,183,188,193,198,203,208,213,218,223,228,233,238],{"id":144,"version":145,"summary_zh":146,"released_at":147},324136,"1.4.2","1.4.2 版本发布说明  \n发布日期：2025年12月12日  \n\n变更内容：  \n1. 在整个代码库中将集成版本更新至 1.4.2，以确保一致性。  \n2. 改进了依赖项管理，确保与 Home Assistant 运行环境的兼容性。  \n3. 进行了若干小修复和优化，以提升稳定性和性能。  \n\n注意事项：  \n本次发布解决了与 Home Assistant 的 OpenAI 对话集成之间可能出现的冲突问题，确保不会引入未管理的依赖项。  \n建议用户更新其 Home Assistant 环境，以确保与 Python 3.13 的兼容性。  \n\n升级说明：  \n1. 将 ai_automation_suggester 集成更新至 1.4.2 版本。  \n2. 重启 Home Assistant 以使更改生效。","2025-12-12T20:23:22",{"id":149,"version":150,"summary_zh":151,"released_at":152},324137,"1.4.1","🚀 版本 1.4.1 — 更大的灵活性与稳定性提升\n\n各位自动化架构师，大家好！\n\n本次更新旨在为您提供更多 AI 服务提供商的选择自由，同时从长远来看使集成更加稳定。\n\n✨ 新增功能\n\n通用 OpenAI 提供商 (#122)\n如果您有一个与 OpenAI 兼容但未正式列入官方列表的 API，也不用担心！现在只需提供 URL、API 密钥和模型名称，即可连接到几乎任何自定义端点。这为自托管模型和小众服务商提供了支持。\n\n所有提供商的超时时间延长\n有些模型在响应前需要较长时间。为此，我们已将所有提供商的默认响应超时时间调长，以减少令人沮丧的超时错误。\n\n配置重构 (#113)\n对选项管理方式进行了底层优化。虽然这项改进并不显眼，但它能确保后续维护更加顺畅，并进一步提升稳定性。\n\n统一命名\n该集成在 Home Assistant 的所有语言界面中都将统一显示为“AI 自动化建议器”，从而避免因翻译标题而导致的混淆。","2025-09-13T14:05:16",{"id":154,"version":155,"summary_zh":156,"released_at":157},324138,"1.4.0","\u003Chtml>\n\u003Cbody>\n\u003C!--StartFragment-->\u003Cp data-start=\"0\" data-end=\"153\">\u003Cstrong data-start=\"0\" data-end=\"153\">特别感谢 @RmG152 为不断优化这款自定义集成所付出的辛勤努力——而且这一切都是与社区携手完成的！\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Chr data-start=\"155\" data-end=\"158\">\n\u003Ch1 data-start=\"160\" data-end=\"210\">AI 自动化建议器 — v1.4.0 发布说明\u003C\u002Fh1>\n\u003Cp data-start=\"211\" data-end=\"226\">\u003Cem data-start=\"211\" data-end=\"224\">(2025年6月)\u003C\u002Fem>\u003C\u002Fp>\n\u003Cp data-start=\"228\" data-end=\"411\">各位智能家居创新者，大家好！🎉\u003Cbr data-start=\"260\" data-end=\"263\">\n本次更新带来了诸多新功能、体验优化以及几项面向高级用户的控制选项。以下是 \u003Cstrong data-start=\"400\" data-end=\"410\">v1.4.0\u003C\u002Fstrong> 中的所有内容。\u003C\u002Fp>\n\u003Chr data-start=\"413\" data-end=\"416\">\n\u003Ch2 data-start=\"418\" data-end=\"433\">✨ 亮点\u003C\u002Fh2>\n\u003Cdiv class=\"_tableContainer_16hzy_1\">\u003Cdiv tabindex=\"-1\" class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n类别 | 新增内容\n-- | --\n🌍 多语言界面 | 完整支持 ca、de、en、es、it、nl、ru、zh 语言。初始字符串由 AI 生成——欢迎母语人士审校！\u003Cbr\u002F>\u003Cbr\u002F>感谢早期本地化贡献者：\u003Cbr\u002F>@RmG152 @ITSpecialist111 @l30n4rd086 @Wendelstein7 @Freeartist2\n🔢 可调整自动化数量上限 | “作为上下文发送的现有自动化”这一硬编码限制已被移除。您可在设置 → 上下文大小中自行设定上限。\n☁️ Azure OpenAI 支持 | 支持使用您自己托管在 Azure 上的 OpenAI 模型（附带文档和调试提示）。\n🖥️ 重新设计的配置界面 | 现在所有选项都一目了然，按逻辑分组，并在编辑现有条目时自动填充。再也不用“捉迷藏”式地寻找选项啦！\n🌡️ 温度调节旋钮 | 可针对不同提供商设置模型的创造力（0.0–2.0）。您可以调高以激发更多创意，也可以保持保守。\n📜 通过 automations.yaml 提供丰富上下文 | 启用“包含自动化代码”选项，即可将完整的 YAML 定义发送至大上下文模型（如 Gemini），从而获得更深入、具备代码感知能力的建议。\n🔊 静音 Ollama 的“思考中…”提示 | 可选标志，用于屏蔽 Ollama 回复中的“思考中…”文字。\n🏷️ 提供商标识 | 通知现在会显示每条自动化是由哪个提供商建议的。\n⏱️ 延长 Gemini 超时时间 | 给 Gemini 更多处理时间，使其能够应对更大规模的提示而不会超时。\n⚠️ 更完善的错误报告 | 未处理的模型错误现在会生成完整的堆栈跟踪信息，以便更快地进行调试。\n\n\u003Cdiv class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\u003Cdiv class=\"absolute end-0 flex items-end\">\u003Cspan class=\"\" data-state=\"closed\">\u003Cbutton class=\"bg-token-bg-primary hover:bg-token-bg-tertiary text-token-text-secondary my-1 rounded-sm p-1 transition-opacity group-[:not(:hover):not(:focus-within)]:pointer-events-none group-[:not(:hover):not(:focus-within)]:opacity-0\">\u003Csvg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\" xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"icon\">\u003Cpath d=\"M12.668 10.667C12.668 9.95614 12.668 9.46258 12.6367 9.0791C12.6137 8","2025-06-20T12:24:17",{"id":159,"version":160,"summary_zh":161,"released_at":162},324139,"1.3.5","新增了 OpenRouter 服务提供商，并提供了更丰富的选项：\n\n- 温度控制。\n- 推理令牌（https:\u002F\u002Fopenrouter.ai\u002Fdocs\u002Fuse-cases\u002Freasoning-tokens）。\n\n感谢：@RmG152","2025-06-07T06:05:10",{"id":164,"version":165,"summary_zh":166,"released_at":167},324140,"1.3.4","🆕 新功能\n支持 automations.yaml\n现在可以从 automations.yaml 文件中读取配置，从而提升兼容性和配置灵活性。\n[#110](https:\u002F\u002Fgithub.com\u002F...\u002Fpull\u002F110) 由 @RmG152 提供\n\n新增诊断传感器\n引入了诊断传感器，以增强可观测性和调试能力。\n[#103](https:\u002F\u002Fgithub.com\u002F...\u002Fpull\u002F103) 由 @RmG152 提供\n\n新增本地化语言\n增加了西班牙语 (es.json)、加泰罗尼亚语 (ca.json) 和俄语 (ru.json) 的翻译文件，以扩大国际支持范围。\n[#101](https:\u002F\u002Fgithub.com\u002F...\u002Fpull\u002F101) 由 @RmG152 提供\n\n🛠 修复与改进\n自定义 OpenAI 配置修复\n解决了自定义 OpenAI 设置中的问题，并增强了日志记录，以便更好地进行故障排除。\n[#107](https:\u002F\u002Fgithub.com\u002F...\u002Fpull\u002F107)、[#104](https:\u002F\u002Fgithub.com\u002F...\u002Fpull\u002F104) 由 @RmG152 提供\n\n配置流程修复\n改进了配置流程的处理，使设置更加顺畅，错误更少。\n[#105](https:\u002F\u002Fgithub.com\u002F...\u002Fpull\u002F105) 由 @RmG152 提供","2025-05-24T05:36:32",{"id":169,"version":170,"summary_zh":171,"released_at":172},324141,"1.3.3","## 📦 AI 自动化建议器 — v1.3.3\n### 2025‑05‑03\n✨ 新功能与改进\n区域\t变更\n配置 \u002F 选项\t支持真正的选项流 — 现在集成会先从“选项”读取设置，再从初始数据中读取（通过新的 _opt() 辅助函数）。这意味着您可以编辑现有条目（最大令牌数、模型等），而无需删除并重新创建它。修复 #90。\n令牌控制\t新增提示和完成的独立预算：\nmax_input_tokens 和 max_output_tokens（两者均在“选项”对话框中公开）。如果您未设置它们，则会自动使用旧的 max_tokens 值。\n鲁棒性\t• 注册表保证在首次刷新前已加载，从而消除“NoneType 对象没有 'update' 属性”的崩溃问题。修复 #83、#87。\n• 各提供商之间统一的错误处理 — 任何 API 错误都会通过 last_error（传感器属性及日志）暴露出来。\n• 当选择未知提供商时，现在会记录明确的错误信息，而不是直接崩溃。\nOllama \u002F Perplexity\t清理并统一了提供商处理器，使其符合新的预算逻辑（Perplexity 处理器已完成；解决 #94）。\n传感器属性\t“Suggestions”传感器现在公开：\ndescription、yaml_block 和 last_error，以便于自动化和仪表板使用。\n代码健康\t对 coordinator.py 进行了大规模内部重构：\n‑ 公共辅助函数 (_budgets, _opt)，\n‑ 更严格的提示语，\n‑ 一致的 API 请求体\u002F头部，\n‑ 大量的代码检查。\n\n🐛 错误修复\n修复了修改现有条目后选项无法持久化的问题 (#90)。\n\n修复了当实体\u002F设备\u002F区域注册表仍为 None 时协调器崩溃的问题 (#83、#87)。\n\n修复了 Perplexity 提供商导入或密钥错误的问题 (#94)。\n\n修复了传感器偶尔在新内容出现后仍显示过时的“有建议可用”状态的问题。\n\n在实际测试中还发现并修复了若干轻微的语法\u002F缩进问题。\n\n🔧 升级说明\n更新自定义组件（通过 HACS → 重新加载或手动复制）。\n\n重启 Home Assistant。\n\n（可选但建议）前往“设置”→“设备与服务”→“AI 自动化建议器”→“配置”→“选项”，查看新的输入\u002F输出令牌字段。留空则保持原有行为。\n\n无破坏性变更；现有配置将自动迁移。","2025-05-03T08:00:52",{"id":174,"version":175,"summary_zh":176,"released_at":177},324142,"1.3.2","\u003Chtml>\n\u003Cbody>\n\u003C!--StartFragment-->\u003Ch2 data-start=\"0\" data-end=\"48\" class=\"\">AI 自动化建议器 — v1.3.2&nbsp;(2025‑05‑03)\u003C\u002Fh2>\n\u003Ch3 data-start=\"50\" data-end=\"69\" class=\"\">✨  修复内容\u003C\u002Fh3>\n\u003Cdiv class=\"_tableContainer_16hzy_1\">\u003Cdiv tabindex=\"-1\" class=\"_tableWrapper_16hzy_14 group flex w-fit flex-col-reverse\">\n类型 | 描述\n-- | --\n严重 错误 | 协调器崩溃  意外的协调器错误: 'NoneType' 对象没有 'update' 属性。根本原因: 父级 DataUpdateCoordinator 在 self.data 已被填充后将其重置为 None。现在字典是在 super().__init__() 调用之后创建的，并且“无建议”分支会分配一个新的空字典，而不是尝试更新可能为 None 的值。\n稳定性 | 在提供程序错误分支周围添加了额外的保护措施，因此可恢复的 API 失败不再会导致 self.data 变得无效。\n\n\u003Cdiv class=\"sticky end-(--thread-content-margin) h-0 self-end select-none\">\u003Cdiv class=\"absolute end-0 flex items-end\">\u003Cspan class=\"\" data-state=\"closed\">\u003Cbutton class=\"bg-token-bg-primary hover:bg-token-bg-tertiary text-token-text-secondary my-1 rounded-sm p-1 transition-opacity group-[:not(:hover):not(:focus-within)]:pointer-events-none group-[:not(:hover):not(:focus-within)]:opacity-0\">\u003Csvg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"icon-md-heavy\">\u003Cpath fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z\" fill=\"currentColor\">\u003C\u002Fpath>\u003C\u002Fsvg>\u003C\u002Fbutton>\u003C\u002Fspan>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch3 data-start=\"662\" data-end=\"696\" class=\"\">🔧  内部 \u002F 开发者说明\u003C\u002Fh3>\n\u003Cul data-start=\"697\" data-end=\"1087\">\n\u003Cli data-start=\"697\" data-end=\"933\" class=\"\">\n\u003Cp data-start=\"699\" data-end=\"775\" class=\"\">\u003Cstrong data-start=\"699\" data-end=\"716\">涉及文件:\u003C\u002Fstrong> \u003Ccode data-start=\"717\" data-end=\"775\">custom_components\u002Fai_automation_suggester\u002Fcoordinator.py\u003C\u002Fcode>\u003C\u002Fp>\n\u003Cul data-start=\"778\" data-end=\"933\">\n\u003Cli data-start=\"778\" data-end=\"849\" class=\"\">\n\u003Cp data-start=\"780\" data-end=\"849\" class=\"\">将 \u003Ccode data-start=\"804\" data-end=\"815\">self.data\u003C\u002Fcode> 的初始化移至父类构造函数之后。\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli data-start=\"852\" data-end=\"933\" class=\"\">\n\u003Cp data-start=\"854\" data-end=\"933\" class=\"\">在回退路径中，用直接赋值代替了 \u003Ccode data-start=\"863\" data-end=\"888\">self.data.update({...})\u003C\u002Fcode>。\u003C\u002Fp>\n\u003C\u002Fli>\n\u003C\u002Ful>\n\u003C\u002Fli>\n\u003Cli data-start=\"934\" data-end=\"1004\" class=\"\">\n\u003Cp data-start=\"936\" data-end=\"1004\" class=\"\">本次发布不涉及架构、服务或传感器的变化——这只是一个纯粹的 bug 修复版本。\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli data-start=\"1005\" data-end=\"1","2025-05-03T06:05:34",{"id":179,"version":180,"summary_zh":181,"released_at":182},324143,"1.3.1","\u003Chtml>\n\u003Cbody>\n\u003C!--StartFragment-->\u003Ch2 data-start=\"0\" data-end=\"40\" class=\"\">🚀 AI 自动化建议器 — v1.3.1\u003C\u002Fh2>\n\u003Cblockquote data-start=\"42\" data-end=\"125\">\n\u003C\u002Fblockquote>\n\u003Ch3 data-start=\"127\" data-end=\"143\" class=\"\">✨ 新增内容\u003C\u002Fh3>\n\u003Cdiv class=\"group pointer-events-none relative flex justify-center *:pointer-events-auto\">\u003Cspan class=\"pointer-events-none absolute start-full top-4 z-10 hidden h-full w-fit ps-2 md:block\" data-state=\"closed\">\u003Cbutton class=\"hover:bg-token-main-surface-secondary text-token-text-secondary pointer-events-auto rounded-lg px-1 py-1 opacity-0 transition-opacity duration-200 group-focus-within:opacity-100 group-hover:opacity-100\">\u003Csvg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" class=\"icon-md-heavy\">\u003Cpath fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z\" fill=\"currentColor\">\u003C\u002Fpath>\u003C\u002Fsvg>\u003C\u002Fbutton>\u003C\u002Fspan>\u003Cdiv class=\"tableContainer horzScrollShadows relative\">\n类别 | 详情\n-- | --\nYAML\u002F描述的现成属性 | 负责繁重任务（正则表达式提取）的工作已移至协调器。现在，每次 AI 的回复都会自动拆分为：  • description – 纯文本说明  • yaml_block – 原始自动化代码（如果存在）您可以直接使用它们：state_attr('sensor.ai_automation_suggestions_google', 'yaml_block')。\n版本对齐 | 所有内部版本字符串及 manifest.json 均已更新至 1.3.1，以避免 HACS 报告版本不匹配的问题。\n代码清理 | • 移除了传感器中已过时的正则表达式辅助代码。• 删除了未使用的导入和重复注释。• 按照 PEP 8 规范统一了空行。最终结果：传感器文件从 199 行缩减至 184 行，同时保持原有功能不变。\n\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch3 data-start=\"968\" data-end=\"981\" class=\"\">🛠️ 修复\u003C\u002Fh3>\n\u003Cul data-start=\"982\" data-end=\"1238\">\n\u003Cli data-start=\"982\" data-end=\"1107\" class=\"\">\n\u003Cp data-start=\"984\" data-end=\"1107\" class=\"\">传感器不再抛出“\u003Ccode data-start=\"1009\" data-end=\"1021\">yaml_block\u003C\u002Fcode> 属性缺失”的错误——它始终存在（如果 AI 没有返回代码，则为空字符串）。\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli data-start=\"1108\" data-end=\"1182\" class=\"\">\n\u003Cp data-start=\"1110\" data-end=\"1182\" class=\"\">协调器能够安全地处理返回非 Markdown 格式响应的服务提供商。\u003C\u002Fp>\n\u003C\u002Fli>\n\u003Cli data-start=\"1183\" data-end=\"1238\" class=\"\">\n\u003Cp data-start=\"1185\" data-end=\"1238\" class=\"\">对日志记录进行了小幅调整，使回溯信息的位置更加清晰。\u003C\u002Fp>\n\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3 data-start=\"1240\" data-end=\"1268\" class=\"\">🧑‍💻 仪表盘提示\u003C\u002Fh3>\n\u003Cul data-start=\"1269\" data-end=\"1519\">\n\u003Cli data-start=\"1269\" data-end=\"1","2025-04-26T15:56:11",{"id":184,"version":185,"summary_zh":186,"released_at":187},324144,"1.3.0","感谢提醒！  \n> _AI 自动化建议器_ 现在更加安全、更友好地适配仪表盘，并且完全符合 CI 规范。🎉\n\n### ✨ 亮点\n- **仪表盘就绪的属性**  \n  每个 `sensor.ai_automation_suggestions_*` 现在都公开以下内容：\n  - `description` – 对建议的纯文本说明  \n  - `yaml_block` – 仅包含 YAML 代码块的部分  \n  - `suggestions` – 完整且未拆分的文本（旧版）\n- **稳固可靠的组件代码**  \n  缺少方法导致的崩溃以及 `NoneType.area_id` 错误已彻底消除。\n\n### 🐛  完整变更日志\n| 类型 | 项目 |\n|------|------|\n| **修复** | 移除 `const.py` 中多余的 Markdown 分隔符，从而消除 Home Assistant 启动时的 **SyntaxError** |\n| **修复** | 对 `area_id`、`device_id` 等进行空值安全检查 |\n| **修复** | 始终为每个提供者注册 `process_with_*` 处理程序；防止出现“对象没有该属性”的错误 |\n| **增强** | 将建议负载拆分为 `description` 和 `yaml_block` 两个属性 |\n| **增强** | 更清晰的错误日志记录：第一行现在会显示提供者及原因 |\n\n### ⚠️ 破坏性变更\n那些引用了以下属性的仪表盘：\n\nstate_attr('sensor.ai_automation_suggestions_google', 'suggestions')\n\n可以保持原样（该属性仍然存在），但你可能更希望使用更整洁的方式：\n\nstate_attr('sensor.ai_automation_suggestions_google', 'description')\nstate_attr('sensor.ai_automation_suggestions_google', 'yaml_block')\n\n⬆️ 升级指南  \n通过 HACS 更新，或将最新版本的压缩包解压到 `custom_components\u002Fai_automation_suggester\u002F` 目录下。\n\n重启 Home Assistant。\n\n确认日志中只有一条干净的“设置完成”信息（无堆栈跟踪）。\n\n根据需要调整仪表盘以使用新属性（可选）。\n\n感谢所有报告问题和测试修复的用户 🙌","2025-04-21T20:00:00",{"id":189,"version":190,"summary_zh":191,"released_at":192},324145,"1.2.9","**Perplexity AI 提供商**\n\n新增了完整的设置流程，并支持实时 API 密钥验证。\n\n支持 sonar-* 以及其他任何 Perplexity 的聊天补全模型。\n\n新增服务常量：perplexity_api_key、perplexity_model。\n\n新增端点：https:\u002F\u002Fapi.perplexity.ai\u002Fchat\u002Fcompletions。\n\n🔧 **改进**\n协调器重构\n\n移除了重复代码，将辅助逻辑集中化，并强化了错误处理。\n\n提示构造和实体采样未作更改，但运行时内存占用略有降低。\n\n所有功能迁移相关的常量（CONFIG_VERSION、config‑flow VERSION）均保持不变。\n\n🛠️ **开发者说明**\n现有提供商、服务参数及 YAML 自动化均无破坏性变更。\n\n从 v1.2.8 到 v1.2.9 的代码清理\n\n如果您维护本地分支，只需合并以下内容：\n\nconst.py 中的新常量。\n\nconfig_flow.py 中的 validate_perplexity() 和 async_step_perplexity()。\n\ncoordinator.py 中的 process_with_perplexity() 处理程序及分发条目。\n\n**祝您自动化愉快！**","2025-04-21T18:57:24",{"id":194,"version":195,"summary_zh":196,"released_at":197},324146,"1.2.8","**Perplexity AI provider**\r\n\r\nAdded full setup flow with live API‑key validation.\r\n\r\nSupports sonar-* and any other Perplexity chat‑completion models.\r\n\r\nNew service constants: perplexity_api_key, perplexity_model.\r\n\r\nNew endpoint: https:\u002F\u002Fapi.perplexity.ai\u002Fchat\u002Fcompletions.\r\n\r\n🔧** Improvements**\r\nCoordinator refactor\r\n\r\nRemoved duplicate code, centralised helper logic, and tightened error handling.\r\n\r\nPrompt construction and entity sampling unchanged, but runtime memory footprint is slightly lower.\r\n\r\nAll functional migration constants (CONFIG_VERSION, config‑flow VERSION) remain unchanged.\r\n\r\n🛠️ **Developer notes**\r\nNo breaking changes to existing providers, service parameters, or YAML automations.\r\n\r\nIf you maintain local forks, you only need to merge:\r\n\r\nNew constants in const.py.\r\n\r\nvalidate_perplexity() and async_step_perplexity() in config_flow.py.\r\n\r\nprocess_with_perplexity() handler plus dispatch entry in coordinator.py.\r\n\r\n**Happy automating!**","2025-04-21T18:32:28",{"id":199,"version":200,"summary_zh":201,"released_at":202},324147,"1.2.7","**Enhancements and Fixes:**\r\n\r\n**Options Flow Handler Fix:**\r\n\r\nFixed how the options flow handler is invoked. Now, the config entry is no longer repeatedly passed, streamlining the process. (PR: #56)\r\n\r\nSpecial thanks to @CloCkWeRX for this fix!\r\n\r\nReference: [Home Assistant Config Entries Options Flow Handler Documentation](https:\u002F\u002Fdevelopers.home-assistant.io\u002Fdocs\u002Fconfig_entries_options_flow_handler\u002F)\r\n\r\n**Dashboard Integration:**\r\n\r\nUpdated README with a simple method to display results in a dashboard card. Users can now easily integrate automation suggestions into their Home Assistant dashboard using the Markdown Card. The following example can be added to the content of the card:\r\n\r\nmarkdown\r\nCopy\r\n{{ state_attr('sensor.ai_automation_suggestions_localai', 'suggestions') }}\r\nSimply replace the sensor entity name to match your own.\r\n\r\nThanks to @wilburCforce for this contribution!\r\n\r\n**Google Model Update:**\r\n\r\nChanged the default Google model to gemini-2.0-flash due to a 404 error with the previously used gemini-1.0-pro model.\r\n\r\nThanks to @louispires for this update!\r\n\r\n**Integration Fix:**\r\n\r\nFixed an issue with adding the integration where the default model was set incorrectly. Changing from claude-2.1 to claude-3-7-sonnet-20250219 resolved the issue.\r\n\r\nThanks to @xvlw for identifying and fixing this!","2025-04-17T07:44:16",{"id":204,"version":205,"summary_zh":206,"released_at":207},324148,"1.2.6","New in v1.2.6 - Last minute BUG Found - reposted with changes.\r\n**\r\nAnthropic's API is rejecting the validation request because it’s still targeting the old “\u002Fv1\u002Fcomplete” endpoint and using an outdated payload format.\r\n**\r\n\r\nAnthropic Integration Fix:\r\n\r\nUpdated the Anthropic payload format to wrap the user prompt within a list of dictionaries (using \"type\": \"text\"), ensuring compatibility with the Anthropic API.\r\nAligned the validation and request payload structure with the latest Anthropic API requirements.\r\nConfiguration and Validation Enhancements:\r\n\r\nImproved error handling and logging for Anthropic API calls to provide clearer feedback in case of misconfiguration or API issues.\r\nUpdated the config flow validator for Anthropic to use the correct endpoint and consistent payload structure.\r\nMinor Bug Fixes and Improvements:\r\n\r\nFixed various minor issues to enhance overall stability and performance.\r\nRefined internal logging messages for better traceability during debugging.\r\nThese changes ensure that users with Anthropic configurations experience fewer errors and improved API communication. Enjoy the update!","2025-03-09T20:09:19",{"id":209,"version":210,"summary_zh":211,"released_at":212},324149,"1.2.5","New in v1.2.5\r\nAnthropic Integration Fix:\r\n\r\nUpdated the Anthropic payload format to wrap the user prompt within a list of dictionaries (using \"type\": \"text\"), ensuring compatibility with the Anthropic API.\r\nAligned the validation and request payload structure with the latest Anthropic API requirements.\r\nConfiguration and Validation Enhancements:\r\n\r\nImproved error handling and logging for Anthropic API calls to provide clearer feedback in case of misconfiguration or API issues.\r\nUpdated the config flow validator for Anthropic to use the correct endpoint and consistent payload structure.\r\nMinor Bug Fixes and Improvements:\r\n\r\nFixed various minor issues to enhance overall stability and performance.\r\nRefined internal logging messages for better traceability during debugging.\r\nThese changes ensure that users with Anthropic configurations experience fewer errors and improved API communication. Enjoy the update!","2025-03-09T19:53:36",{"id":214,"version":215,"summary_zh":216,"released_at":217},324150,"1.2.4","## Summary\r\n\r\nVersion 1.2.4 of the AI Automation Suggester addresses upcoming Home Assistant deprecations by updating platform forwarding and options flow handling. Additionally, it enhances the Mistral AI provider configuration by allowing flexible model selection (defaulting to `\"mistral-large-latest\"`). These changes ensure the integration’s stability and compatibility with future Home Assistant releases.\r\n\r\n## Enhancements & Fixes\r\n\r\n### Deprecation Resolutions\r\n- **Platform Forwarding Update:**  \r\n  Replaced the deprecated `async_forward_entry_setup` call with the new `async_forward_entry_setups` method in `__init__.py`. This change ensures compatibility with Home Assistant 2025.6 and later.\r\n  \r\n- **Options Flow Cleanup:**  \r\n  Removed the explicit assignment of `config_entry` in the options flow handler in `config_flow.py`, addressing deprecation warnings for Home Assistant 2025.12.\r\n\r\n### Mistral AI Provider Improvements\r\n- **Flexible Model Configuration:**  \r\n  Updated the Mistral AI setup to use an open text field for the model selection rather than fixed radio buttons.  \r\n  The default model is now set to `\"mistral-large-latest\"`, allowing users the flexibility to specify any model name as needed.\r\n\r\n- **Uniform Configuration Experience:**  \r\n  Adjusted the Mistral AI integration steps so that its configuration aligns with other supported providers, ensuring a consistent and intuitive setup process.\r\n\r\n### General Stability & Logging Enhancements\r\n- Improved logging in validation and API interaction routines to facilitate easier troubleshooting.\r\n- General code refinements ensure that the integration remains robust and future-proof.\r\n\r\n","2025-03-08T12:53:18",{"id":219,"version":220,"summary_zh":221,"released_at":222},324151,"1.2.3","Release Date: 8th March 2025\r\n\r\nHighlights:\r\n\r\n##New Provider Integration – Mistral AI:\r\n\r\nIntroduced support for Mistral AI as a new AI provider within the integration.\r\nUpdated configuration flows now include \"Mistral AI\" as an option, complete with dedicated API key and model settings.\r\nThe coordinator has been enhanced with a new process_with_mistral method that calls the Mistral AI chat completions endpoint, ensuring smooth API interactions.\r\n\r\nConfiguration Enhancements:\r\n\r\nProvider options in the setup flow now list Mistral AI alongside existing providers.\r\nThe options flow has been updated to validate and save Mistral-specific settings, ensuring consistency with the integration’s overall configuration scheme.\r\nImproved Error Handling and Logging:\r\n\r\nMinor adjustments have been made in the coordinator’s API call methods to improve error reporting and logging, resulting in better traceability of issues during API interactions.","2025-03-08T10:11:38",{"id":224,"version":225,"summary_zh":226,"released_at":227},324152,"1.2.2","Release Date: 8th March 2025\r\n\r\nHighlights:\r\n\r\n##New Provider Integration – Mistral AI:\r\n\r\nIntroduced support for Mistral AI as a new AI provider within the integration.\r\nUpdated configuration flows now include \"Mistral AI\" as an option, complete with dedicated API key and model settings.\r\nThe coordinator has been enhanced with a new process_with_mistral method that calls the Mistral AI chat completions endpoint, ensuring smooth API interactions.\r\n\r\nConfiguration Enhancements:\r\n\r\nProvider options in the setup flow now list Mistral AI alongside existing providers.\r\nThe options flow has been updated to validate and save Mistral-specific settings, ensuring consistency with the integration’s overall configuration scheme.\r\n\r\nImproved Error Handling and Logging:\r\n\r\nMinor adjustments have been made in the coordinator’s API call methods to improve error reporting and logging, resulting in better traceability of issues during API interactions.","2025-03-08T10:10:41",{"id":229,"version":230,"summary_zh":231,"released_at":232},324153,"1.2.1","## AI Automation Suggester 1.2.1\r\n\r\n**Release Date**: 2025-01-05\r\n\r\n### Highlights\r\n\r\n- **Improved Prompt Management & Token Handling**\r\n\r\n    - Added approximate token counting and truncation for both OpenAI and Google calls to avoid sending overly large prompts.\r\n    - Ensures requests stay within each provider’s maximum token limit (e.g., 30,720 tokens for Google, 32,768 for OpenAI).\r\n- **Model-Specific Parameter Adjustments**\r\n\r\n    - For **OpenAI**:\r\n        - Standard models continue to use `max_tokens`.\r\n        - New or special models (e.g., `gpt-4o`, `o1`, `o1-mini`, `o1-preview`) that require `max_completion_tokens` are now properly supported.\r\n        - Prevents the “Unsupported parameter: 'max\\_tokens'” error on models that do not accept `max_tokens`.\r\n    - For **Google**:\r\n        - Simplified approach that uses `maxOutputTokens` only—removed checks for non-Google models (e.g., `gpt-4o`, `o1-preview`).\r\n\r\n### Detailed Changes\r\n\r\n1. **OpenAI Fixes**\r\n\r\n    - Added logic to detect specific models needing `max_completion_tokens` instead of `max_tokens` (e.g., `gpt-4o`, `o1`, `o1-mini`, `o1-preview`).\r\n    - When prompt size is too large, we truncate it to stay within a safe limit (default ~32K tokens).\r\n2. **Google API Updates**\r\n\r\n    - Introduced token counting to cap request size at 30,720 tokens, addressing the `INVALID_ARGUMENT` errors.\r\n    - Removed references to non-Google models in the Google request code.\r\n3. **General Resilience**\r\n\r\n    - Safer request-building steps guard against sending huge prompts or invalid parameters.\r\n    - Logging improvements to warn when prompts exceed size limits.\r\n\r\n### Upgrading\r\n\r\n- No special steps required for upgrading from 1.2.0 to 1.2.1.\r\n- Restart Home Assistant after updating to ensure the changes take effect.\r\n\r\n### Notes\r\n\r\n- If you continue to see truncation warnings, consider refining your prompts or summarizing content.\r\n- If you use custom models not listed here (beyond `gpt-4o`, `o1`, `o1-mini`, `o1-preview`), you can extend the logic in `coordinator.py` similarly to handle model-specific parameters.\r\n\r\n* * *\r\n\r\n**Thank you for using AI Automation Suggester!**","2025-01-05T13:33:15",{"id":234,"version":235,"summary_zh":236,"released_at":237},324154,"1.2.0","## This integration is automatic on Restart of HASS. Other suggestions must have an automation to trigger please see automations YAML in the codebase or GitHub!\r\n\r\n## 🌟 Key Features\r\n\r\n### 🎲 Randomized Entity Selection\r\n- AI Automation Suggester now randomly samples entities\r\n- Provides more diverse and dynamic suggestions\r\n- Prevents repetitive automation patterns\r\n\r\n### 🎯 Enhanced Control & Filtering\r\n- Domain-specific filtering (e.g., light, sensor)\r\n- Customizable entity limits\r\n- Fine-grained control over automation scope\r\n\r\n### 🧠 Smarter Context Awareness\r\n- Integration with device and area registries\r\n- Location-aware suggestions\r\n- Device-specific automation recommendations\r\n\r\n## 💡 Improvements\r\n\r\n### Prompt System Enhancements\r\n- Custom prompt support with clean system integration\r\n- Theme-based automation suggestions\r\n  - Energy-saving focus\r\n  - Presence-based control\r\n  - Custom instruction support\r\n\r\n### 🛠 Technical Optimizations\r\n- Intelligent prompt truncation\r\n- Token limit management\r\n- Improved stability for large HA installations\r\n\r\n## 📚 Documentation\r\n- Updated README\r\n- Enhanced service documentation\r\n- New examples for:\r\n  - Custom prompts\r\n  - Entity filtering\r\n  - Random selection\r\n\r\n## 🔧 Installation Notes\r\n- Update `services.yaml` for new parameters\r\n- No `const.py` modifications needed\r\n- Check startup triggers if unexpected suggestions occur\r\n\r\n---\r\n📅 Release Date: 2024-12-15 - Graham Hosking\r\n","2024-12-15T12:37:14",{"id":239,"version":240,"summary_zh":241,"released_at":242},324155,"1.1.4","Release Title: AI Automation Suggester v1.1.4\r\n🚀 New Features\r\nAdded simplified Chinese (zh) translation file to enhance accessibility for Chinese-speaking users.\r\nAdded Dutch (nl) translation file to support Dutch-speaking users.\r\n🛠 Improvements\r\nEnhanced localization support to accommodate multiple languages.\r\nUpdated documentation to reflect the addition of new translations.\r\n🐛 Bug Fixes\r\nResolved minor issues with configuration validation in the provider setup.\r\nImproved error messages for better troubleshooting.\r\n🌍 Localization Notes\r\nFor Chinese, the file is named zh.json following ISO language conventions.\r\nFor Dutch, the file is named nl.json.\r\n📥 How to Upgrade\r\nPull the latest code from the repository.\r\nEnsure your Home Assistant instance is updated to the latest version.\r\nReplace existing language files with the new ones as necessary.\r\n📣 Call for Contributions\r\nWe welcome contributions for additional translations or improvements. If you’d like to add support for another language or enhance existing features, feel free to submit a pull request!","2024-12-07T12:50:52"]