Skip to main content

Provider-based Dreo SDK with cloud support and local extension points.

Project description

pydreo-client

pydreo-client is now a provider-based Dreo SDK. The package still supports the original cloud-only usage, but the internal architecture has been rebuilt so we can add a real local module without duplicating client, device, and routing logic.

What Changed in v2

  • Added a formal pydreo/ package with clear core, cloud, and local boundaries.
  • Introduced a unified DreoClient facade that can orchestrate multiple providers.
  • Migrated cloud access into a CloudProvider with separate auth and HTTP transport layers.
  • Added a usable LocalProvider shell with config, discovery, protocol, and transport extension points.
  • Preserved the cloud compatibility import path: from pydreo.cloud.client import DreoClient.

Package Layout

pydreo/
  client.py            # Unified facade
  core/                # Shared models, strategy, registry, exceptions
  cloud/               # Cloud provider implementation
  local/               # Local provider shell and extension points

Installation

pip install pydreo-client

Usage

Cloud Only, Backward Compatible

from pydreo.cloud.client import DreoClient

client = DreoClient("USERNAME", "PASSWORD")
client.login()

devices = client.get_devices()
status = client.get_status("DEVICE_SN")
client.update_status("DEVICE_SN", power="on")

Unified Facade with Future Local Support

from pydreo import CloudConfig, ConnectionStrategy, DreoClient, LocalConfig

client = DreoClient(
    cloud_config=CloudConfig(username="USERNAME", password="PASSWORD"),
    local_config=LocalConfig(),
    strategy=ConnectionStrategy.LOCAL_PREFERRED,
)

devices = client.discover_devices()
state = client.get_device_state("DEVICE_SN")
result = client.set_device_state("DEVICE_SN", power="on")

Injecting a Local Transport During Development

from pydreo import DreoLocalClient, LocalConfig, LocalHostConfig
from pydreo.local.transport import InMemoryLocalTransport

client = DreoLocalClient(
    config=LocalConfig(
        known_hosts=(
            LocalHostConfig(host="192.168.1.20", serial_number="LOCAL-001", name="Desk Fan"),
        ),
    ),
    transport=InMemoryLocalTransport({"LOCAL-001": {"power": "on", "speed": 2}}),
)

devices = client.discover_devices()
state = client.get_device_state("LOCAL-001")

Extending the Local Module

The new local stack is deliberately composable:

  • LocalDiscoveryBackend is where LAN discovery or manual device seeding should live.
  • LocalTransport is where socket or protocol I/O should live.
  • LocalProtocolAdapter is where payload translation should live.
  • LocalProvider wires those pieces together and exposes the same contract as cloud.

That means the next local implementation can focus on protocol specifics without changing the public client surface again.

Development

Run the built-in unit tests with:

python3 -m unittest discover -s tests -v

License

Distributed under the MIT License. See LICENSE for more information.

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

pydreo_client-1.0.3rc0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

pydreo_client-1.0.3rc0-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file pydreo_client-1.0.3rc0.tar.gz.

File metadata

  • Download URL: pydreo_client-1.0.3rc0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pydreo_client-1.0.3rc0.tar.gz
Algorithm Hash digest
SHA256 dec35e05316fcdaed0e3c31373ea3f81730530d65a67856372ded5db54357ae4
MD5 701f34649d9a7fd2dd0fcbb4f83e9d63
BLAKE2b-256 65cacb90dd7ccd6834b1d379f4e60f964f74f10f36c824d24a2a0a5a89c662ef

See more details on using hashes here.

File details

Details for the file pydreo_client-1.0.3rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydreo_client-1.0.3rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 1412fe4df839f9c1191a001a938e1072311614e6c618279d6bf4ba86c92fb17d
MD5 aebdd648f2c570ae06aa733e4ca3c268
BLAKE2b-256 d95cd55692d5cb053193edeeac1adf54720fe35bdc40947fa3ffbf33fa3a3ef3

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