diff --git a/homeassistant/components/bond/light.py b/homeassistant/components/bond/light.py index 77771167e14..c0809a0aee7 100644 --- a/homeassistant/components/bond/light.py +++ b/homeassistant/components/bond/light.py @@ -47,7 +47,13 @@ async def async_setup_entry( if DeviceType.is_fireplace(device.type) and device.supports_light() ] - async_add_entities(fan_lights + fireplaces + fp_lights, True) + lights: List[Entity] = [ + BondLight(hub, device) + for device in hub.devices + if DeviceType.is_light(device.type) + ] + + async_add_entities(fan_lights + fireplaces + fp_lights + lights, True) class BondLight(BondEntity, LightEntity): diff --git a/tests/components/bond/test_light.py b/tests/components/bond/test_light.py index 6d871187e26..3f7a3ef62f9 100644 --- a/tests/components/bond/test_light.py +++ b/tests/components/bond/test_light.py @@ -29,6 +29,15 @@ from .common import ( from tests.common import async_fire_time_changed +def light(name: str): + """Create a light with a given name.""" + return { + "name": name, + "type": DeviceType.LIGHT, + "actions": [Action.TURN_LIGHT_ON, Action.TURN_LIGHT_OFF, Action.SET_BRIGHTNESS], + } + + def ceiling_fan(name: str): """Create a ceiling fan (that has built-in light) with given name.""" return { @@ -117,6 +126,21 @@ async def test_fireplace_with_light_entity_registry(hass: core.HomeAssistant): assert entity_light.unique_id == "test-hub-id_test-device-id_light" +async def test_light_entity_registry(hass: core.HomeAssistant): + """Tests lights are registered in the entity registry.""" + await setup_platform( + hass, + LIGHT_DOMAIN, + light("light-name"), + bond_version={"bondid": "test-hub-id"}, + bond_device_id="test-device-id", + ) + + registry: EntityRegistry = await hass.helpers.entity_registry.async_get_registry() + entity = registry.entities["light.light_name"] + assert entity.unique_id == "test-hub-id_test-device-id" + + async def test_sbb_trust_state(hass: core.HomeAssistant): """Assumed state should be False if device is a Smart by Bond.""" version = {