diff --git a/homeassistant/components/switchbot/__init__.py b/homeassistant/components/switchbot/__init__.py index 324233f464cd..790bc512dcb8 100644 --- a/homeassistant/components/switchbot/__init__.py +++ b/homeassistant/components/switchbot/__init__.py @@ -157,6 +157,7 @@ PLATFORMS_BY_TYPE = { SupportedModels.FLOOR_LAMP.value: [Platform.LIGHT, Platform.SENSOR], SupportedModels.STRIP_LIGHT_3.value: [Platform.LIGHT, Platform.SENSOR], SupportedModels.RGBICWW_FLOOR_LAMP.value: [Platform.LIGHT, Platform.SENSOR], + SupportedModels.RGBICWW_LIGHT_BARS.value: [Platform.LIGHT, Platform.SENSOR], SupportedModels.RGBICWW_STRIP_LIGHT.value: [Platform.LIGHT, Platform.SENSOR], SupportedModels.PERMANENT_OUTDOOR_LIGHT.value: [Platform.LIGHT, Platform.SENSOR], SupportedModels.PLUG_MINI_EU.value: [Platform.SWITCH, Platform.SENSOR], @@ -247,6 +248,7 @@ CLASS_BY_DEVICE = { SupportedModels.FLOOR_LAMP.value: switchbot.SwitchbotStripLight3, SupportedModels.STRIP_LIGHT_3.value: switchbot.SwitchbotStripLight3, SupportedModels.RGBICWW_FLOOR_LAMP.value: switchbot.SwitchbotRgbicLight, + SupportedModels.RGBICWW_LIGHT_BARS.value: switchbot.SwitchbotRgbicLight, SupportedModels.RGBICWW_STRIP_LIGHT.value: switchbot.SwitchbotRgbicLight, SupportedModels.PERMANENT_OUTDOOR_LIGHT.value: ( switchbot.SwitchbotPermanentOutdoorLight diff --git a/homeassistant/components/switchbot/const.py b/homeassistant/components/switchbot/const.py index 2d04fa982fbe..e1cab0c89c31 100644 --- a/homeassistant/components/switchbot/const.py +++ b/homeassistant/components/switchbot/const.py @@ -57,6 +57,7 @@ class SupportedModels(StrEnum): STRIP_LIGHT_3 = "strip_light_3" RGBICWW_STRIP_LIGHT = "rgbicww_strip_light" RGBICWW_FLOOR_LAMP = "rgbicww_floor_lamp" + RGBICWW_LIGHT_BARS = "rgbicww_light_bars" PERMANENT_OUTDOOR_LIGHT = "permanent_outdoor_light" PLUG_MINI_EU = "plug_mini_eu" RELAY_SWITCH_2PM = "relay_switch_2pm" @@ -113,6 +114,7 @@ CONNECTABLE_SUPPORTED_MODEL_TYPES = { SwitchbotModel.STRIP_LIGHT_3: SupportedModels.STRIP_LIGHT_3, SwitchbotModel.RGBICWW_STRIP_LIGHT: SupportedModels.RGBICWW_STRIP_LIGHT, SwitchbotModel.RGBICWW_FLOOR_LAMP: SupportedModels.RGBICWW_FLOOR_LAMP, + SwitchbotModel.RGBICWW_LIGHT_BARS: SupportedModels.RGBICWW_LIGHT_BARS, SwitchbotModel.PERMANENT_OUTDOOR_LIGHT: SupportedModels.PERMANENT_OUTDOOR_LIGHT, SwitchbotModel.PLUG_MINI_EU: SupportedModels.PLUG_MINI_EU, SwitchbotModel.RELAY_SWITCH_2PM: SupportedModels.RELAY_SWITCH_2PM, @@ -173,6 +175,7 @@ ENCRYPTED_MODELS = { SwitchbotModel.STRIP_LIGHT_3, SwitchbotModel.RGBICWW_STRIP_LIGHT, SwitchbotModel.RGBICWW_FLOOR_LAMP, + SwitchbotModel.RGBICWW_LIGHT_BARS, SwitchbotModel.PERMANENT_OUTDOOR_LIGHT, SwitchbotModel.PLUG_MINI_EU, SwitchbotModel.RELAY_SWITCH_2PM, @@ -208,6 +211,7 @@ ENCRYPTED_SWITCHBOT_MODEL_TO_CLASS: dict[ SwitchbotModel.STRIP_LIGHT_3: switchbot.SwitchbotStripLight3, SwitchbotModel.RGBICWW_STRIP_LIGHT: switchbot.SwitchbotRgbicLight, SwitchbotModel.RGBICWW_FLOOR_LAMP: switchbot.SwitchbotRgbicLight, + SwitchbotModel.RGBICWW_LIGHT_BARS: switchbot.SwitchbotRgbicLight, SwitchbotModel.PERMANENT_OUTDOOR_LIGHT: switchbot.SwitchbotPermanentOutdoorLight, SwitchbotModel.PLUG_MINI_EU: switchbot.SwitchbotRelaySwitch, SwitchbotModel.RELAY_SWITCH_2PM: switchbot.SwitchbotRelaySwitch2PM, diff --git a/tests/components/switchbot/__init__.py b/tests/components/switchbot/__init__.py index 9f836a265f85..01dd3b7278c5 100644 --- a/tests/components/switchbot/__init__.py +++ b/tests/components/switchbot/__init__.py @@ -1232,6 +1232,35 @@ RGBICWW_STRIP_LIGHT_SERVICE_INFO = BluetoothServiceInfoBleak( ) +RGBICWW_LIGHT_BARS_SERVICE_INFO = BluetoothServiceInfoBleak( + name="RGBICWW Light Bars", + manufacturer_data={ + 2409: b'(7/L\x94\xb2\x0c\x9e"\x00\x11:\x00', + }, + service_data={ + "0000fd3d-0000-1000-8000-00805f9b34fb": b"\x00\x00\x00\x00\x11\xbe\xf8" + }, + service_uuids=["cba20d00-224d-11e6-9fb8-0002a5d5c51b"], + address="AA:BB:CC:DD:EE:FF", + rssi=-60, + source="local", + advertisement=generate_advertisement_data( + local_name="RGBICWW Light Bars", + manufacturer_data={ + 2409: b'(7/L\x94\xb2\x0c\x9e"\x00\x11:\x00', + }, + service_data={ + "0000fd3d-0000-1000-8000-00805f9b34fb": b"\x00\x00\x00\x00\x11\xbe\xf8" + }, + service_uuids=["cba20d00-224d-11e6-9fb8-0002a5d5c51b"], + ), + device=generate_ble_device("AA:BB:CC:DD:EE:FF", "RGBICWW Light Bars"), + time=0, + connectable=True, + tx_power=-127, +) + + RGBICWW_FLOOR_LAMP_SERVICE_INFO = BluetoothServiceInfoBleak( name="RGBICWW Floor Lamp", manufacturer_data={ diff --git a/tests/components/switchbot/test_light.py b/tests/components/switchbot/test_light.py index cd97b615d841..e62a990cab70 100644 --- a/tests/components/switchbot/test_light.py +++ b/tests/components/switchbot/test_light.py @@ -33,6 +33,7 @@ from . import ( PERMANENT_OUTDOOR_LIGHT_SERVICE_INFO, RGBIC_NEON_LIGHT_SERVICE_INFO, RGBICWW_FLOOR_LAMP_SERVICE_INFO, + RGBICWW_LIGHT_BARS_SERVICE_INFO, RGBICWW_STRIP_LIGHT_SERVICE_INFO, STRIP_LIGHT_3_SERVICE_INFO, WOSTRIP_SERVICE_INFO, @@ -407,6 +408,7 @@ async def test_strip_light_services_exception( "SwitchbotRgbicLight", ), ("rgbicww_floor_lamp", RGBICWW_FLOOR_LAMP_SERVICE_INFO, "SwitchbotRgbicLight"), + ("rgbicww_light_bars", RGBICWW_LIGHT_BARS_SERVICE_INFO, "SwitchbotRgbicLight"), ( "permanent_outdoor_light", PERMANENT_OUTDOOR_LIGHT_SERVICE_INFO,