diff --git a/aiophyn/device.py b/aiophyn/device.py index 0b95719..bd02ed9 100644 --- a/aiophyn/device.py +++ b/aiophyn/device.py @@ -65,6 +65,27 @@ async def get_consumption( "get", f"{API_BASE}/devices/{device_id}/consumption/details", params=params ) + async def get_water_statistics(self, device_id: str, from_ts, to_ts): + """Get statistics about a PW1 sensor + + :param device_id: Unique identifier for the device + :type device_id: str + :param from_ts: Lower bound timestamp. This is a timestamp with thousands as integer + :type from_ts: int + :param to_ts: Upper bound timestamp. This is a timestamp with thousands as integer + :type to_ts: int + :return: List of dictionaries of results. + :rtype: List[dict[str, Any]] + """ + params = { + "from_ts": from_ts, + "to_ts": to_ts + } + + return await self._request( + "get", f"{API_BASE}/devices/{device_id}/water_statistics/history/", params=params + ) + async def open_valve(self, device_id: str) -> None: """Open a device shutoff valve. diff --git a/pyproject.toml b/pyproject.toml index 0abfaf7..4b88f9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "aiophyn" -version = "2024.1.2" +version = "2024.1.3" description = "An asynchronous library for Phyn Smart Water devices" authors = ["MizterB <5458030+MizterB@users.noreply.github.com>","jordanruthe <31575189+jordanruthe@users.noreply.github.com>"] license = "MIT"