Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/powerllm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.13', '3.14']
python-version: ['3.14']

steps:
- uses: awalsh128/cache-apt-pkgs-action@latest
Expand Down
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ This integration provides:

1. HTTP API for available LLM tools to integrate HA LLM Tools with an externally running LLM
2. Framework to easily add new LLM tools from other custom integrations, making Home Assistant a platform for LLM tools experimentation.
3. Enhanced and experimental versions of core 'Assist' LLM tools
4. Selectively Enable/Disable any tool
3. Detailed entity queries with `HassGetState`, including attributes and time since the last state change
4. Selectively enable or disable PowerLLM tools
5. Extra LLM tools:
* Web and news search with Duck Duck Go
* Web scrapping to access the Internet
Expand All @@ -20,34 +20,39 @@ Please feel free to raise an issue if you have an idea of another useful tool!

## Installation

Requires Home Assistant 2026.8 or later.

1. Copy `custom_components/powerllm` directory from this repository into `custom_components/` directory in your config directory. Optionally use HACS for this step.
2. Restart Home Assistant
3. Add a config entry by going to Settings -> Device and Services -> Add integration or by pressing here: [![Add integration to My HA](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=powerllm). If you only need the HTTP API but not the extra tools, then you can just add `powerllm:` into your `configuration.yaml` instead.
4. Configure your LLM integrations, such as [OpenAI Conversation](https://www.home-assistant.io/integrations/openai_conversation/) [![Show integration on My HA](https://my.home-assistant.io/badges/integration.svg)](https://my.home-assistant.io/redirect/integration/?domain=openai_conversation) or [Google Generative AI](https://www.home-assistant.io/integrations/google_generative_ai_conversation/) [![Show integration on My HA](https://my.home-assistant.io/badges/integration.svg)](https://my.home-assistant.io/redirect/integration/?domain=google_generative_ai_conversation) to use Power LLM API instead of Assist API.
4. Configure your LLM integrations, such as [OpenAI Conversation](https://www.home-assistant.io/integrations/openai_conversation/) [![Show integration on My HA](https://my.home-assistant.io/badges/integration.svg)](https://my.home-assistant.io/redirect/integration/?domain=openai_conversation) or [Google Generative AI](https://www.home-assistant.io/integrations/google_generative_ai_conversation/) [![Show integration on My HA](https://my.home-assistant.io/badges/integration.svg)](https://my.home-assistant.io/redirect/integration/?domain=google_generative_ai_conversation) to select **both Assist and your Power LLM API**. Assist provides home control, timers, exposed scripts, calendars, to-do lists, live context, and date/time. PowerLLM provides the additional tools.

When upgrading a pre-HA2026.8 installation, add Assist to every conversation agent that previously selected only PowerLLM. PowerLLM no longer duplicates Assist tools or automatically exposes registered intents. Integrations should contribute those tools through Home Assistant's `llm` platform. PowerLLM's custom-tool registration framework remains available.

## Configuration

There are following configuration options available:

* ### Include exposed entities into api prompt
For each interaction with LLM, a system prompt is generated. If this option is enabled, the system prompt will contain the list of all exposed devices. It would allow the LLM to find the devices you refer to more fast and reliable, but also consume input tokens. If your list of exposed entities is really big, you may want to disable this option and rely on other methods, such as explicit querying (see next option) or just guessing by its name from the user prompt (make sure to set up your aliases).

* ### Include relevant entities into intent tool response
Some intents will return the states of affected entities in its response. If this option is enabled, they are also forwarded to the LLM. Usually they are not so important, and a simple response will also do the job. With one exception: the `HassGetState`, this is the intent specifically used to find entities matching certain criteria and return their states in the response. In fact, if this option is disabled, the `HassGetState` would not be exposed to the LLM at all.
* ### Tool selection
Select which PowerLLM tools the model may call. `HassGetState` is a normal selectable tool that always returns detailed states for matching entities, including entity IDs, attributes, aliases, area/floor, and time since the last state change. It can query both entities matching a requested state and those that do not match.

Please keep in mind that the state returned returned using this option contains more information and attributes, than the list in the prompt. So if you want your LLM to be able to answer questions like `how long have the lights been on?`, keep it enabled.
Assist controls its own tools and entity overview. The former options to include exposed entities in the prompt and attach entity states to every intent response have been removed. An upgrade preserves a previously disabled `HassGetState` in tool selection. Detailed state queries remain available as a separate tool call; Assist's control responses are unchanged.

* ### DuckDuckGo Region
The server location used for web and news search. You can safely leave it as `No Region`.

* ### Only allow referencing exposed entities in scripts
Power LLM includes a tool that allows LLM to write scripts in Home Assistant format and instantly execute them to handle more complex tasks than covered by standard intents. If this option is enabled, Power LLM will make an effort to verify that all entities referenced in this script are exposed. This process however has certain limitations (for example if the entity id is evaluated from template at runtime), so the script might fail this check more often than wanted.

When the script tool is enabled, its prompt includes a mapping of exposed entity IDs to names, with no states or other attributes. Disabling the tool removes this mapping. The mapping always includes only exposed entities, even when the script exposure restriction is disabled.

* ### Facts that the model remembers for each user
These field contain the facts that the LLM chose to remember about the user for each `user_id`. You can also ask LLM to remember something about you. This option is presented here in case you want to delete something.

## HTTP API

HTTP clients that previously fetched all tools from `/api/powerllm/powerllm` must also fetch `/api/powerllm/assist` and send each tool call to its owning API. These endpoints expose one API at a time. Conversation integrations selecting both APIs use Home Assistant's merged API, which prefixes tool names with their API namespace.

This is an extension of [Home Assistant REST API](https://developers.home-assistant.io/docs/api/rest/) providing LLM-specific endpoints, such as:

* GET `/api/powerllm`
Expand Down
19 changes: 18 additions & 1 deletion custom_components/powerllm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
from homeassistant.helpers.typing import ConfigType

from .api import PowerLLMAPI
from .const import CONF_MEMORY_PROMPTS, DOMAIN
from .const import (
CONF_INTENT_ENTITIES,
CONF_MEMORY_PROMPTS,
CONF_PROMPT_ENTITIES,
CONF_TOOL_SELECTION,
DOMAIN,
)
from .http import LLMToolsApiView, LLMToolsListView, LLMToolView
from .llm_tools import ( # noqa: F401
PowerLLMTool as PowerLLMTool,
Expand Down Expand Up @@ -61,6 +67,17 @@ async def async_migrate_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
entry, options=new_options, minor_version=2
)

if entry.version == 1 and entry.minor_version < 3:
new_options = dict(entry.options)
new_options.pop(CONF_PROMPT_ENTITIES, None)
if not new_options.pop(CONF_INTENT_ENTITIES, True):
selection = dict(new_options.get(CONF_TOOL_SELECTION, {}))
selection["HassGetState"] = False
new_options[CONF_TOOL_SELECTION] = selection
hass.config_entries.async_update_entry(
entry, options=new_options, minor_version=3
)

_LOGGER.debug(
"Migration to version %s:%s successful", entry.version, entry.minor_version
)
Expand Down
Loading
Loading