Create LED switches for tplink dimmers (#66839)

This commit is contained in:
Teemu R 2022-02-21 19:02:11 +01:00 committed by GitHub
parent c6114f2631
commit 16cc2b790b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 49 deletions

View file

@ -28,7 +28,7 @@ async def async_setup_entry(
"""Set up switches."""
coordinator: TPLinkDataUpdateCoordinator = hass.data[DOMAIN][config_entry.entry_id]
device = cast(SmartPlug, coordinator.device)
if not device.is_plug and not device.is_strip:
if not device.is_plug and not device.is_strip and not device.is_dimmer:
return
entities: list = []
if device.is_strip:
@ -36,7 +36,7 @@ async def async_setup_entry(
_LOGGER.debug("Initializing strip with %s sockets", len(device.children))
for child in device.children:
entities.append(SmartPlugSwitch(child, coordinator))
else:
elif device.is_plug:
entities.append(SmartPlugSwitch(device, coordinator))
entities.append(SmartPlugLedSwitch(device, coordinator))