Add authentication to tplink integration for newer devices (#105143)
* Add authentication flows to tplink integration to enable newer device protocol support * Add websession passing to tplink integration discover methods * Use SmartDevice.connect() * Update to use DeviceConfig * Use credential hashes * Bump python-kasa to 0.6.0.dev0 * Fix tests and address review comments * Add autodetection for L530, P110, and L900 This adds mac address prefixes for the devices I have. The wildcards are left quite lax assuming different series may share the same prefix. * Bump tplink to 0.6.0.dev1 * Add config flow tests * Use short_mac if alias is None and try legacy connect on discovery timeout * Add config_flow tests * Add init tests * Migrate to aiohttp * add some more ouis * final * ip change fix * add fixmes * fix O(n) searching * fix O(n) searching * move code that cannot fail outside of try block * fix missing reauth_successful string * add doc strings, cleanups * error message by password * dry * adjust discovery timeout * integration discovery already formats mac * tweaks * cleanups * cleanups * Update post review and fix broken tests * Fix TODOs and FIXMEs in test_config_flow * Add pragma no cover * bump, apply suggestions * remove no cover * use iden check * Apply suggestions from code review * Fix branched test and update integration title * legacy typing * Update homeassistant/components/tplink/__init__.py * lint * Remove more unused consts * Update test docstrings * Add sdb9696 to tplink codeowners * Update docstring on test for invalid DeviceConfig * Update test stored credentials test --------- Co-authored-by: Teemu Rytilahti <tpr@iki.fi> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
c3da51db4e
commit
9b3d3b3b2d
18 changed files with 1661 additions and 161 deletions
|
@ -8,13 +8,7 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import (
|
||||
MAC_ADDRESS,
|
||||
_mocked_bulb,
|
||||
_mocked_plug,
|
||||
_patch_discovery,
|
||||
_patch_single_discovery,
|
||||
)
|
||||
from . import MAC_ADDRESS, _mocked_bulb, _mocked_plug, _patch_connect, _patch_discovery
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
@ -35,7 +29,7 @@ async def test_color_light_with_an_emeter(hass: HomeAssistant) -> None:
|
|||
current=5,
|
||||
)
|
||||
bulb.emeter_today = 5000.0036
|
||||
with _patch_discovery(device=bulb), _patch_single_discovery(device=bulb):
|
||||
with _patch_discovery(device=bulb), _patch_connect(device=bulb):
|
||||
await async_setup_component(hass, tplink.DOMAIN, {tplink.DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
|
@ -75,7 +69,7 @@ async def test_plug_with_an_emeter(hass: HomeAssistant) -> None:
|
|||
current=5.035,
|
||||
)
|
||||
plug.emeter_today = None
|
||||
with _patch_discovery(device=plug), _patch_single_discovery(device=plug):
|
||||
with _patch_discovery(device=plug), _patch_connect(device=plug):
|
||||
await async_setup_component(hass, tplink.DOMAIN, {tplink.DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
|
@ -103,7 +97,7 @@ async def test_color_light_no_emeter(hass: HomeAssistant) -> None:
|
|||
bulb = _mocked_bulb()
|
||||
bulb.color_temp = None
|
||||
bulb.has_emeter = False
|
||||
with _patch_discovery(device=bulb), _patch_single_discovery(device=bulb):
|
||||
with _patch_discovery(device=bulb), _patch_connect(device=bulb):
|
||||
await async_setup_component(hass, tplink.DOMAIN, {tplink.DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
|
@ -139,7 +133,7 @@ async def test_sensor_unique_id(hass: HomeAssistant) -> None:
|
|||
current=5,
|
||||
)
|
||||
plug.emeter_today = None
|
||||
with _patch_discovery(device=plug), _patch_single_discovery(device=plug):
|
||||
with _patch_discovery(device=plug), _patch_connect(device=plug):
|
||||
await async_setup_component(hass, tplink.DOMAIN, {tplink.DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue