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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ee_smarthub-0.3.0.tar.gz
  • Upload date:
  • Size: 20.8 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.3.0.tar.gz
Algorithm Hash digest
SHA256 1d7207c0a052dc1c1000f46576b1387eb428a874549e57414a22faf540ef6583
MD5 9576eb8f0a8b0d5731ff6132e291d1e9
BLAKE2b-256 f0af8dbc0aa119723bb2afd7602ac07aed5a25dfaaad80f3e25b85086adaf5e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ee_smarthub-0.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: ee_smarthub-0.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c46acb953a7128ee9aee65cf4d915cf109400716e0c37aef5aabb1fb348e379d
MD5 0cf2023115fd0b0dad0b8e36e792204a
BLAKE2b-256 a18b4727ce845671ac77e5028c4387b412c5554e5e1e16dfa3edd072e52a34c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ee_smarthub-0.3.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