Skip to content

Commit

Permalink
Add function to run a leak test
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanruthe committed Jan 30, 2024
1 parent 9f0fa20 commit 68db369
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions aiophyn/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ async def get_latest_firmware_info(self, device_id: str) -> dict:
return await self._request(
"get", f"{API_BASE}/firmware/latestVersion/v2?device_id={device_id}"
)

async def get_device_preferences(self, device_id: str) -> dict:
"""Get phyn device preferences.
Expand All @@ -179,7 +179,23 @@ async def get_device_preferences(self, device_id: str) -> dict:
return await self._request(
"get", f"{API_BASE}/preferences/device/{device_id}"
)


async def run_leak_test(self, device_id: str, extended_test: bool = False):
"""Run a leak test
:param device_id: Unique identifier for the device
:type device_id: str
:param extended_test: True if the test be extended, defaults to False
:type extended_test: bool, optional
"""
data = {
"initiator": "App",
"test_duration": "e" if extended_test is True else "s"
}
return await self._request(
"post", f"{API_BASE}/devices/{device_id}/health_tests", json=data
)

async def set_device_preferences(self, device_id: str, data: list[dict]) -> None:
"""Set device preferences
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "aiophyn"
version = "2024.1.3"
version = "2024.1.4"
description = "An asynchronous library for Phyn Smart Water devices"
authors = ["MizterB <[email protected]>","jordanruthe <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 68db369

Please sign in to comment.