Skip to content

dzerik/ha-smartchain

Repository files navigation

en ru

SmartChain

Multi-provider LLM conversation agent for Home Assistant

HACS GitHub release Downloads License tests CI HACS validation Hassfest Home Assistant

Open via HACS

Overview

SmartChain is a Home Assistant custom integration that provides an intelligent voice/conversation assistant powered by multiple LLM providers through LangChain. It also ships a sidebar panel for camera image analysis.

Supported providers:

  • GigaChat (Sber) — Russian-focused LLM with vision support
  • YandexGPT — Yandex Cloud LLM
  • OpenAI — GPT-4.1, GPT-4o, o3, o4-mini
  • Ollama — local models (Llama, Qwen, Gemma, T-Pro, DeepSeek, Home-3B)
  • DeepSeek — cheapest cloud provider (V3, R1)
  • Anthropic — Claude (Sonnet, Haiku, Opus)

Key Features

Conversation

  • 6 LLM providers — cloud and local, switch without losing configuration
  • Multiple agents — different models and prompts per provider (sub-entries)
  • Streaming responses — real-time token-by-token output
  • Device control — Assist API (tool calling): lights, switches, locks, climate
  • Multi-agent orchestration (v4.4.0+)ask_agents parallel fan-out across up to 5 siblings, critique_response second-opinion review, ask_agent single delegation
  • Custom tools from YAML (v4.1.0+) — declarative LLM-callable tools with four action types (service, template, rest, script); per-subentry allowed_tools filter
  • MCP client (v4.2.0+) — connect to remote MCP servers (stdio / sse / http) — filesystem, GitHub, brave-search, etc.; per-server auto-reconnect
  • Long-term memory / RAG (v4.3.0+) — Chroma vector store; search_memory LLM tool; conversation + (opt-in) HA logbook ingest; pluggable embeddings (Ollama / OpenAI / GigaChat / Yandex)
  • State historyget_state_history tool for past device states
  • Vision — camera image analysis via multimodal models
  • Skill system — loadable YAML files with additional knowledge
  • Prompt caching — token savings on repeated requests
  • Chat history — multi-turn conversations with context
  • Jinja2 templates — customizable system prompt with device context

Services

  • smartchain.ask — send a message to LLM from automations (Telegram, Slack, etc.)
  • smartchain.analyze_image — camera snapshot → multimodal LLM → response
  • smartchain.reload_tools (v4.1.0+) — re-read tools.yaml, restart MCP connections, rebuild memory subsystem atomically
  • smartchain.clear_memory (v4.3.0+) — delete stored memories filtered by kind and/or agent_id
  • AI Task entity — structured data generation for automations

SmartChain AI Panel

  • Sidebar panel with a camera analysis tab
  • Pick any HA camera, ask the LLM a natural-language question about the snapshot
  • Result is mirrored to the smartchain_image_analyzed event and sensor.smartchain_last_analysis

Note: The YAML automation/script/scene/blueprint generation feature was removed in v4.0.0. See CHANGELOG.md for migration details.

Installation

Requirements

  • Home Assistant 2024.12.0+
  • HACS installed

Install via HACS

  1. Add this repository as a custom HACS repository: https://github.com/dzerik/ha-smartchain
  2. Search for "SmartChain" in HACS
  3. Install and restart Home Assistant

Quick Start

1. Add Integration

Settings > Devices & Services > Add Integration > SmartChain

2. Select Provider and Enter Credentials

Provider What you need
GigaChat Auth credentials from developers.sber.ru
YandexGPT API Key + Folder ID from Yandex Cloud
OpenAI API key from platform.openai.com
Ollama Base URL (default: http://localhost:11434)
DeepSeek API key from platform.deepseek.com
Anthropic API key from console.anthropic.com

3. Configure Options

  • Model — select from list or type custom model name
  • Assist API — enable device control via LLM tool calling
  • System Prompt — customize the assistant's behavior
  • State History Tool — enable past event analysis

4. Activate Assistant

Settings > Voice Assistants > Add — select your SmartChain entity as the conversation agent.

5. Open SmartChain AI Panel

Click SmartChain AI in the Home Assistant sidebar to open the camera analysis panel.

SmartChain AI Panel - Analyze Camera

Documentation

Full user guide with all features and running examples:

Covers: providers and credentials · subentry options · all services with examples · built-in conversation tools (Assist API, history, delegate, multi-agent, search_memory) · custom tools from YAML (service / template / rest / script) · MCP client (stdio / SSE / HTTP) · long-term memory (Chroma + 4 embedding providers) · AI Task entity · sidebar panel · skills system · troubleshooting.

What's new

Version Highlights
v4.4.0 Multi-agent orchestration — ask_agents parallel fan-out + critique_response second-opinion review
v4.3.0 Long-term memory / RAG — Chroma vector store, search_memory tool, conversation + logbook ingest
v4.2.0 MCP client — connect to remote MCP servers via stdio / SSE / HTTP with auto-reconnect
v4.1.0 Custom tools from YAML — declarative LLM tools (service / template / rest / script)
v4.0.2 Security fixes, proper Last Analysis SensorEntity, correct integration_type
v4.0.0 Major refactor — focused on conversation, AI Task and vision

Full release notes: CHANGELOG.md.

License

MIT

About

SmartChain — multi-provider LLM conversation agent for Home Assistant (GigaChat, YandexGPT, OpenAI) with tool calling and streaming

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors