
27 August 2026
Mistral AI and Home Assistant: developing a home assistant
“Turn on the living room light.” Behind this very simple sentence lies a complex process: the assistant must understand the request, identify the relevant device and execute the right action. With Mistral AI Conversation, I have developed a Python integration that connects Mistral AI's models to Home Assistant, the home automation platform I use for my personal infrastructure.
This project combines two topics that interest me: home automation and the integration of artificial intelligence services. It allows you to interact with a model from Assist, Home Assistant's assistant, and to give it access to the home automation tools selected in the configuration.
From natural language to concrete action
Let's take a usage example: asking Assist to turn on a lamp. Home Assistant then passes the conversation to my integration, which prepares the messages and the description of the available tools for Mistral. The model can then reply directly or request the execution of a tool with parameters, such as the name of the device to control.
This mechanism is called “tool calling”. The model formulates a structured request and Home Assistant remains responsible for validation and execution. The result is then sent back to Mistral so that it can construct its response to the user. The choice of exposed APIs and entities is therefore made in Home Assistant.

This separation of responsibilities is at the heart of the project: Mistral interprets the language, the integration adapts the exchanges between the two systems and Home Assistant manages the devices. It is also possible to disable the exposed APIs to use only the conversation.
An integration designed for Home Assistant
I used Mistral's official Python SDK and Home Assistant's native mechanisms. Network calls are asynchronous: while the remote service prepares its response, Home Assistant can continue processing its other tasks. The text arrives gradually, as a stream, which makes it possible to start displaying it before generation is complete.
Configuration is done through the interface: API key, model, instructions and accessible tools. Multiple agents can have their own settings on the same account. Discovering models and their capabilities also makes it possible to check the compatibility of requested options, such as images or reasoning.
Handling a response that arrives in chunks
Receiving text progressively is one thing; reconstructing a reliable action request is another. A tool call can arrive in several fragments, with incomplete JSON parameters. Several calls can also be interleaved in the same stream.
I therefore separated this logic into a dedicated component. It gathers the fragments of each call, reconstructs the parameters and rejects malformed requests before execution. This step makes it possible to reconcile the flexibility of a language model with the structured data expected by home automation.
Exchanges are also limited: at most 128 tools can be declared and a request cannot exceed 10 rounds of tool calls. These limits prevent a request from triggering an endless loop. However, they do not guarantee that a model will always choose the right action.
Testing difficult cases, not just the demonstration
A useful integration must also react correctly in the event of an expired API key, network failure or invalid response. The project distinguishes between these different situations in order to offer re-authentication, report unavailability or raise an understandable error.
Automated tests simulate Mistral's responses, including fragmented streams and tool calls. One scenario specifically verifies that a Home Assistant tool is called, and then that its result is fed back into the next request. These tests run without a real API key and without controlling a physical installation.
GitHub Actions brings together Python style and typing checks, tests with an 85% branch coverage threshold, as well as the HACS and Hassfest validations specific to the Home Assistant ecosystem. These checks help spot regressions and complement trials on a real installation.
Beyond conversation
The integration also offers AI tasks capable of producing structured data and accepts images or PDFs with compatible models. Voxtral voice features allow speech-to-text conversion and audio response generation within an Assist pipeline. Their availability depends on the model's capabilities and the Mistral account's access.
To facilitate installation and updates, the project is distributed via the HACS catalogue. It is an independent community integration, accompanied by documentation and a version history.
A cloud choice to make explicit
Home Assistant and the integration run locally, but processing by Mistral uses a remote API. Messages, relevant history, exposed tools and their results are transmitted to the service, as are the files or audio used by the corresponding features. One must therefore take into account the internet connection, the data sent and the API costs.
I recommend limiting exposed devices to what is actually needed, particularly when an action involves physical access. The value of this project also lies in connecting an AI service to an existing system while handling configuration, errors, testing and maintenance. It is this continuity between software development and operations that interests me.