Hi everyone,
I wanted to share a real-world Home Assistant experiment that I have been running in my office.
The goal is simple: when I am in the office, the room should automatically keep a comfortable light and temperature level. I prefer natural light first, and I do not like the AC making the room too cold. In practice that means:
- use presence detection to decide whether the office comfort mode should be active
- use light level and curtain position before turning on lights
- keep the office temperature around 26 C
- turn things down when I leave the office
- keep manual switches available, because I still want a local fallback
The interesting part is that I am not only using Home Assistant automations. I am using Codex on my M1 Pro as a natural-language operating and debugging layer on top of Home Assistant.
My current setup
- Home Assistant as the local control layer
- Codex running on my Mac / M1 Pro
- Zemismart MT25B curtain motor
- screen display switch for manual control and status
- two human presence sensors
- one temperature and humidity sensor
- light level sensors
- light switches and AC exposed in Home Assistant
Here is the office dashboard I use while tuning the behavior:
The dashboard gives me one place to see:
- temperature and humidity
- desk-side and window-side illuminance
- two presence sensors
- AC mode and target temperature
- light switch groups
- curtain controls
- quick office modes
How the comfort logic works
The automation is built around a feedback loop rather than a single scene.
- Presence activates comfort mode
When either presence sensor detects that I am in the office, the room is allowed to adjust itself. This is important because I do not want the office reacting in the same way when nobody is inside.
- Home Assistant reads the real room state
Before making changes, I check the values in Home Assistant:
- current temperature
- humidity
- illuminance near my seat
- illuminance near the window
- current AC mode and setpoint
- light switch state
- curtain position
- Natural light comes first
My preference is not to turn on lights immediately. If there is enough daylight, the system should use the curtain motor first. If the seat area is still too dark after curtain adjustment, then the lights can be used.
- Cooling should be gentle
I originally found the office getting too cold. So the comfort target is closer to 26 C instead of a colder cooling preset. That made the office feel much more comfortable during normal work.
- Away mode reduces unnecessary control
When I am away, the office can turn off lights and reduce or stop active cooling. This keeps the automation from wasting energy.
How I operate it with Codex
The practical workflow looks like this:
Step 1: I open the Home Assistant office dashboard
I start by checking the actual room state in Home Assistant. I look at the temperature, humidity, lux, presence sensors, AC setpoint, lights and curtain position.
Step 2: I describe the comfort problem to Codex
Instead of manually thinking through every entity each time, I tell Codex what I feel in natural language. For example:
I feel cold. Keep my office around 26 C.
or:
Use natural light first. Do not turn on the lights unless the seat area is still too dark.
or:
When I am not in the office, turn off the lights and stop active cooling.
Step 3: Codex checks the Home Assistant state
Codex helps me inspect the current HA entities and compare them with what the dashboard shows. This is useful because the biggest problems are often not the automation idea itself, but small mismatches:
- the wrong switch entity is shown on the dashboard
- a sensor is not updating as frequently as expected
- the AC entity reports an unexpected value
- a light or curtain control is available in HA but not placed where I can use it quickly
Step 4: I tune the behavior in small steps
I do not try to build the perfect automation in one pass. I tune one behavior at a time:
- first make presence detection reliable
- then make the dashboard show the right sensor values
- then set the AC target around 26 C
- then adjust curtain positions for natural light
- then decide when lights should turn on
- then add a simple away behavior
Step 5: I verify it in the actual room
After each change, I look at the HA dashboard and also judge the room physically. If the room still feels cold, I change the target. If the desk is too bright or too dark, I adjust the curtain/light behavior.
That feedback loop is the part I like most. Codex makes it faster to iterate, but Home Assistant remains the actual local control system.
Curtain control
The curtain motor is important because it lets the system change the room before using artificial light. In my setup, the curtain can be opened, stopped, closed, or moved to a target position from the dashboard.
Why I find this useful
For me, this setup is useful because it combines three things:
- Home Assistant gives reliable local control.
- Sensors provide real room context.
- Codex helps me operate, debug and refine the logic conversationally.
It feels different from a fixed automation because I can say what I want in human terms, check what Home Assistant is actually seeing, and then adjust the logic quickly.
What I am still improving
- better illuminance thresholds for different times of day
- better handling when a sensor does not update frequently
- a cleaner way to express comfort rules as reusable scenes
- better fallback behavior when one device is unavailable
- avoiding too many rapid device commands
I am curious how others are building similar adaptive comfort modes in Home Assistant.
Do you prefer doing this with pure YAML automations, Node-RED, templates, Assist/voice, or an external AI agent connected to Home Assistant?






