Agents and automation

A morning brief from Home Assistant: turning sensor data into sentences with a local LLM

The quality of the brief depends less on the model than on which values you put into the sentence.

A local LLM1 does not read live sensor values by itself. An automation therefore builds a sentence from sensor and calendar values, hands it to conversation.process, and sends the reply as a notification. This guide covers which values to include and how to handle failure.

Requirements and key details
  • A conversation model does not read live sensor values; the values must be carried in the sentence.
  • Handing a sentence to conversation.process makes the chosen agent produce the answer.
  • Take the reply into a variable, notify with it, and fall back to a fixed sentence on failure.

The model does not know the current state

A conversation model sees only what the sentence contains. It cannot know whether the room is 26 or 19 degrees, or whether a window is open. So a request for a summary has to carry the checked values inside the sentence.

Home Assistant's conversation.process hands that sentence to the chosen conversation agent and returns the reply. An automation can take that reply into a variable and use it as the notification text.

A small computer running a search system beside document stacks
The model builds the summary from the values written in the sentence.

Choosing the values to include

Five to eight values are enough: indoor temperature and humidity, yesterday's power use, open doors or windows, the first event of the day, air quality — only what you would use to judge the day.

Attach units to numbers and drop sensors that have no value. A blank invites the model to guess and produce an odd sentence.

Values worth putting in a morning brief
ValueWhere it comes fromWatch out
Indoor temperature and humidityTemperature and humidity entitiesInclude the unit
Yesterday's power useCumulative value from a power sensorSay whether it is a total or an instant
Open doors and windowsDoor and window entitiesLeave it out when absent
First event todayCalendar entityKeep the time and title only

Wiring it into an automation

Trigger on time, at the hour the household starts, such as 07:00. Add an action that builds the sentence, then conversation.process. When the reply comes back, send it as a notification.

Keep the sentence short. Putting the instruction and the values in one paragraph, such as 'use these values and tell me in three sentences what to prepare today', keeps the format steadier.

A person at a laptop is surrounded by connected document, spreadsheet, folder, image, settings, and robot panels
Cut the values to five or eight and pass them with units.

Instructions that keep the answer short

Set the sentence count and format in the agent's instructions: no greeting, three sentences, repeat the numbers as given, no lists. That suits a notification.

Longer instructions delay the first response. Keeping a separate agent for summaries, apart from the conversational one, is easier to manage.

Deciding what happens on failure

If the model server is down or the reply is empty, no notification arrives. Add a condition so an empty reply sends a fixed line such as 'the summary could not be built; check the sensor values'.

A week of notifications shows which values go missing often. Drop the sensors that frequently vanish, or find one that stands in for them.

An audio waveform displayed on a laptop beside a microphone
Keep a fixed sentence ready for when the reply is empty.

Terminology notes

  1. Large language model — A model trained on large text datasets to learn language patterns and process or generate text in context.

    Back to the text

Frequently asked questions

What should you check first in this article?
A local LLM does not read live sensor values by itself. An automation therefore builds a sentence from sensor and calendar values, hands it to conversation.process, and sends the reply as a notification. This guide covers which values to include and how to handle failure.