pydrawise
pydrawise
API for interacting with Hydrawise sprinkler controllers.
Auth
Auth(username: str, password: str)
Bases: BaseAuth
Authentication support for the Hydrawise GraphQL API.
Initializer.
| Parameters: |
|
|---|
check
async
check() -> bool
Validates that the credentials are valid.
check_token
async
check_token()
Checks a token and refreshes if necessary.
token
async
token() -> str
Retrieves an authentication token for the current user.
Error
Bases: Exception
Base error class.
Hydrawise
Hydrawise(auth: Auth, app_id: str = DEFAULT_APP_ID)
Bases: HydrawiseBase
Client library for interacting with Hydrawise sprinkler controllers.
Should be instantiated with an Auth object that handles authentication and low-level transport.
Initializes the client.
| Parameters: |
|
|---|
delete_zone_suspension
async
delete_zone_suspension(suspension: ZoneSuspension) -> None
Removes a specific zone suspension.
Useful when there are multiple suspensions for a zone in effect.
| Parameters: |
|
|---|
get_controller
async
get_controller(controller_id: int) -> Controller
Retrieves a single controller by its unique identifier.
| Parameters: |
|
|---|
get_controllers
async
get_controllers(fetch_zones: bool = True, fetch_sensors: bool = True) -> list[Controller]
Retrieves all controllers associated with the currently authenticated user.
| Parameters: |
|
|---|
get_sensors
async
get_sensors(controller: Controller) -> list[Sensor]
Retrieves sensors associated with the given controller.
| Parameters: |
|
|---|
get_user
async
get_user(fetch_zones: bool = True) -> User
Retrieves the currently authenticated user.
| Parameters: |
|
|---|
get_water_flow_summary
async
get_water_flow_summary(controller: Controller, sensor: Sensor, start: datetime, end: datetime) -> SensorFlowSummary
Retrieves the water flow summary for a given sensor.
| Parameters: |
|
|---|
get_water_use_summary
async
get_water_use_summary(controller: Controller, start: datetime, end: datetime) -> ControllerWaterUseSummary
Calculate the water use for the given controller and time period.
| Parameters: |
|
|---|
get_watering_report
async
get_watering_report(controller: Controller, start: datetime, end: datetime) -> list[WateringReportEntry]
Retrieves a watering report for the given controller and time period.
| Parameters: |
|
|---|
get_zone
async
get_zone(zone_id: int) -> Zone
Retrieves a zone by its unique identifier.
| Parameters: |
|
|---|
get_zones
async
get_zones(controller: Controller) -> list[Zone]
Retrieves zones associated with the given controller.
| Parameters: |
|
|---|
resume_all_zones
async
resume_all_zones(controller: Controller) -> None
Resumes the schedule of all zones attached to the given controller.
| Parameters: |
|
|---|
resume_zone
async
resume_zone(zone: Zone) -> None
Resumes a zone's schedule.
| Parameters: |
|
|---|
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: |
|
|---|
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: |
|
|---|
stop_all_zones
async
stop_all_zones(controller: Controller) -> None
Stops all zones attached to a controller.
| Parameters: |
|
|---|
stop_zone
async
stop_zone(zone: Zone) -> None
Stops a zone.
| Parameters: |
|
|---|
suspend_all_zones
async
suspend_all_zones(controller: Controller, until: datetime) -> None
Suspends the schedule of all zones attached to a given controller.
| Parameters: |
|
|---|
suspend_zone
async
suspend_zone(zone: Zone, until: datetime) -> None
Suspends a zone's schedule.
| Parameters: |
|
|---|
update_master_valve
async
update_master_valve(controller: Controller, zone: Zone) -> None
Updates the controller's master valve.
| Parameters: |
|
|---|
HydrawiseBase
Bases: ABC
Base class for Hydrawise client APIs.
delete_zone_suspension
abstractmethod
async
delete_zone_suspension(suspension: ZoneSuspension) -> None
Removes a specific zone suspension.
Useful when there are multiple suspensions for a zone in effect.
| Parameters: |
|
|---|
get_controller
abstractmethod
async
get_controller(controller_id: int) -> Controller
Retrieves a single controller by its unique identifier.
| Parameters: |
|
|---|
get_controllers
abstractmethod
async
get_controllers() -> list[Controller]
Retrieves all controllers associated with the currently authenticated user.
get_sensors
abstractmethod
async
get_sensors(controller: Controller) -> list[Sensor]
Retrieves sensors associated with the given controller.
| Parameters: |
|
|---|
get_user
abstractmethod
async
get_user(fetch_zones: bool = True) -> User
Retrieves the currently authenticated user.
| Parameters: |
|
|---|
get_water_flow_summary
abstractmethod
async
get_water_flow_summary(controller: Controller, sensor: Sensor, start: datetime, end: datetime) -> SensorFlowSummary
Retrieves the water flow summary for a given sensor.
| Parameters: |
|
|---|
get_water_use_summary
abstractmethod
async
get_water_use_summary(controller: Controller, start: datetime, end: datetime) -> ControllerWaterUseSummary
Calculate the water use for the given controller and time period.
| Parameters: |
|
|---|
get_watering_report
abstractmethod
async
get_watering_report(controller: Controller, start: datetime, end: datetime) -> list[WateringReportEntry]
Retrieves a watering report for the given controller and time period.
| Parameters: |
|
|---|
get_zone
abstractmethod
async
get_zone(zone_id: int) -> Zone
Retrieves a zone by its unique identifier.
| Parameters: |
|
|---|
get_zones
abstractmethod
async
get_zones(controller: Controller) -> list[Zone]
Retrieves zones associated with the given controller.
| Parameters: |
|
|---|
resume_all_zones
abstractmethod
async
resume_all_zones(controller: Controller) -> None
Resumes the schedule of all zones attached to the given controller.
| Parameters: |
|
|---|
resume_zone
abstractmethod
async
resume_zone(zone: Zone) -> None
Resumes a zone's schedule.
| Parameters: |
|
|---|
start_all_zones
abstractmethod
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: |
|
|---|
start_zone
abstractmethod
async
start_zone(zone: Zone, mark_run_as_scheduled: bool = False, custom_run_duration: int = 0) -> None
Starts a zone's run cycle.
| Parameters: |
|
|---|
stop_all_zones
abstractmethod
async
stop_all_zones(controller: Controller) -> None
Stops all zones attached to a controller.
| Parameters: |
|
|---|
stop_zone
abstractmethod
async
stop_zone(zone: Zone) -> None
Stops a zone.
| Parameters: |
|
|---|
suspend_all_zones
abstractmethod
async
suspend_all_zones(controller: Controller, until: datetime) -> None
Suspends the schedule of all zones attached to a given controller.
| Parameters: |
|
|---|
suspend_zone
abstractmethod
async
suspend_zone(zone: Zone, until: datetime) -> None
Suspends a zone's schedule.
| Parameters: |
|
|---|
MutationError
Bases: Error
Raised when there is an error performing a mutation.
NotAuthenticatedError
Bases: Error
Raised when a request is made to an unathenticated object.
NotAuthorizedError
Bases: Error
Raised when invalid credentials are used.
UnknownError
Bases: Error
Raised when an unknown problem occurs.