mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Address late review of vesync light (#48130)
This commit is contained in:
parent
938a4cc1b6
commit
11596afdfc
@ -33,23 +33,22 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
hass.data[DOMAIN][VS_DISPATCHERS].append(disp)
|
hass.data[DOMAIN][VS_DISPATCHERS].append(disp)
|
||||||
|
|
||||||
_async_setup_entities(hass.data[DOMAIN][VS_LIGHTS], async_add_entities)
|
_async_setup_entities(hass.data[DOMAIN][VS_LIGHTS], async_add_entities)
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_setup_entities(devices, async_add_entities):
|
def _async_setup_entities(devices, async_add_entities):
|
||||||
"""Check if device is online and add entity."""
|
"""Check if device is online and add entity."""
|
||||||
dev_list = []
|
entities = []
|
||||||
for dev in devices:
|
for dev in devices:
|
||||||
if DEV_TYPE_TO_HA.get(dev.device_type) == "light":
|
if DEV_TYPE_TO_HA.get(dev.device_type) == "light":
|
||||||
dev_list.append(VeSyncDimmerHA(dev))
|
entities.append(VeSyncDimmerHA(dev))
|
||||||
else:
|
else:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"%s - Unknown device type - %s", dev.device_name, dev.device_type
|
"%s - Unknown device type - %s", dev.device_name, dev.device_type
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
async_add_entities(dev_list, update_before_add=True)
|
async_add_entities(entities, update_before_add=True)
|
||||||
|
|
||||||
|
|
||||||
class VeSyncDimmerHA(VeSyncDevice, LightEntity):
|
class VeSyncDimmerHA(VeSyncDevice, LightEntity):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user