Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

wbskt

Connect a Raspberry Pi, a script or a service to Wbskt. The client registers once with a policy PIN, holds a WebSocket open, sends readings and receives commands. It comes back on its own after a drop.

pip install wbskt

Python 3.10 or later. The only dependency is websockets. This is a 0.9 beta: the client protocol it speaks may still change before 1.0.

Quick start

import time
from wbskt import WbsktClient

def read_sensor():
    return 21.5

client = WbsktClient("greenhouse-sensor", policy_pin="483920")
client.on_message = lambda message: print("got", message.type, message.payload)
client.start()

while True:
    client.send("temperature", {"celsius": read_sensor()})
    time.sleep(10)

Get the PIN from a registration policy in the console (Policies). The first run registers the client and stores its credentials in your user data folder (~/.local/share/wbskt/<name>.json on Linux), so later runs sign in without registering again. If the policy needs approval, the client waits and connects once someone approves it in the console.

start() returns once the first connection attempt has finished; a failed one is retried in the background. The client runs on a daemon thread, so it stops when your script ends: keep the script running for as long as the client should stay connected. A script with nothing else to do calls client.run_forever() instead of start(), which blocks until Ctrl+C.

asyncio

import asyncio
from wbskt import AsyncWbsktClient

async def main():
    client = AsyncWbsktClient("greenhouse-sensor", policy_pin="483920")

    async def handle(message):
        print(message.type, message.payload)

    client.on_message = handle
    await client.start()
    await client.wait_first_attempt()  # optional: start() only begins connecting
    while True:
        await client.send("temperature", {"celsius": read_sensor()})
        await asyncio.sleep(10)

asyncio.run(main())

Both clients take the same options.

Commands

Tell the console which commands the client takes, and it offers them with a form:

from wbskt import Command, DataType, Parameter, WbsktClient

relay = Command("relay.set", "Switch the relay", [Parameter("on", DataType.BOOLEAN, is_required=True)])
client = WbsktClient("greenhouse-relay", policy_pin="483920", capabilities=[relay])

def handle(message):
    if message.type == "relay.set":
        set_relay(message.payload["on"])
        client.send("relay.state", {"on": message.payload["on"]})

client.on_message = handle

The SDK confirms delivery of a command as soon as it arrives, before your handler runs, and refuses one that arrives after its expiry without calling your handler. Report the outcome as a message of your own if it matters. Call set_capabilities(...) when the set of commands changes.

Version

Pass firmware_version="2.4.1" to say which version of your own code the client runs. The console shows it on the client page. It is not the SDK's version, which is sent for you.

State

client.report_state({"humidity": 41, "fan": "on"})

Send only what changed. Numbers are kept as readings and charted in the console.

While offline

send never blocks on the network. While disconnected, messages wait in memory (the last 1,000 by default, offline_buffer_size=) and go out in order, with the time they were made, once the connection is back. Workflows can tell those late readings from live ones.

Options

Option Default
api_url https://api.dev.wbskt.com A self-hosted install's https://api.<domain>.
socket_url wss://ws.dev.wbskt.com wss://ws.<domain>.
storage FileStorage.for_client(name) FileStorage(path), MemoryStorage(ref, secret), or your own object with load, save and clear.
capabilities none The commands the client takes.
offline_buffer_size 1000 Messages kept while offline; the oldest go first.

Handlers can be on_message(message), on_connected() and on_disconnected(). On WbsktClient they run on the client's background thread, so keep them short.

Messages are at most 64 KB, and types starting with sys., capabilities and state.report are reserved; send raises ValueError for either.

Protocol

The SDK implements the client protocol and its WebSocket binding: token reuse, jittered reconnects that honour Retry-After (up to an hour; a 429 without one backs off), ping answers and command acknowledgements. Read it to write a client in another language.

Metadata

Release files for wbskt 0.9.0b2

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

Source distribution (sdist)

Source distribution for wbskt 0.9.0b2
File Size Uploaded Provenance Actions
wbskt-0.9.0b2.tar.gz 20.8 kB With provenance Details for wbskt-0.9.0b2.tar.gz

Built distribution (wheel)

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

Total release size: 39.0 kB

Release files / wbskt-0.9.0b2.tar.gz

Download URL wbskt-0.9.0b2.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e2f9dbf65a2f24d83be59cad171b22df372d9040d18198b2baf703b58ebcfced
BLAKE2b-256 checksum
How to use checksums
8241200b16980273dd07314dab6f19488236801f87ffb028fd60e3a1cb2fad96
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 18, 2026.

Transparency log

Release files / wbskt-0.9.0b2-py3-none-any.whl

Download URL wbskt-0.9.0b2-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38ace12e6b68305e10b79a26e948eacc588f51afa9a48466a09870056a18b536
BLAKE2b-256 checksum
How to use checksums
dd30208dffdc210547d83157a75bec0c064e6ffac48fd5ea67ae0f8d80a34b20
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 18, 2026.

Transparency log

Security for wbskt 0.9.0b2

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 wbskt-0.9.0b2.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 18, 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