File: group.py

package info (click to toggle)
python-aioairzone-cloud 0.6.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 396 kB
  • sloc: python: 3,600; makefile: 4
file content (37 lines) | stat: -rw-r--r-- 925 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Airzone Cloud API Group."""

from __future__ import annotations

from typing import Any

from .const import API_GROUP_ID, API_NAME, AZD_INSTALLATION
from .device_group import DeviceGroup


class Group(DeviceGroup):
    """Airzone Cloud Group."""

    def __init__(self, inst_id: str, group_data: dict[str, Any]) -> None:
        """Airzone Cloud Group init."""
        super().__init__()

        self.id = str(group_data[API_GROUP_ID])
        self.installation_id = inst_id

        name: str = group_data.get(API_NAME, "")
        if len(name) > 0:
            self.name = name
        else:
            self.name = "Group"

    def data(self) -> dict[str, Any]:
        """Return Group data."""
        data = super().data()

        data[AZD_INSTALLATION] = self.get_installation()

        return data

    def get_installation(self) -> str:
        """Return Installation ID."""
        return self.installation_id