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

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.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 tinkly 0.2.1
File Size Uploaded Provenance Actions
tinkly-0.2.1.tar.gz 40.5 kB Without provenance Details for tinkly-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 52.3 kB

Release files / tinkly-0.2.1.tar.gz

Download URL tinkly-0.2.1.tar.gz
Size 40.5 kB
Tags Source
SHA-256 checksum
How to use checksums
62f3db7bb92e8fd027c444dbf994e49e6daa3565afdc6411bc22cc11a48192db
BLAKE2b-256 checksum
How to use checksums
98144ffa3ddcaddce7f8277fc03d580a66eba86db9b3f17e49c05416ff8f9df9
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.1-py3-none-any.whl

Download URL tinkly-0.2.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c103b7999dcadab38d1eea04fc5064d4ef0cb7cf2c8178454f0821cd8f45c289
BLAKE2b-256 checksum
How to use checksums
26f632d00fd6a3692234eaa0014b3039ff1bc54b00df4acfdaa1f4d0f7ac9b3b
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.1

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