plug.py 354 B

123456789101112
  1. """Library to handle connection with Switchbot."""
  2. from __future__ import annotations
  3. def process_woplugmini(data: bytes, mfr_data: bytes | None) -> dict[str, bool | int]:
  4. """Process plug mini."""
  5. assert mfr_data is not None
  6. return {
  7. "switchMode": True,
  8. "isOn": mfr_data[7] == 0x80,
  9. "wifi_rssi": -mfr_data[9],
  10. }