J. Nick Koston 1 anno fa
parent
commit
e73e4e6b1b
2 ha cambiato i file con 24 aggiunte e 0 eliminazioni
  1. 20 0
      switchbot/devices/base_light.py
  2. 4 0
      switchbot/devices/light_strip.py

+ 20 - 0
switchbot/devices/base_light.py

@@ -55,3 +55,23 @@ class SwitchbotBaseLight(SwitchbotSequenceDevice):
     def is_on(self) -> bool | None:
         """Return bulb state from cache."""
         return self._get_adv_value("isOn")
+
+    @abstractmethod
+    async def turn_on(self) -> bool:
+        """Turn device on."""
+
+    @abstractmethod
+    async def turn_off(self) -> bool:
+        """Turn device off."""
+
+    @abstractmethod
+    async def set_brightness(self, brightness: int) -> bool:
+        """Set brightness."""
+
+    @abstractmethod
+    async def set_color_temp(self, brightness: int, color_temp: int) -> bool:
+        """Set color temp."""
+
+    @abstractmethod
+    async def set_rgb(self, brightness: int, r: int, g: int, b: int) -> bool:
+        """Set rgb."""

+ 4 - 0
switchbot/devices/light_strip.py

@@ -58,6 +58,10 @@ class SwitchbotLightStrip(SwitchbotBaseLight):
         self._update_state(result)
         return result[1] == 0x80
 
+    async def set_color_temp(self, brightness: int, color_temp: int) -> bool:
+        """Set color temp."""
+        # not supported on this device
+
     async def set_rgb(self, brightness: int, r: int, g: int, b: int) -> bool:
         """Set rgb."""
         assert 0 <= brightness <= 100, "Brightness must be between 0 and 100"