pydrawise.legacy

pydrawise.legacy

Client library for interacting with Hydrawise's REST API.

This library should remain compatible with https://github.com/ptcryan/hydrawiser.

LegacyHydrawise

LegacyHydrawise(user_token: str, load_on_init: bool = True)

Client library for interacting with Hydrawise v1 API.

This should remain (mostly) compatible with https://github.com/ptcryan/hydrawiser

Initializer.

Parameters:
  • user_token (str) –

    The API key to use for authenticating with the Hydrawise service.

  • load_on_init (bool, default: True ) –

    Whether to synchronously fetch controller info and status as part of initialization.

controller_id property

controller_id: int | None

Unique identifier of the current controller.

controller_info instance-attribute

controller_info: dict[str, Any] = {}

controller_status instance-attribute

controller_status: dict[str, Any] = {}

current_controller property

current_controller: dict

The raw JSON for the account's first (or only) controller.

Empty if no controller info has been loaded yet.

customer_id property

customer_id: int | None

Unique identifier of the authenticated customer account.

name property

name: str | None

Name of the current controller.

num_relays property

num_relays: int

Number of zones (relays) attached to the current controller.

relays property

relays: list[dict]

Raw JSON for each zone (relay) attached to the current controller.

Sorted by zone number.

relays_by_id property

relays_by_id: dict[int, dict]

Raw zone JSON keyed by each zone's unique relay id.

relays_by_zone_number property

relays_by_zone_number: dict[int, dict]

Raw zone JSON keyed by zone (relay) number.

running property

running: str | None

Raw JSON describing the zone that is currently running, if any.

sensors property

sensors: list[dict]

Raw JSON for the sensors attached to the current controller.

status property

status: str | None

Human-readable status string for the current controller (e.g. "All good!").

run_zone

run_zone(minutes: int, zone: int | None = None) -> dict

Starts or stops a zone's (or all zones') run cycle.

Parameters:
  • minutes (int) –

    Number of minutes to run for. If not positive, the zone(s) are stopped instead.

  • zone (int | None, default: None ) –

    Zone (relay) number to run or stop. If not specified, all zones on the current controller are run or stopped.

suspend_zone

suspend_zone(days: int, zone: int | None = None) -> dict

Suspends a zone's (or all zones') schedule for a number of days.

Parameters:
  • days (int) –

    Number of days to suspend for, starting now. If not positive, any existing suspension is cleared instead.

  • zone (int | None, default: None ) –

    Zone (relay) number to suspend. If not specified, all zones on the current controller are suspended.

update_controller_info

update_controller_info() -> bool

Refreshes controller info and status from the Hydrawise service.

LegacyHydrawiseAsync

LegacyHydrawiseAsync(user_token: str)

Bases: RestClient

Async client library for interacting with the Hydrawise v1 API.

This is for compatibility with previous pydrawise versions. Please prefer to use rest.RestClient instead.

Initializer.

Parameters:
  • user_token (str) –

    The API key to use for authenticating with the Hydrawise service.