Skip to main content

hastty

PyPI 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

pip install hastty

(or pipx install hastty to keep it isolated from other Python environments)

To install from source instead — e.g. to contribute or track main — see CONTRIBUTING.md.

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.3

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.3
File Size Uploaded
hastty-0.1.3.tar.gz 18.0 kB Details

Built distribution (wheel)

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

Total release size:33.8 kB

Release files / hastty-0.1.3.tar.gz

Download URL hastty-0.1.3.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2f485b2790bdc0ba0a863528d4dfe67175bfca59213e107d1d80747296c3b2aa
BLAKE2b-256 checksum
How to use checksums
b9cef687554bc037cc96d85e2af3ddfe0bd25f8a65cbf5f2c7d4252e258d994b
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.3-py3-none-any.whl

Download URL hastty-0.1.3-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df44326d17a36d58273a7833b5b33bdfbec6f460d016d05350721234c1da6fa9
BLAKE2b-256 checksum
How to use checksums
1033b753708a28b91ca7ba6306f71a0d687445f20bc43db05b0b2a0c34638439
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

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

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