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.2rc0.tar.gz (20.3 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.2rc0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydreo_client-1.0.2rc0.tar.gz
  • Upload date:
  • Size: 20.3 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.2rc0.tar.gz
Algorithm Hash digest
SHA256 6fafcfbf03cdc7892b8c3e87feaa737051b30344d959d5932020bd1d7c006cec
MD5 b532c7e364272101f3121ad31f5299ca
BLAKE2b-256 7cd182ad002069c00751bab57459a0f42e736545302fefadc1aee414b070cc89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydreo_client-1.0.2rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 739adc0017a94a8ce82a4d93ef73dc3f2b2160d0a774fae662fcebafddea0500
MD5 a27f93b9485f9c1edaa3a23d9c79ba35
BLAKE2b-256 b77c36d245d1d6710e9cc125f4c54bba645aed5ce14cebee994bc1ad6cec93dc

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