File: climate.py

package info (click to toggle)
pyswitchbot 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 980 kB
  • sloc: python: 14,812; makefile: 2
file content (50 lines) | stat: -rw-r--r-- 902 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
38
39
40
41
42
43
44
45
46
47
48
49
50
"""Representation of climate-related constants."""

from enum import Enum


class ClimateMode(Enum):
    """Climate Modes."""

    OFF = 0
    HEAT = 1
    COOL = 2
    HEAT_COOL = 3
    AUTO = 4
    DRY = 5
    FAN_ONLY = 6


class ClimateAction(Enum):
    """Climate Actions."""

    OFF = 0
    IDLE = 1
    HEATING = 2


class SmartThermostatRadiatorMode(Enum):
    """Smart Thermostat Radiator Modes."""

    SCHEDULE = 0
    MANUAL = 1
    OFF = 2
    ECO = 3
    COMFORT = 4
    BOOST = 5

    @property
    def lname(self) -> str:
        return self.name.lower()

    @classmethod
    def get_modes(cls) -> list[str]:
        return [mode.lname for mode in cls]

    @classmethod
    def get_mode_name(cls, mode_value: int) -> str:
        return cls(mode_value).lname

    @classmethod
    def get_valid_modes(cls) -> list[str]:
        return [mode.lname for mode in cls if mode != cls.OFF]