pydrawise.rest

pydrawise.rest

Asynchronous client library for interacting with Hydrawise's REST API.

RestClient

RestClient(auth: RestAuth)

Bases: HydrawiseBase

Async client library for interacting with the Hydrawise v1 REST API.

This should remain compatible with client.Hydrawise.

Initializer.

Parameters:
  • auth (RestAuth) –

    Handles authentication and transport.

next_poll instance-attribute

next_poll = timedelta(0)

delete_zone_suspension async

delete_zone_suspension(suspension: ZoneSuspension) -> None

Not supported by the Hydrawise v1 REST API.

Parameters:
Raises:
  • NotImplementedError

    always.

get_controller async

get_controller(controller_id: int) -> Controller

Not supported by the Hydrawise v1 REST API.

Parameters:
  • controller_id (int) –

    Unique identifier for the controller to retrieve.

Raises:
  • NotImplementedError

    always.

get_controllers async

get_controllers() -> list[Controller]

Retrieves all controllers associated with the currently authenticated user.

get_sensors async

get_sensors(controller: Controller) -> list[Sensor]

Not supported by the Hydrawise v1 REST API.

Raises:
  • NotImplementedError

    always.

get_user async

get_user(fetch_zones: bool = True) -> User

Retrieves the currently authenticated user.

Parameters:
  • fetch_zones (bool, default: True ) –

    When True, also fetch zones.

get_water_flow_summary async

get_water_flow_summary(controller: Controller, sensor: Sensor, start: datetime, end: datetime) -> SensorFlowSummary

Not supported by the Hydrawise v1 REST API.

Raises:
  • NotImplementedError

    always.

get_water_use_summary async

get_water_use_summary(controller: Controller, start: datetime, end: datetime) -> ControllerWaterUseSummary

Not supported by the Hydrawise v1 REST API.

Raises:
  • NotImplementedError

    always.

get_watering_report async

get_watering_report(controller: Controller, start: datetime, end: datetime) -> list[WateringReportEntry]

Not supported by the Hydrawise v1 REST API.

Raises:
  • NotImplementedError

    always.

get_zone async

get_zone(zone_id: int) -> Zone

Not supported by the Hydrawise v1 REST API.

Parameters:
  • zone_id (int) –

    The zone's unique identifier.

Raises:
  • NotImplementedError

    always.

get_zones async

get_zones(controller: Controller) -> list[Zone]

Retrieves zones associated with the given controller.

Parameters:
  • controller (Controller) –

    Controller whose zones to fetch.

resume_all_zones async

resume_all_zones(controller: Controller) -> None

Resumes the schedule of all zones attached to the given controller.

Parameters:
  • controller (Controller) –

    The controller whose zones to resume.

resume_zone async

resume_zone(zone: Zone) -> None

Resumes a zone's schedule.

Parameters:
  • zone (Zone) –

    The zone whose schedule to resume.

start_all_zones async

start_all_zones(controller: Controller, mark_run_as_scheduled: bool = False, custom_run_duration: int = 0) -> None

Starts all zones attached to a controller.

Parameters:
  • controller (Controller) –

    The controller whose zones to start.

  • mark_run_as_scheduled (bool, default: False ) –

    Whether to mark the zones as having run as scheduled.

  • custom_run_duration (int, default: 0 ) –

    Duration (in seconds) to run the zones. If not specified (or zero), will run for each zone's default configured time.

start_zone async

start_zone(zone: Zone, mark_run_as_scheduled: bool = False, custom_run_duration: int = 0) -> None

Starts a zone's run cycle.

Parameters:
  • zone (Zone) –

    The zone to start.

  • mark_run_as_scheduled (bool, default: False ) –

    Whether to mark the zone as having run as scheduled.

  • custom_run_duration (int, default: 0 ) –

    Duration (in seconds) to run the zone. If not specified (or zero), will run for its default configured time.

stop_all_zones async

stop_all_zones(controller: Controller) -> None

Stops all zones attached to a controller.

Parameters:
  • controller (Controller) –

    The controller whose zones to stop.

stop_zone async

stop_zone(zone: Zone) -> None

Stops a zone.

Parameters:
  • zone (Zone) –

    The zone to stop.

suspend_all_zones async

suspend_all_zones(controller: Controller, until: datetime) -> None

Suspends the schedule of all zones attached to a given controller.

Parameters:
  • controller (Controller) –

    The controller whose zones to suspend.

  • until (datetime) –

    When the suspension should end.

suspend_zone async

suspend_zone(zone: Zone, until: datetime) -> None

Suspends a zone's schedule.

Parameters:
  • zone (Zone) –

    The zone to suspend.

  • until (datetime) –

    When the suspension should end.