Hubble SDK host-side tools
Project description
pyhubblenetwork
pyhubblenetwork is a Python SDK for communicating with Hubble Network devices over Bluetooth Low Energy (BLE) and securely relaying data to the Hubble Cloud. It provides a simple API for scanning, sending, and managing devices—no embedded firmware knowledge required.
Table of contents
- Quick links
- Requirements & supported platforms
- Installation
- Quick start
- CLI usage
- Configuration
- Public API (summary)
- Development & tests
- Troubleshooting
- Releases & versioning
Quick links
- PyPI:
pip install pyhubblenetwork - Hubble official doc site
- Hubble embedded SDK
Requirements & supported platforms
- Python 3.9+ (3.11/3.12 recommended)
- BLE platform prerequisites (only needed if you use
ble.scan()):- macOS: CoreBluetooth; run in a regular user session (GUI).
- Linux: BlueZ required; user must have permission to access the BLE adapter (often
bluetoothgroup). - Windows: Requires a compatible BLE stack/adapter.
Installation
Users (stable release)
pip install pyhubblenetwork
# or install CLI into an isolated environment:
pipx install pyhubblenetwork
Developers (editable install)
From the repo root (recommended):
cd python
python3 -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
Quick start
Scan locally, then ingest to backend
from hubblenetwork import ble, Organization
org = Organization(org_id="org_123", api_token="sk_XXX")
pkts = ble.scan(timeout=5.0)
if len(pkts) > 0:
org.ingest_packet(pkts[0])
else:
print("No packet seen within timeout")
Manage devices and query packets
from hubblenetwork import Organization
org = Organization(org_id="org_123", api_token="sk_XXX")
# Create a new device
new_dev = org.register_device()
print("new device id:", new_dev.id)
# List devices
for d in org.list_devices():
print(d.id, d.name)
# Get packets from a device (returns a list of DecryptedPacket)
packets = org.retrieve_packets(new_dev)
if len(packets) > 0:
print("latest RSSI:", packets[0].rssi, "payload bytes:", len(packets[0].payload))
Local decryption (when you have the key)
from hubblenetwork import Device, ble, decrypt
from typing import Optional
dev = Device(id="dev_abc", key=b"<secret-key>")
pkts = ble.scan(timeout=5.0) # might return a list or a single packet depending on API
for pkt in pkts:
maybe_dec = decrypt(dev.key, pkt)
if maybe_dec:
print("payload:", maybe_dec.payload)
else:
print("failed to decrypt packet")
CLI usage (optional)
If installed, the hubblenetwork command is available:
hubblenetwork --help
hubblenetwork ble scan
Configuration
Some functions read defaults from environment variables if not provided explicitly. Suggested variables:
HUBBLE_ORG_ID— default organization idHUBBLE_API_TOKEN— API token (base64 encoded)
Example:
export HUBBLE_ORG_ID=org_123
export HUBBLE_API_TOKEN=sk_XXXX
You can also pass org ID and API token into API calls.
Public API (summary)
Import from the package top-level for a stable surface:
from hubblenetwork import (
ble, cloud,
Organization, Device, Credentials, Environment,
EncryptedPacket, DecryptedPacket, Location,
decrypt, InvalidCredentialsError,
)
Key objects & functions:
Organizationprovides credentials for performing cloud actions (e.g. registering devices, retrieving decrypted packets, retrieving devices, etc.)EncryptedPacketa packet that has not been decrypted (can be decrypted locally given a key or ingested to the backend)DecryptedPacketa packet that has been successfully decrypted either locally or by the backend.Locationdata about where a packet was seen.ble.scanfunction for locally scanning for devices with BLE.
See code for full details.
Development & tests
Set up a virtualenv and install dev deps:
cd python
python3 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
Run linters:
ruff check src
Troubleshooting
ble.scan()finds nothing: verify BLE permissions and adapter state; try increasingtimeout.- Auth errors: confirm
Organization(org_id, api_token)or env vars are set; check token scope/expiry. - Import errors: ensure you installed into the Python you’re running (
python -m pip …). Preferpipxfor CLI-only usage.
Releases & versioning
- Follows SemVer (MAJOR.MINOR.PATCH).
- Tagged releases (e.g.,
v0.2.0) publish wheels/sdists to PyPI. - Release process: (add short steps for how to cut a release—tagging, CI release job, PyPI publish credentials).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyhubblenetwork-0.2.0.tar.gz.
File metadata
- Download URL: pyhubblenetwork-0.2.0.tar.gz
- Upload date:
- Size: 40.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
845347220c2ba3b292c750bb59815dec462c434d6ed97d817c4742085101e74e
|
|
| MD5 |
36ae00d7c944d3adb1871925b8404115
|
|
| BLAKE2b-256 |
4e49745274ef44f22822c54a3a28300478c4794b990717971de6666643e83a26
|
File details
Details for the file pyhubblenetwork-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyhubblenetwork-0.2.0-py3-none-any.whl
- Upload date:
- Size: 40.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcd112d54954da8d1ded2b874874626c160e5030e000e1d855341d99a78b52e0
|
|
| MD5 |
78f542bba2c367a54a21a3b39373f219
|
|
| BLAKE2b-256 |
463bd0678bfdd07494b28185e071bd251c7486a9dae988d005c1d850a1fc24a4
|