Skip to content

Commit

Permalink
localapi: add API version
Browse files Browse the repository at this point in the history
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  • Loading branch information
Noltari committed Nov 17, 2022
1 parent 19a16d9 commit 726add4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aioairzone/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
API_THERMOS_TYPE = "thermos_type"
API_UNITS = "units"
API_V1 = "api/v1"
API_VERSION = "version"
API_WEBSERVER = "webserver"
API_WIFI = "wifi"
API_WIFI_CHANNEL = "wifi_channel"
Expand Down Expand Up @@ -159,6 +160,7 @@

RAW_HVAC = "hvac"
RAW_SYSTEMS = "systems"
RAW_VERSION = "version"
RAW_WEBSERVER = "webserver"

THERMOSTAT_RADIO = "Radio"
Expand Down
11 changes: 11 additions & 0 deletions aioairzone/localapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
API_SYSTEM_PARAMS,
API_SYSTEMS,
API_V1,
API_VERSION,
API_WEBSERVER,
API_ZONE_ID,
API_ZONE_PARAMS,
Expand All @@ -41,6 +42,7 @@
HTTP_CALL_TIMEOUT,
RAW_HVAC,
RAW_SYSTEMS,
RAW_VERSION,
RAW_WEBSERVER,
)
from .device import System, Zone
Expand Down Expand Up @@ -285,6 +287,15 @@ async def get_hvac(self, params: dict[str, Any] | None = None) -> dict[str, Any]
self._api_raw_data[RAW_HVAC] = res
return res

async def get_version(self) -> dict[str, Any]:
"""Return Airzone Local API version."""
res = await self.http_request(
"POST",
f"{API_V1}/{API_VERSION}",
)
self._api_raw_data[RAW_VERSION] = res
return res

async def get_webserver(self) -> dict[str, Any]:
"""Return Airzone WebServer."""
res = await self.http_request(
Expand Down
1 change: 1 addition & 0 deletions examples/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async def main():
print(f"Airzone WebServer: {airzone_mac}")
print("***")

await airzone.get_version()
await airzone.update()
print(json.dumps(airzone.data(), indent=4, sort_keys=True))
print("***")
Expand Down

0 comments on commit 726add4

Please sign in to comment.