fan.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. from __future__ import annotations
  2. from enum import Enum
  3. class FanMode(Enum):
  4. NORMAL = 1
  5. NATURAL = 2
  6. SLEEP = 3
  7. BABY = 4
  8. @classmethod
  9. def get_modes(cls) -> list[str]:
  10. return [mode.name.lower() for mode in cls]
  11. class StandingFanMode(Enum):
  12. NORMAL = 1
  13. NATURAL = 2
  14. SLEEP = 3
  15. BABY = 4
  16. CUSTOM_NATURAL = 5
  17. @classmethod
  18. def get_modes(cls) -> list[str]:
  19. return [mode.name.lower() for mode in cls]
  20. class NightLightState(Enum):
  21. """Standing Fan night-light command values."""
  22. LEVEL_1 = 1
  23. LEVEL_2 = 2
  24. OFF = 3
  25. class HorizontalOscillationAngle(Enum):
  26. """
  27. Horizontal oscillation angle command values.
  28. For the horizontal axis the device byte is the same as the
  29. user-facing angle in degrees.
  30. """
  31. ANGLE_30 = 30
  32. ANGLE_60 = 60
  33. ANGLE_90 = 90
  34. class VerticalOscillationAngle(Enum):
  35. """
  36. Vertical oscillation angle command values.
  37. The Standing Fan uses a different byte encoding on the vertical axis
  38. than on the horizontal one. Byte 0x5A (decimal 90) is interpreted as
  39. an axis halt, so 90° maps to byte 0x5F (95). 30° and 60° match their
  40. degree values.
  41. """
  42. ANGLE_30 = 30
  43. ANGLE_60 = 60
  44. ANGLE_90 = 95