Skip to main content

hastty

Version License: MIT

A terminal (TUI) viewer for your Home Assistant dashboards — with keyboard shortcuts to trigger commands, no browser required.

hastty mirrors your existing Lovelace views (same views, same entities, same order) and lets you fire commands with the keyboard: toggle a light, run a scene, trigger a script or an automation — all from the terminal, with live state updates.

hastty showing the Living Room view, mirrored from Lovelace

Features

  • Mirrors your Lovelace dashboards — reuses the views and entities you already defined in Home Assistant, no separate dashboard to maintain.
  • Live state updates — subscribes to state_changed events, no polling, no manual refresh needed.
  • Keyboard-first — jump between views, move the selection, and fire commands, all without touching the mouse.
  • Custom global shortcuts — bind any key to a specific service call (e.g. a scene or script) directly from a config file.
  • Single dependency on your side: a Home Assistant Long-Lived Access Token. No add-on, no extra integration to install on the HA side.

Screenshots

Activating an entity — toggling switch.tv with Enter, state updates live:

Activating an entity: toggling switch.tv with Enter, live state update

Scenes view — a second Lovelace dashboard, switched to with the 2 key:

Scenes view, reached with the 2 key

Help screen — generic bindings plus the custom shortcuts from config.yaml:

Help screen listing generic bindings and custom shortcuts

(Captured against a local mock Home Assistant server, see tests/mock_ha_server.py — no real HA instance required to try it out.)

Installation

git clone https://github.com/jmleclercq/hastty.git
cd hastty
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Configuration

You need two things: the URL of your Home Assistant instance, and a Long-Lived Access Token (Home Assistant → your profile, bottom left → Security tab → "Long-lived access tokens" → Create Token).

The simplest option — environment variables:

cp .env.example .env
# edit .env: HA_URL=http://homeassistant.local:8123  and  HA_TOKEN=...

Or generate a config file with custom keyboard shortcuts:

hastty --init-config
# edit ~/.config/hastty/config.yaml

The token can stay in .env (recommended, never committed) even if you use the YAML file for shortcuts.

By default, only your default Lovelace dashboard is mirrored. If you use several dashboards and want all of them, set include_extra_dashboards: true under homeassistant: in config.yaml.

Run

hastty

Usage

Key Action
19 Jump directly to view N (in the order of your HA dashboards)
/ Previous / next view
/ Move the selection in the table
Enter / Space Activate the selected entity (toggle light/switch, run a scene/script, trigger an automation...)
r Refresh (re-syncs views and states)
? Help (also lists your custom shortcuts)
q Quit

Custom shortcuts

In config.yaml, under keybindings, you can define global keys (active from any view) that call a service directly — for example a scene or a script — without navigating to the entity first:

keybindings:
  - key: "g"
    description: "Good night (scene)"
    service: "scene.turn_on"
    target:
      entity_id: scene.good_night

  - key: "a"
    description: "Turn everything off (script)"
    service: "script.turn_on"
    target:
      entity_id: script.turn_everything_off

How it works

  • Connection: Home Assistant WebSocket API (/api/websocket), authenticated with a Long-Lived Access Token (hastty/client.py).
  • Dashboard mirroring: calls lovelace/config for your default dashboard (and, if include_extra_dashboards is enabled, every dashboard from lovelace/dashboards/list too). Cards (entities, glance, light, vertical-stack, grid, etc.) — whether under a classic top-level cards list or under the newer per-section sections layout used by the default dashboard editor since Home Assistant 2024.9 — are flattened into per-view lists of entity_id (hastty/lovelace.py). The app doesn't try to reproduce the visual layout of the cards, only the view → entities organization.
  • Commands: call_service over WebSocket, either through the generic per-domain action (Enter/Space on a selected entity) or through custom shortcuts (keybindings in the config).

Known limitations

  • area cards (without an explicit entity list) aren't resolved into individual entities yet.
  • The generic action (Enter/Space) calls a default service based on the entity's domain (toggle for light/switch/fan..., turn_on for scene/script, trigger for automation...); for a precise command with parameters (color, brightness, cover position...), use a custom shortcut with service_data.

Development

pip install -e .
python tests/test_integration.py     # end-to-end test against a mock HA server
python tests/capture_screenshots.py  # regenerate the SVG screenshots in assets/screenshots

See CONTRIBUTING.md for guidelines before opening a PR.

License

MIT

Release files for hastty 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hastty 0.1.1
File Size Uploaded
hastty-0.1.1.tar.gz 17.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hastty 0.1.1
File Interpreter ABI Platform
hastty-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size:33.0 kB

Release files / hastty-0.1.1.tar.gz

Download URL hastty-0.1.1.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e6197dcabbcc8e03c1a8358f212a9821b1efa0a02e99182aca1d29b153f51f86
BLAKE2b-256 checksum
How to use checksums
814c7ee47d97e5a36242fc9a3c55b4e0ba8de394618c4b1459e8979cb7c94794
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 12, 2026.

Transparency log

Release files / hastty-0.1.1-py3-none-any.whl

Download URL hastty-0.1.1-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27914120c49ff25ecb746af7e3a51e74ac2bfb2dd1cc28d81547c6f9a6d667a8
BLAKE2b-256 checksum
How to use checksums
8bc51bb8a7a6afc9e69da2802a81cca357aba49706ea35870eb0af029f80f7dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page