universal_remote.py 612 B

1234567891011121314151617181920212223
  1. """Library to handle connection with Switchbot Universal Remote."""
  2. from __future__ import annotations
  3. import logging
  4. from typing import Any
  5. from .device import SwitchbotDevice
  6. _LOGGER = logging.getLogger(__name__)
  7. class SwitchbotUniversalRemote(SwitchbotDevice):
  8. """Representation of a Switchbot Universal Remote."""
  9. async def get_basic_info(self) -> dict[str, Any] | None:
  10. """Get device basic settings."""
  11. if not (_data := await self._get_basic_info()):
  12. return None
  13. return {
  14. "battery": _data[1],
  15. "charging": bool(_data[12]),
  16. }