Skip to main content

pybrilliantkiosk

Typed, fully async Python library for managing Brilliant smart panels that run the brilliant-ha-kiosk firmware add-on. It is the only code that talks to a panel; the Home Assistant integration builds on it.

  • asyncssh for SSH (password or private key, host-key pinning), no blocking I/O
  • aiohttp for GitHub releases; you inject the ClientSession
  • mypy --strict clean, ships py.typed
  • Python 3.13 or newer; published to PyPI by CI with trusted publishing from the tag pybrilliantkiosk-v<version> (pip install pybrilliantkiosk)
from pybrilliantkiosk import Panel, Releases

async with Panel("192.168.1.50", password="...", host_key=None) as panel:
    print(panel.host_key_fingerprint)  # pin this in the config flow
    snapshot = await panel.poll()  # health, settings, drift and setup status: ONE SSH command
    health = snapshot.health
    env = await panel.get_env()  # secrets masked
    await panel.set_env({"DAY_LEVEL": "12"}, restart=True)
    print(await panel.logs("ha-kiosk", 100))

client = Releases(session)
stable = await client.latest_stable()  # the release GitHub marks "Latest"
# Verify against a hash and size you keep yourself (streamed, capped at 50 MiB) ...
bundle, sha = await client.download(stable, sha256=PINNED_SHA256, size=PINNED_SIZE)
await panel.install(bundle, sha, size=PINNED_SIZE)
# ... or, weaker, against the release's own .sha256 asset: client.download(release)

What it does

Area API
Connect Panel(host, password=..., private_key=..., username="root", port=22, host_key="SHA256:..."), used as an async context manager. fetch_host_key(host, port=22) reads a panel's host key fingerprint before any credentials are sent.
Poll Panel.poll() returns a PanelSnapshot (health, effective settings, settings drift, ha-kiosk-setup status) with one SSH command. Panel.health() for health only.
Settings get_env(), set_env(changes, delete=(), restart=False), env_drift(), reconcile_env(), check_env(text). Both copies of kiosk.env on the panel are kept in step; keys are validated against the installed ha-kiosk-setup's allow-list.
Services restart(unit), start(unit), stop(unit), logs(unit, lines=100), reboot(). UNITS lists the kiosk's systemd units.
Identity identity() returns PanelIdentity(device_id, room) from the stock firmware's message bus; works with or without the kiosk. device_id() returns the id alone.
Brilliant bus bus_peripherals(), bus_get(peripheral), bus_set(peripheral, values).
Install install(bundle, sha256, size=None, env=None, token=None) verifies the bundle, runs ha-kiosk-setup install --detach and waits for it (env and token only for a first install); setup_command(cmd) for reapply, enable, disable, rollback, uninstall or purge; setup_status(), setup_diagnostics().
Releases Releases(session): list(), latest_stable(), download(release, sha256=None, size=None) (streamed, capped at 50 MiB). parse_version() / is_newer() order stable and nightly bundle versions.
Bundles kiosk_env_from_bundle(bundle, overrides) renders a first-install kiosk.env from the bundle's own example, validated against the bundle's ha-kiosk-setup.

Pin the host key before any credentials are sent, and read the panel's identity (works with or without the kiosk installed):

from pybrilliantkiosk import fetch_host_key

info = await fetch_host_key("192.168.1.50")
print(info.sha256)  # show this to the user, pin it once confirmed

async with Panel("192.168.1.50", password="...", host_key=info.sha256) as panel:
    who = await panel.identity()  # PanelIdentity(device_id=..., room="Kitchen")

set_env and reconcile_env hold the panel's setup lock, refuse (InvalidArgument, naming the keys, nothing written) when the running kiosk.env has a value that cannot be written safely instead of reverting it, and abort if kiosk.env changed on the panel since it was read (ConcurrentModification, retried once). A command that times out is killed on the panel and raises CannotConnect.

Errors: CannotConnect, AuthFailed, HostKeyMismatch, CommandFailed(exit_status, stderr), InvalidArgument, ChecksumMismatch, ConcurrentModification, ReleaseError; all derive from PanelError:

Exception Meaning
CannotConnect No connection, or a command timed out.
AuthFailed Password or key rejected.
HostKeyMismatch The panel's host key differs from the pinned fingerprint.
CommandFailed(exit_status, stderr) A remote command failed.
InvalidArgument A key, value, unit name or fingerprint the library refuses (also a ValueError).
ChecksumMismatch A downloaded bundle did not match its hash or size.
ConcurrentModification kiosk.env changed on the panel during a write.
DeviceIdUnavailable The Brilliant device id could not be read (the stock bus is restarting).
ReleaseError GitHub release listing or download failed.
SetupError and its subclasses VerificationFailed, SettingsRejected, ActivationRolledBack, StockUIRestored, NotInstalled, SetupBusy ha-kiosk-setup exit codes 3, 4, 5, 6, 7 and 8.

Host key pins accept SHA256:... fingerprints only; is_md5_fingerprint() lets a caller explain why an MD5 pin is refused.

Development

cd lib/pybrilliantkiosk
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
ruff check . && ruff format --check . && mypy --strict src && pytest  # 100 % coverage gate

Source, issues and changelog: github.com/MikeI-Code/brilliant-ha-kiosk/tree/main/lib/pybrilliantkiosk, issues, CHANGELOG. Apache License 2.0.

Metadata

Release files for pybrilliantkiosk 0.1.7

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

Source distribution (sdist)

Source distribution for pybrilliantkiosk 0.1.7
File Size Uploaded Provenance Actions
pybrilliantkiosk-0.1.7.tar.gz 170.7 kB With provenance Details for pybrilliantkiosk-0.1.7.tar.gz

Built distribution (wheel)

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

Total release size: 222.2 kB

Release files / pybrilliantkiosk-0.1.7.tar.gz

Download URL pybrilliantkiosk-0.1.7.tar.gz
Size 170.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d00d518ee54690a7f813c6348a83f46c8a817084908d8ee908ee862fbc2bc7ad
BLAKE2b-256 checksum
How to use checksums
abe058f928bf79e8b851da15ab2bdda573c0ce08ef23c802ad817cb6ef9af70d
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 Nov 24, 2026.

Transparency log

Release files / pybrilliantkiosk-0.1.7-py3-none-any.whl

Download URL pybrilliantkiosk-0.1.7-py3-none-any.whl
Size 51.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89128321f6807c0efe4c7eb05f7e44610b36bc01f6e7d897f3e0afb63db6b86d
BLAKE2b-256 checksum
How to use checksums
5761e7d485f5f94b6f6ca9557a6980f802d78308b198a7a9d9c2f88f21ab6588
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 Nov 24, 2026.

Transparency log

Security for pybrilliantkiosk 0.1.7

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.

Select from 2 files

Attestation for pybrilliantkiosk-0.1.7.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 Nov 24, 2026.

Transparency log

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

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