Skip to main content

Python implementation of the KV4P-HT radio protocol: KISS framing, the KV4P vendor envelope, and the Kv4pRadio orchestrator (HELLO handshake, flow control, PTT, device state tracking).

Targets the v2.0.0.1 Android/FW17 protocol line.

Full documentation: https://petrkr.github.io/python-kv4p/

Install

pip install python-kv4p

Usage

from kv4p import Kv4pRadio
from kv4p.transports.serial import Kv4pSerialTransport

transport = Kv4pSerialTransport("/dev/ttyUSB0", 115200)
radio = Kv4pRadio(transport)
radio.on_rx_audio(...)
radio.on_sql(...)

with radio:
    # radio.freq_rx / .bandwidth / .squelch / ... are seeded from the
    # firmware's actual tuned state, reported in HELLO right after connect().
    radio.set_frequency(145.500, 145.500)
    radio.set_tx_allowed(True)
    radio.set_ptt(True)
    radio.send_tx_audio(payload)
    radio.set_ptt(False)

Kv4pRadio context manager calls connect()/disconnect() automatically. connect() hardware-resets the ESP32 over RTS/DTR and blocks until HELLO is received, since the firmware only sends it once at boot — this is also how the radio’s settings properties get their initial values, straight from the firmware’s own DeviceState. Operations that need the handshake (set_frequency, set_bandwidth, set_squelch, set_ctcss, set_ptt, send_tx_audio, …) raise RadioNotReadyError if called before that.

For tests or hardware-free runs, use kv4p.transports.dummy.DummyTransport, which answers reset() with a synthetic HELLO.

Layout

kv4p/
  __init__.py       # Kv4pRadio, vendor encode/decode
  state_tracker.py  # DeviceStateTracker: handshake, device state, settings, PTT
  flow_control.py   # FlowControlWindow: HTTP/2-like flow control
  constants/        # numeric/bit constants (kiss, vendor, messages)
  protocol/         # wire framing: kiss.py
  messages/         # one file per KV4P payload (dataclasses)
  transports/       # Kv4pTransport interface, serial + dummy implementations

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_kv4p-0.0.1.tar.gz (21.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_kv4p-0.0.1-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file python_kv4p-0.0.1.tar.gz.

File metadata

  • Download URL: python_kv4p-0.0.1.tar.gz
  • Upload date:
  • Size: 21.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_kv4p-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a70ffd9dd96ee21b113e308f1f8147625b799b56026cba028868831e51d564e0
MD5 64e110f3fd6c3ab09f8f597d83802e02
BLAKE2b-256 a1d0f460ff382ea4e637fa27e0e226e4d27f4a35194ee10811397c75f4abbfb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_kv4p-0.0.1.tar.gz:

Publisher: publish-pypi.yml on petrkr/python-kv4p

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_kv4p-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: python_kv4p-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for python_kv4p-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26ffbeda8730e61ca90e5e2eac263aac90e450f8d0d9cc60063f648dca172a86
MD5 401b61b6d5beef7987c5e3843bc9759b
BLAKE2b-256 0eb69a537bbf78899f9c4f22ba44fa1ae46d2897aea07d285936f5eba00f88da

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_kv4p-0.0.1-py3-none-any.whl:

Publisher: publish-pypi.yml on petrkr/python-kv4p

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 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