Home Assistant REPL
A REPL shell custom designed for Home Assistant custom component developers, tinkerers and native Python speakers. Makes it easy as pie!
It is an opinionated REPL (Read-Eval-Print-Loop) shell that aims are to make it easier without any configuration to:
- Exploring of the APIs in context of a live working instance
- Trialling out snippets of code
- Debugging code (but see note below)
- Hotfixing issues that don't have built in support to do so from existing components.
$ uvx --from homeassistant-repl ha-repl --token=<insert token here>
Home Assistant REPL (API client mode) connected to ws://homeassistant.local:8123/api/websocket. `obj` only, read-only - no `hass`. Ctrl-D to exit.
>>> obj["/mqtt/binary_sensor/kitchen_terrace_window_tilt"].state
'off'
>>> [o.name for o in obj["/rflink/binary_sensor"].values() if o.state=='unavailable']
['Shed Intruder Alarm', 'Panic Keyfob']
>>> {(o.entity_id, o.state) for o in obj.find(domain="binary_sensor",platform="mqtt")}
{
('binary_sensor.terrace_pir_occupancy', 'unavailable'),
('binary_sensor.scullery_smoke_alarm_battery_low', 'off'),
('binary_sensor.kitchen_terrace_window_tweaked', 'off'),
('binary_sensor.scullery_water_detector_water_leak', 'dry'),
('binary_sensor.boiler_co_detector_battery_low', 'off'),
('binary_sensor.pantry_sensor_occupancy', 'off')
}
>>>
If you're not already comfortable using Python tools to manipulate data on the fly, or better REPL shells in other languages, this is a great way to learn, and faster at the keyboard than clicking around Jupyter notebooks.
This is primarily for developers of custom components, and their LLM agents, though may be of interest for other folk tinkering with Home Assistant. It is a potentially sharp tool, so NOT appropriate for general Home Assistant users.
Features
- Easy
ipythonstyle help using?for help and??for source code, matched to the correct version tag - Integrated with
richandpygmentsfor pretty object printouts and stack traces - Reuses session and history features from
prompt-toolkit - Access to all entities via an Object Tree dictionary like interface
- Multi-line editing, with a whole statement or block per history entry - Up brings back the complete
forloop, to edit any line of it - Tab completion that runs nothing, including
objpaths and entity ids, and in live mode what's inside Home Assistant, with the signature of the call being typed - IPython style
thing?help, andthing??for a link to its source on GitHub at the version running - Integrated with homeassistant-api as
hass_apiobject - Auto-awaits coroutines for easy shell use (can be switched off or overridden)
- Dedicated shell that can be run without installation with
uv - Add in your own plugins or package up a plugin with your component to help other developers
- Usable from inside
ipythonshell, Marimo notebooks or plainpython -m asyncio
All of the above works with standard Home Assistant APIs, referred to as api mode.
Home Assistant REPL also has an advanced live mode that taps directly into a live Home Assistant using an optional server component available via HACS.
Get started with a single line at Quick Start
Advanced Modes
These modes require a custom component to be installed on the target Home Assistant server via HACS, or use the supplied scripts to install on a local devcontainer. It adds:
- Full access to the core Home Assistant Python API via
hass - Read/write access to the actual objects, e.g. entities and their helpers
- Agent friendly non-interactive mode using Exec Mode
- A frisson of danger
Future Developments
See the Roadmap for where this might go, and your feedback welcome.
!!! note It is not intended to ever be a replacement for a Python debugger, although it may complement one. It also does not intend to replicate PyScript, instead focusing on standard python (PyScript uses MicroPython) even at expense of general usability or home assistance access, and not a general automation script execution service. For most non-developer cases, homeassistant-cli is a better choice, with pre-packaged access to devices, entities, services etc.
Home Assistant's Debug Console
Home Assistant 2026.11 added its own browser-based Python console, the Debug console. See Debug Console for how it compares, and which suits what.
Agent Support
For coding agents, there is Exec Mode and a marketplace skill.
Other Python REPLs
These are all current with Python v3, there are others like dreampie that didn't make it past Python 2.
### Out of the Box
- Home Assistant Debug console - browser console inside Home Assistant itself, from 2026.11 - see comparison
- Python Interactive Mode - Core python REPL, greatly enhanced in v3.13 with PyPi code, and now the default Python terminal experience.
- VSCode Python REPL - Notebook style with Intellisense, bundled with the standard Microsoft VSCode Python bundle
Classics
- Terminal iPython - Progenitor of Jupyter notebooks, rich formatting, syntax help, shell integration etc
- ptpython - Syntax help and formatting, mouse support and more. Part of the prompt-toolkit project, also used by Home Assistant REPL.
- IDLE - the original Python Foundation enhanced shell, colourized text, multi-window etc
Others
- nrepl-python - based on the Clojure
nreplprotocol, a simpler alternative to LSP - bpython - Syntax help, auto-complete, improved history
- xon.sh - python-centric shell
Metadata
Release files for homeassistant-repl 0.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| homeassistant_repl-0.14.0.tar.gz | 75.5 kB | With provenance | Details for homeassistant_repl-0.14.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| homeassistant_repl-0.14.0-py3-none-any.whl | Python 3 | none | any | Details for homeassistant_repl-0.14.0-py3-none-any.whl |
Total release size: 159.0 kB
Release files / homeassistant_repl-0.14.0.tar.gz
| Download URL | homeassistant_repl-0.14.0.tar.gz |
|---|---|
| Size | 75.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
709e2ca59f4a34f32a757df92e503bd617678bf67189d6e88746aab1f9f3bb6d
|
|
BLAKE2b-256 checksum How to use checksums |
9f35d4b72a1864df2096ef791911b25ea4e0d9da250c809d051dc3020ed83000
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logRelease files / homeassistant_repl-0.14.0-py3-none-any.whl
| Download URL | homeassistant_repl-0.14.0-py3-none-any.whl |
|---|---|
| Size | 83.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89646e752cb924c740a7bfd5be42a64344eb48f72071e3dc7e87b0817fbcf0f5
|
|
BLAKE2b-256 checksum How to use checksums |
996aafd9ed80224e0392e21faf5c641e39551c54c20dc6bd3aa297d90d033354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logSecurity for homeassistant-repl 0.14.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for homeassistant_repl-0.14.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.