plug.py 365 B

12345678910111213
  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. if mfr_data is None:
  6. return {}
  7. return {
  8. "switchMode": True,
  9. "isOn": mfr_data[7] == 0x80,
  10. "wifi_rssi": -mfr_data[9],
  11. }