J. Nick Koston 2 年之前
父節點
當前提交
6a253b1d42
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      switchbot/adv_parsers/bulb.py
  2. 1 1
      switchbot/devices/device.py

+ 1 - 1
switchbot/adv_parsers/bulb.py

@@ -11,7 +11,7 @@ def process_color_bulb(data: bytes, mfr_data: bytes | None) -> dict[str, bool |
         "brightness": mfr_data[7] & 0b01111111,
         "delay": bool(mfr_data[8] & 0b10000000),
         "preset": bool(mfr_data[8] & 0b00001000),
-        "light_state": mfr_data[8] & 0b00000111,
+        "color_mode": mfr_data[8] & 0b00000111,
         "speed": mfr_data[9] & 0b01111111,
         "loop_index": mfr_data[10] & 0b11111110,
     }

+ 1 - 1
switchbot/devices/device.py

@@ -332,7 +332,7 @@ class SwitchbotDevice:
         """Return value from advertisement data."""
         if not self._sb_adv_data:
             return None
-        return self._sb_adv_data.data["data"][key]
+        return self._sb_adv_data.data["data"].get(key)
 
     def get_battery_percent(self) -> Any:
         """Return device battery level in percent."""