From e7e591832a55b4164cfb27993983eccdeebcc056 Mon Sep 17 00:00:00 2001 From: petretiandrea Date: Sat, 13 Apr 2024 13:56:57 +0200 Subject: [PATCH 1/2] fix(core): color modes brightness --- custom_components/tapo/light.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/tapo/light.py b/custom_components/tapo/light.py index d60a47a..7b368be 100755 --- a/custom_components/tapo/light.py +++ b/custom_components/tapo/light.py @@ -209,7 +209,7 @@ def _components_to_color_modes(device: TapoBulb) -> set[ColorMode]: color_modes.append(ColorMode.HS) if device.is_brightness and not device.is_color_temperature and not device.is_color: color_modes.append(ColorMode.BRIGHTNESS) - if not device.is_color_temperature and not device.is_color: + if not color_modes: color_modes.append(ColorMode.ONOFF) return set(color_modes) From 504d033c2379438de0a6b4a130296853e4a36461 Mon Sep 17 00:00:00 2001 From: petretiandrea Date: Sat, 13 Apr 2024 13:57:40 +0200 Subject: [PATCH 2/2] fix(core): remove supported devices enumeration --- custom_components/tapo/config_flow.py | 7 ++-- custom_components/tapo/const.py | 46 --------------------------- 2 files changed, 5 insertions(+), 48 deletions(-) diff --git a/custom_components/tapo/config_flow.py b/custom_components/tapo/config_flow.py index aeb490e..5428fac 100755 --- a/custom_components/tapo/config_flow.py +++ b/custom_components/tapo/config_flow.py @@ -33,7 +33,6 @@ from custom_components.tapo.const import STEP_ADVANCED_SETTINGS from custom_components.tapo.const import STEP_DISCOVERY_REQUIRE_AUTH from custom_components.tapo.const import STEP_INIT -from custom_components.tapo.const import SUPPORTED_DEVICES from custom_components.tapo.discovery import discover_tapo_device from custom_components.tapo.errors import CannotConnect from custom_components.tapo.errors import InvalidAuth @@ -352,4 +351,8 @@ async def async_step_init( def is_supported_device(discovered_device: DiscoveredDevice) -> bool: model = discovered_device.device_model.lower() - return len(list(filter(lambda x: x in model, SUPPORTED_DEVICES))) > 0 + kind = discovered_device.device_type.upper() + if kind == "SMART.IPCAMERA" or "CAMERA" in kind: + _LOGGER.info("Found device model: %s, but type not supported %s", model, kind) + return False + return True diff --git a/custom_components/tapo/const.py b/custom_components/tapo/const.py index 5e139f4..d2268db 100755 --- a/custom_components/tapo/const.py +++ b/custom_components/tapo/const.py @@ -13,52 +13,6 @@ DISCOVERY_INTERVAL = timedelta(minutes=10) DISCOVERY_TIMEOUT = 5 -SUPPORTED_HUB_DEVICE_MODEL = ["h100", "kh100", "h200"] -SUPPORTED_POWER_STRIP_DEVICE_MODEL = "p300" -SUPPORTED_DEVICE_AS_SWITCH = [ - "p100", - "p105", - "p110", - "p115", - "p125", - "p125m", - "p110m", - "tp15", - "p100m", -] -SUPPORTED_DEVICE_AS_LIGHT = [ - "l920", - "l930", - "l900", - "l630", - "l530", - "l520", - "l510", - "l610", - "tl33", - "tl31", - "s500d", - "s505d", - "s500", - "s505", - "ts15", - "l535", - "l535e", - "l535b", - "tl135", - "tl135e", -] -SUPPORTED_DEVICE_AS_LED_STRIP = ["l930", "l920", "l900"] - - -SUPPORTED_DEVICES = ( - SUPPORTED_DEVICE_AS_LED_STRIP - + SUPPORTED_DEVICE_AS_LIGHT - + SUPPORTED_HUB_DEVICE_MODEL - + SUPPORTED_DEVICE_AS_SWITCH - + [SUPPORTED_POWER_STRIP_DEVICE_MODEL] -) - ISSUE_URL = "https://github.com/petretiandrea/home-assistant-tapo-p100/issues" # list the platforms that you want to support.