J. Nick Koston 2 年之前
父節點
當前提交
59608e1fe8
共有 4 個文件被更改,包括 19 次插入9 次删除
  1. 1 2
      switchbot/devices/bot.py
  2. 10 0
      switchbot/devices/bulb.py
  3. 7 5
      switchbot/devices/device.py
  4. 1 2
      switchbot/discovery.py

+ 1 - 2
switchbot/devices/bot.py

@@ -4,8 +4,7 @@ from __future__ import annotations
 import logging
 from typing import Any
 
-from .device import (DEVICE_SET_EXTENDED_KEY, DEVICE_SET_MODE_KEY,
-                     SwitchbotDevice)
+from .device import DEVICE_SET_EXTENDED_KEY, DEVICE_SET_MODE_KEY, SwitchbotDevice
 
 # Bot keys
 PRESS_KEY = "570100"

+ 10 - 0
switchbot/devices/bulb.py

@@ -66,6 +66,16 @@ class SwitchbotBulb(SwitchbotDevice):
         """Return the current color mode."""
         return ColorMode(self._get_adv_value("color_mode") or 0)
 
+    @property
+    def min_temp(self) -> int:
+        """Return minimum color temp."""
+        return 2700
+
+    @property
+    def max_temp(self) -> int:
+        """Return maximum color temp."""
+        return 6500
+
     async def update(self, interface: int | None = None) -> None:
         """Update state of device."""
         result = await self._sendcommand(BULB_REQUEST)

+ 7 - 5
switchbot/devices/device.py

@@ -10,12 +10,14 @@ from uuid import UUID
 import async_timeout
 from bleak import BleakError
 from bleak.backends.device import BLEDevice
-from bleak.backends.service import (BleakGATTCharacteristic,
-                                    BleakGATTServiceCollection)
+from bleak.backends.service import BleakGATTCharacteristic, BleakGATTServiceCollection
 from bleak.exc import BleakDBusError
-from bleak_retry_connector import (BleakClientWithServiceCache,
-                                   BleakNotFoundError, ble_device_has_changed,
-                                   establish_connection)
+from bleak_retry_connector import (
+    BleakClientWithServiceCache,
+    BleakNotFoundError,
+    ble_device_has_changed,
+    establish_connection,
+)
 
 from ..const import DEFAULT_RETRY_COUNT, DEFAULT_SCAN_TIMEOUT
 from ..discovery import GetSwitchbotDevices

+ 1 - 2
switchbot/discovery.py

@@ -10,8 +10,7 @@ from bleak.backends.device import BLEDevice
 from bleak.backends.scanner import AdvertisementData
 
 from .adv_parser import parse_advertisement_data
-from .const import (DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT,
-                    DEFAULT_SCAN_TIMEOUT)
+from .const import DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT, DEFAULT_SCAN_TIMEOUT
 from .models import SwitchBotAdvertisement
 
 _LOGGER = logging.getLogger(__name__)