| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- from __future__ import annotations
- from enum import Enum
- class FanMode(Enum):
- NORMAL = 1
- NATURAL = 2
- SLEEP = 3
- BABY = 4
- @classmethod
- def get_modes(cls) -> list[str]:
- return [mode.name.lower() for mode in cls]
- class StandingFanMode(Enum):
- NORMAL = 1
- NATURAL = 2
- SLEEP = 3
- BABY = 4
- CUSTOM_NATURAL = 5
- @classmethod
- def get_modes(cls) -> list[str]:
- return [mode.name.lower() for mode in cls]
- class CirculatorFanProMode(Enum):
- """
- Circulator Fan Pro (W1160) running modes.
- Mode 0x04 is hurricane, not the baby mode of the legacy fan.
- """
- NORMAL = 1
- NATURAL = 2
- SLEEP = 3
- HURRICANE = 4
- @classmethod
- def get_modes(cls) -> list[str]:
- return [mode.name.lower() for mode in cls]
- class NightLightState(Enum):
- """Standing Fan night-light command values."""
- LEVEL_1 = 1
- LEVEL_2 = 2
- OFF = 3
- class HorizontalOscillationAngle(Enum):
- """
- Horizontal oscillation angle command values.
- For the horizontal axis the device byte is the same as the
- user-facing angle in degrees.
- """
- ANGLE_30 = 30
- ANGLE_60 = 60
- ANGLE_90 = 90
- class VerticalOscillationAngle(Enum):
- """
- Vertical oscillation angle command values.
- The Standing Fan uses a different byte encoding on the vertical axis
- than on the horizontal one. Byte 0x5A (decimal 90) is interpreted as
- an axis halt, so 90° maps to byte 0x5F (95). 30° and 60° match their
- degree values.
- """
- ANGLE_30 = 30
- ANGLE_60 = 60
- ANGLE_90 = 95
- @classmethod
- def _missing_(cls, value: int) -> VerticalOscillationAngle | None:
- if value == 90:
- return cls.ANGLE_90
- return None
|