I've been automating my home office with Home Assistant for a while now, and I'm going to share how it works in a short series of posts. From the very basic stuff to the part where an LLM runs parts of my house and I can talk with it from my phone.
Quick look at the setup first:…
Commit
007d05e
Starting with the boring but essential part: knowing if I'm actually in the room.
Everything else depends on it in my office: if presence is wrong, the lights go off while I'm sitting there, or the room stays lit for the cats 🐈.
The main sensor is an LD2410 mmWave radar wired…
Last commit was about presence detection, now the first thing it drives: the lights.
Two automations for that: presence goes on, lights on. Presence off for 5 seconds, lights off. Here's the "on" one, simplified:…
A short one this time: physical buttons for the music.
There's a smart speaker in my office. Reaching for the phone just to lower the volume gets is a no no, so I have cheap Zigbee devices on the desks: a small dimmer-style remote and a rotary knob. Both go through Zigbee2MQTT…
Sorry, this one took a bit longer than planned 😅 I mentioned house modes a couple of times already, so let's fix that debt. It's not really about the office, but almost every office automation depends on it.
I have one
input_select with four options: active, away, night,…This one is honestly the trick I like the mostt: when I walk out of my office, everything turns off. But when I walk back in I don't get some generic "office on" scene, I get exactly what I had when I left. Same light colors, same music, fan/heater at the same speed.
It all…
My 3D printer lives in the office, so of course it ended up wired into Home Assistant too. It's a Bambu Lab, the community integration exposes pretty much everything (state, progress, door, lights, events).
Small stuff first: power.
The printer is on a smart plug. A double…
The slightly over the top part of my office: the screens on my desk.
First an Awtrix, a small LED matrix clock running the open source Awtrix firmware. Out of the box it shows the time and its own sensors. I turned all of that off and push my own "apps" from Home Assistant…

Dashie for Home AssistantDashie for Home Assistant - Free Android Tablet Kiosk with VoiceA free alternative to Fully Kiosk for hosting Home Assistant dashboards on Android tablets — screensaver, motion wake, "Hey Dashie" voice, cameras, and Music Assistant. No account, no subscription.
Time to leave the office for a bit. The AC and the shutters cover the whole house, and I handed both over to an LLM.
Why not plain automations? Because AC rules get messy fast: season, time of day, indoor vs outdoor temperature, humidity, open windows, people sleeping... As classic conditions that's a lot of branches. An LLM handles "it's 27°C inside, 31°C outside, 65% humidity, the bedroom window is open, it's 23:00" pretty well if you give it the context and clear rules.
The tool is
A few things that matter:
The structure. Selectors constrain the output: the mode can only be one of five values, the temperature can't go below 20 or above 28. No parsing free text, no "set the AC to around 22 degrees maybe".
The context comes from Jinja macros in
ai_task.generate_data. You give it instructions and a structure, it returns data you can use directly. Mine uses OpenAI behind an ai_task entity.
The AC script, simplified:
yaml
- action: ai_task.generate_data data: task_name: Control Climate entity_id: ai_task.openai instructions: | {% from 'home.jinja' import house_layout, occupants, weather, area_status %} You manage the AC. Priorities: comfort, energy, air quality. Target ~24°C in summer, ~20°C in winter, 19-20°C at night. If a window is open, turn it off. ... ## House {{ house_layout() }} ## Rooms {{ area_status(include_humidity=true, include_windows=true) }} ## Outside {{ weather() }} structure: climate_mode: required: true selector: select: options: ["off", heat, cool, dry, fan_only] climate_temperature: required: true selector: number: { min: 20, max: 28 } climate_fan_speed: ... why_short: ... why: ... response_variable: decision - action: climate.set_temperature target: { entity_id: climate.house_ac } data: hvac_mode: "{{ decision.data.climate_mode }}" temperature: "{{ decision.data.climate_temperature }}"
custom_templates. house_layout describes rooms and floors, area_status lists each room with temperature, humidity, windows and shutters, weather gives the outdoor conditions. Both scripts share them.
Explain how the device actually works. A setpoint too close to the current temperature and the AC just doesn't blow anything. The unit decides between heating and cooling by comparing the setpoint to its own internal sensor, not the room average. So the prompt says it, and includes the current internal reading.
Always ask for a why. why_short (220 chars max) goes to a phone notification, the full why to a persistent notification in HA. When a decision looks weird, I can read the reasoning instead of guessing.
It runs every 30 minutes, at HA startup, and when a window has been open for a minute.
Shutters work the same way. The output is a string like cover.living:100,cover.bedroom:0 that I split and loop over with cover.set_cover_position. A few covers are excluded in the loop even if the model returns them.
If there's one thing to remember: let the LLM handle the fuzzy decisions, but keep the hard rules in YAML. A prompt is a suggestion, a selector or a filter in the loop is a guarantee.
And when I disagree with a decision, I can tell it. But that's another post.commit 007d05e
I told you I automated my office but I lied. Part of my house is also automated with @home-assistant and AI.
I don't even close the shutters myself 😂