Codex for Home Assistant: let Codex CLI work on your HA config from scripts, automations, and Assist

Hi everyone,

I wanted to share a project I’ve been building: Codex for Home Assistant.

It connects Home Assistant to OpenAI Codex CLI, so you can start a Codex task from Home Assistant and let it work directly against your HA config folder. The idea is to make it possible to ask for things like:

  • “Check why this automation is failing”
  • “Inspect my dashboards for broken cards”
  • “Create a script that does X”
  • “Review this YAML/config change”
  • “Help me debug this integration issue”

Here’s an example using Home Assistant Assist to ask Codex to update a dashboard card:

And here’s the persistent notification after Codex completed the task:

The project has two parts:

  • A Home Assistant app/add-on that runs Codex CLI with access to /config
  • A custom integration that exposes Home Assistant actions and entities

Once installed, you can start Codex tasks from actions, scripts, automations, or Assist/LLM flows. Tasks run non-interactively, logs/results are saved under /config/codex_tasks, and the integration exposes sensors for auth status, active tasks, latest task state, and whether Codex is currently running.

A few things I focused on:

  • No exposed LAN port; the app UI uses Home Assistant Ingress
  • Internal worker API token is managed automatically
  • Codex sign-in uses device-code auth with a Home Assistant persistent notification
  • If Codex needs input, Home Assistant can continue the task with a reply action
  • Works with prebuilt images for amd64 and aarch64
  • Installable as an app/add-on repository plus HACS custom integration

Codex CLI sign-in uses your ChatGPT/OpenAI account. It may work with a free ChatGPT account, but ChatGPT Plus or higher is recommended for more reasonable usage limits. This project does not use OpenAI API keys for Codex tasks (so not "surprise" token costs).

Important security note: this is intentionally powerful. The worker gets read/write access to your Home Assistant config folder, because the whole point is for Codex to be able to inspect and edit HA configuration. So this is best suited for users who are comfortable with that level of access and who review changes carefully.

GitHub repo and installation instructions:

I’d love feedback from anyone interested in AI-assisted Home Assistant maintenance, debugging, dashboard editing, or automation generation. Suggestions, feature ideas, and real-world testing are very welcome.