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

from wbskt import WbsktClient

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

client.send("temperature", {"celsius": 21.5})

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.

To keep a script running until Ctrl+C, call client.run_forever() instead of start().

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()
    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, ping answers and command acknowledgements. Read it to write a client in another language.

Metadata

Release files for wbskt 0.9.0b1

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.0b1
File Size Uploaded Provenance Actions
wbskt-0.9.0b1.tar.gz 16.8 kB With provenance Details for wbskt-0.9.0b1.tar.gz

Built distribution (wheel)

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

Total release size: 32.7 kB

Release files / wbskt-0.9.0b1.tar.gz

Download URL wbskt-0.9.0b1.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5f0a1f5089fa0130da1faa21666ab7c99d492484835100e0bb89ad1eacacea3a
BLAKE2b-256 checksum
How to use checksums
82dc583ade692ceea671a0b3dcdd8ebc148527ad3e97ac82f1b8ac5cda521021
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 9, 2026.

Transparency log

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

Download URL wbskt-0.9.0b1-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37184cb9e99978a4313e50c620688fd17b28685039c450017a2994ad31c931b3
BLAKE2b-256 checksum
How to use checksums
5a6a15d7c7697e3ed3e3c684eea51f584ad38f7f3475399ac1ad1e607ba53d21
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 9, 2026.

Transparency log

Security for wbskt 0.9.0b1

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.0b1.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 9, 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