Skip to main content

tinkly: a tiny interface to Twinkly v2 lights

I love the Twinkly lights but the xled library is filled with complicated cruft which obscures the actual communication layer, and seems to no longer be in development.

In particular, xled has a totally unnecessary ZMQ queue that slows everything down and prevents two clients from existing.

I re-implemented just the Twinkly communication part, and left all the other parts behind. In particular, there is no CLI - for that, you'll have to see my upcoming general project, "lyte".

Check out https://xled-docs.readthedocs.io/en/latest/ for more information about the API protocol.

Device communication

This package provides UDP discovery, authentication, HTTP endpoint access for generation 2 Twinkly lights.

from tinkly.client import TwinklyClient
from tinkly.discovery import discover
from tinkly.frame import send_frame

devices = list(discover(timeout=2.0))
client = TwinklyClient(host=devices[0].ip_address)
info = client.get('gestalt', authenticated=False).data
client.mac = str(info['mac'])
token = client.authenticate()

client.set_realtime_mode()
frame = bytes((255, 0, 0)) * int(str(info['number_of_led']))
send_frame(client.host, token.value, frame)
client.set_off_mode()

Frame buffers

lyte uses numpy, but I decided not to make that a dependency. Instead, we use Python's buffer protocol collections.abc.Buffer. The input is C-style unsigned bytes in RGB order, with three bytes per LED. Supported inputs include bytes, bytearray, array.array('B'), memoryview, and C-contiguous NumPy uint8 arrays.

The API

https://rec.github.io/tinkly/

Metadata

Release files for tinkly 0.2.2

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

Source distribution (sdist)

Source distribution for tinkly 0.2.2
File Size Uploaded Provenance Actions
tinkly-0.2.2.tar.gz 40.6 kB Without provenance Details for tinkly-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 52.6 kB

Release files / tinkly-0.2.2.tar.gz

Download URL tinkly-0.2.2.tar.gz
Size 40.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b6dcadb48bd56e56f6f1f57efb5bae608220c711ab5cc29a5793f10fe2a29ecd
BLAKE2b-256 checksum
How to use checksums
db6358b4dfa22182d44a3d36fe32d5b1a3f178f77c013fe18fb365f09c319a28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tinkly-0.2.2-py3-none-any.whl

Download URL tinkly-0.2.2-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a45e8a2f968f5078472aef8d2351d6b0caee9b0b7d97a126e8556138cdc24222
BLAKE2b-256 checksum
How to use checksums
350a437c9ac9fe281ca83d57b8d7f63b48d6fd6938fd819050f81a8ca87eca2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for tinkly 0.2.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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