Skip to content

Commit

Permalink
aioairzone: add system_zone_id function
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 Mar 21, 2022
1 parent 8f736b3 commit d491eab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions aioairzone/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
from enum import Enum


def system_zone_id(system_id: int, zone_id: int) -> str:
"""Combine System and Zone IDs into a single ID."""
return f"{system_id}:{zone_id}"


class AirzoneStages(int, Enum):
"""Airzone stages."""

Expand Down
10 changes: 8 additions & 2 deletions aioairzone/localapi_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
from aiohttp import ClientSession
from aiohttp.client_reqrep import ClientResponse

from .common import AirzoneStages, ConnectionOptions, OperationMode, TemperatureUnit
from .common import (
AirzoneStages,
ConnectionOptions,
OperationMode,
TemperatureUnit,
system_zone_id,
)
from .const import (
API_AIR_DEMAND,
API_COLD_STAGE,
Expand Down Expand Up @@ -205,7 +211,7 @@ def data(self) -> dict[str, Any]:
for system_id, system in self.systems.items():
systems[system_id] = system.data()
for zone_id, zone in system.zones.items():
zones[f"{system_id}:{zone_id}"] = zone.data()
zones[system_zone_id(system_id, zone_id)] = zone.data()
data[AZD_SYSTEMS] = systems
data[AZD_ZONES] = zones

Expand Down

0 comments on commit d491eab

Please sign in to comment.