Switchbot Cloud:Enable webhook for the Light series (#178422)

This commit is contained in:
Samuel Xiao
2026-08-07 13:53:48 +02:00
committed by GitHub
parent ab3451bd07
commit 489ba28689
2 changed files with 15 additions and 13 deletions
@@ -151,28 +151,28 @@ DEVICE_SUPPORT_MAP: Final[dict[str, SwitchbotCloudDeviceConfig]] = {
"Smart Lock Pro Wifi": SwitchbotCloudDeviceConfig(
True, entity_config=(Platform.SENSOR, Platform.BINARY_SENSOR, Platform.LOCK)
),
"Strip Light": SwitchbotCloudDeviceConfig(False, entity_config=(Platform.LIGHT,)),
"Strip Light 3": SwitchbotCloudDeviceConfig(False, entity_config=(Platform.LIGHT,)),
"Floor Lamp": SwitchbotCloudDeviceConfig(False, entity_config=(Platform.LIGHT,)),
"Color Bulb": SwitchbotCloudDeviceConfig(False, entity_config=(Platform.LIGHT,)),
"Strip Light": SwitchbotCloudDeviceConfig(True, entity_config=(Platform.LIGHT,)),
"Strip Light 3": SwitchbotCloudDeviceConfig(True, entity_config=(Platform.LIGHT,)),
"Floor Lamp": SwitchbotCloudDeviceConfig(True, entity_config=(Platform.LIGHT,)),
"Color Bulb": SwitchbotCloudDeviceConfig(True, entity_config=(Platform.LIGHT,)),
"RGBICWW Floor Lamp": SwitchbotCloudDeviceConfig(
False, entity_config=(Platform.LIGHT,)
True, entity_config=(Platform.LIGHT,)
),
"RGBICWW Strip Light": SwitchbotCloudDeviceConfig(
False, entity_config=(Platform.LIGHT,)
True, entity_config=(Platform.LIGHT,)
),
"Ceiling Light": SwitchbotCloudDeviceConfig(False, entity_config=(Platform.LIGHT,)),
"Ceiling Light": SwitchbotCloudDeviceConfig(True, entity_config=(Platform.LIGHT,)),
"Ceiling Light Pro": SwitchbotCloudDeviceConfig(
False, entity_config=(Platform.LIGHT,)
True, entity_config=(Platform.LIGHT,)
),
"RGBIC Neon Wire Rope Light": SwitchbotCloudDeviceConfig(
False, entity_config=(Platform.LIGHT,)
True, entity_config=(Platform.LIGHT,)
),
"RGBIC Neon Rope Light": SwitchbotCloudDeviceConfig(
False, entity_config=(Platform.LIGHT,)
True, entity_config=(Platform.LIGHT,)
),
"Candle Warmer Lamp": SwitchbotCloudDeviceConfig(
False, entity_config=(Platform.LIGHT,)
True, entity_config=(Platform.LIGHT,)
),
"MeterPro(CO2)": SwitchbotCloudDeviceConfig(True, entity_config=(Platform.SENSOR,)),
"AI Art Frame": SwitchbotCloudDeviceConfig(
@@ -70,11 +70,13 @@ class SwitchBotCloudLight(SwitchBotCloudEntity, LightEntity):
"""Set attributes from coordinator data."""
if self.coordinator.data is None:
return
power: str | None = self.coordinator.data.get("power")
power: str | None = self.coordinator.data.get(
"power"
) or self.coordinator.data.get("powerState")
brightness: int | None = self.coordinator.data.get("brightness")
color: str | None = self.coordinator.data.get("color")
color_temperature: int | None = self.coordinator.data.get("colorTemperature")
self._attr_is_on = power == "on" if power else None
self._attr_is_on = power.lower() == "on" if power else None
self._attr_brightness: int | None = (
brightness_map_value(brightness) if brightness else None
)