humidifier.py 675 B

12345678910111213141516171819202122232425262728293031
  1. """Humidifier adv parser."""
  2. from __future__ import annotations
  3. import logging
  4. _LOGGER = logging.getLogger(__name__)
  5. # mfr_data: 943cc68d3d2e
  6. # data: 650000cd802b6300
  7. # data: 650000cd802b6300
  8. # data: 658000c9802b6300
  9. # Low: 658000c5222b6300
  10. # Med: 658000c5432b6300
  11. # High: 658000c5642b6300
  12. def process_wohumidifier(
  13. data: bytes | None, mfr_data: bytes | None
  14. ) -> dict[str, bool | int]:
  15. """Process WoHumi services data."""
  16. if data is None:
  17. return {
  18. "isOn": None,
  19. "level": None,
  20. "switchMode": True,
  21. }
  22. return {
  23. "isOn": bool(data[1]),
  24. "level": data[4],
  25. "switchMode": True,
  26. }