We only called format_mac on the mac address if we connected
to the device during entry creation. Since the format of the
mac address from DHCP discovery did not match the format saved
in the unique id, the IP would not get updated and a second
discovery would appear
Thankfully the creation path does format the mac so we did not
create any entries with an inconsistantly formatted unique id
fixes#110460
Remove extra confirmation step in tplink discovery flow
After discovery, and manually entering credentials, we would ask
the user if they still wanted to set up the device. Instead we
now set create the config entry as soon as they enter correct
credentials as its clear that they want to proceed.
* Update device config for SETUP_RETRY and use CONF_HOST on startup
* Make entry state checks use a constant
Co-authored-by: J. Nick Koston <nick@koston.org>
* Update tests
---------
Co-authored-by: J. Nick Koston <nick@koston.org>
* 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>
It can take longer than 5s to do the first update of the device
especially when the device is overloaded as seen in #103668
Wait 10 seconds for the discovery since when the power strips are loaded they cannot respond in time
Retry tplink setup later if device has an unexpected serial
If the DHCP reservation changed and there is now a different tplink device at
the saved IP address, retry setup later to avoid cross linking devices
* Add OUI to tplink diagnostics
The main reason discovery does not work for new devices is we
are missing the OUI. Since we redact the whole mac address in
the diagnostics, this makes it difficult to fix. We now include
the OUI in the diagnostics
* fix: use cached mac
* fix: tests
* Fix transition handling for tplink light
* Apply suggestions from code review
* Test that all transitions are passed correctly
* Fix linting
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
- These devices sometimes do not respond on the first try
or may be subject to transient broadcast failures, or
overloads. We now try discovery periodically once the
integration has been loaded.
- We used to try this 4x at startup, but that solution
seemed to aggressive as we want to be sure we pickup
the devices after startup as well since the network
will likely be more calm after startup.
* Convert persistent notification tests to async
* Create/dismiss persistent notifications in exposed functions, not service calls
* Fix notify persistent_notification
* Remove setting up persistent_notification
* Drop more setups
* Empty methods
* Undeprecate sync methods because too big task
* Fix setup clearing notifications
* Fix a bunch of tests
* Fix more tests
* Uno mas
* Test persistent notification events
* Clean up stale comment
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>