Skip to content

Commit

Permalink
Merge pull request #741 from petretiandrea/dev
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
petretiandrea authored Apr 13, 2024
2 parents 3897af7 + 689038f commit d86e352
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 49 deletions.
7 changes: 5 additions & 2 deletions custom_components/tapo/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
46 changes: 0 additions & 46 deletions custom_components/tapo/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion custom_components/tapo/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit d86e352

Please sign in to comment.