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

PyPI Python License: MIT

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

The client requires an aiohttp.ClientSession, allowing callers to manage session lifecycle.

import asyncio
import aiohttp
from ee_smarthub import SmartHubClient

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

asyncio.run(main())

Validating Credentials

To check that the router is reachable and the password is correct without fetching device data:

async with aiohttp.ClientSession() as session:
    client = SmartHubClient("192.168.1.1", "your-password", session)
    await client.validate_connection()  # raises on failure

This performs an HTTP fetch and MQTT connect/disconnect.

Host Fields

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.2.0.tar.gz (20.7 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.2.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ee_smarthub-0.2.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ee_smarthub-0.2.0.tar.gz
Algorithm Hash digest
SHA256 94062f53af6262cf455086889564f2f89d902d0705aa09765d1a495e330b56cb
MD5 c02dabfd8f7ca12f52830b2f9ad7dff6
BLAKE2b-256 ac870e916bc91422e4964a422c65d443701d104746000b749c13ed7f9569ddcd

See more details on using hashes here.

Provenance

The following attestation bundles were made for ee_smarthub-0.2.0.tar.gz:

Publisher: publish.yml on conor-mccann/ee-smarthub-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: ee_smarthub-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ee_smarthub-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be9680eb2dca45bd8ebdf25b63b485093849bee6a4bc854ff235fa831487f8e2
MD5 309bcfba34cabad009de3f1e1bd87f03
BLAKE2b-256 5e1230e4ac43725a593f16c45a56f8bb7ec389cc7492870641c076906d17ebc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for ee_smarthub-0.2.0-py3-none-any.whl:

Publisher: publish.yml on conor-mccann/ee-smarthub-client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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