Skip to main content

Async Python client for querying connected devices on EE SmartHub routers via USP over MQTT WebSocket

Project description

EE SmartHub Client

Python async client library for interacting with EE SmartHub routers using the USP protocol over MQTT WebSocket.

Why This Library?

The EE SmartHub web interface is React-based and dynamically loads data via JavaScript, making traditional web scraping impractical. This library uses the router's native USP (User Services Platform) protocol providing:

  • Reliable data access - Won't break with UI changes
  • Efficient communication - Direct protocol access, not HTML parsing
  • Structured data - Clean, typed Python objects

Installation

pip install ee-smarthub

Usage

import asyncio
from ee_smarthub import SmartHubClient

async def main():
    client = SmartHubClient("192.168.1.1", "your-password")
    hosts = await client.get_hosts()
    for host in hosts:
        print(f"{host.name:30s} {host.ip_address:15s} {host.mac_address}")

asyncio.run(main())

Each Host object contains:

Field Type Description
mac_address str Physical (MAC) address
ip_address str IP address
hostname str DHCP hostname
user_friendly_name str User-assigned name (BT vendor extension)
name str (property) Best available name (user-friendly > hostname > MAC)
active bool Currently connected
interface_type str Connection type (e.g. "Wi-Fi", "Ethernet")
frequency_band str | None Wi-Fi band (e.g. "2.4GHz", "5GHz")
bytes_sent int Total bytes sent
bytes_received int Total bytes received

How It Works

The library implements the User Services Platform (USP) protocol defined by the Broadband Forum:

  1. Fetch serial number - HTTPS GET to {ROUTER_URL}/config.json
  2. Connect to MQTT - WebSocket connection to router on port 443
  3. Authenticate with router password
  4. Send USP request - Protobuf-encoded Get request for Device.Hosts.Host.*
  5. Parse response - Extract device parameters from protobuf response
  6. Disconnect - Close connection (short-lived connection model)

The connection is short-lived by design - simple, reliable, and efficient for typical polling intervals.

Development

Regenerating Protobuf Code

If the USP protocol specification is updated, regenerate the Python protobuf code:

./scripts/generate_proto.sh

This downloads the latest .proto files from the Broadband Forum repository and generates Python code using betterproto into src/ee_smarthub/proto/.

Security Considerations

The EE SmartHub uses a self-signed SSL certificate. This library disables certificate verification for HTTPS and WebSocket connections to communicate with the router, which means TLS connections are not fully verified.

Since the router is on your local network, exposure is limited. Ensure your local network is secure.

Compatibility

  • Python: 3.11+
  • Router: EE SmartHub
  • Protocol: USP

License

This project is licensed under the MIT License - see the LICENSE file for details.

Resources


Note: This is an unofficial client library and is not affiliated with or endorsed by EE Limited.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ee_smarthub-0.1.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ee_smarthub-0.1.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file ee_smarthub-0.1.0.tar.gz.

File metadata

  • Download URL: ee_smarthub-0.1.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for ee_smarthub-0.1.0.tar.gz
Algorithm Hash digest
SHA256 efa8a6711cd6f20688957792ad084f0394431fcb492173b52a3403a9776553ef
MD5 c354f7c2dd7671ea837723c46f75b8a5
BLAKE2b-256 5df104efa0c607c48c673415f1769664061c03f3f8a4cc878bcee86eb6179c2a

See more details on using hashes here.

File details

Details for the file ee_smarthub-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ee_smarthub-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for ee_smarthub-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e6fedc653f9140b7a7263d96f349e1a440134f77e05b50681cd710922e4fb36
MD5 2a80bc94337a74d1d939f739d481c771
BLAKE2b-256 3e6421f16a01a3320d60d76fc0038248ed0e77471c0dc81eaa0c11c45a8ac79e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page