Commit Graph

109 Commits (f06bd1b66f90c9a26d766cbc5faee0efabc9217c)

Author SHA1 Message Date
Marc Mueller 59e178df3b
Import Generator from typing_extensions (5) (#118993) 2024-06-06 17:33:27 +02:00
epenet c7cc465e5c
Add return type hints in tests (k-z) (#118942) 2024-06-06 10:11:29 +02:00
epenet c6e0e93680
Cleanup mock_get_source_ip from tests (#118459) 2024-05-30 09:37:01 +02:00
epenet 166c588cac
Add LogCaptureFixture type hints in tests (#118372) 2024-05-29 14:10:00 +02:00
epenet 2545b7d3bb
Use registry fixtures in tests (t-u) (#118297) 2024-05-28 14:23:01 +02:00
Steven B bf3eb463ae
Wrap tplink exceptions caused by user actions inside HomeAssistantError (#114919) 2024-04-08 22:35:25 -10:00
epenet 9204ccfa17
Use is in ConfigEntryState enum comparison in tests (N-Z) (#114926) 2024-04-05 17:37:00 +02:00
Joost Lekkerkerker f3ba713289
Use FlowResultType enum in config flow tests N-Z (#114682)
Use FlowResultType enum in config flow tests
2024-04-03 09:53:20 +02:00
Joost Lekkerkerker ee66f6ec8c
Use is in enum comparison in config flow tests P-T (#114675) 2024-04-02 11:21:50 -10:00
Joost Lekkerkerker 6bb4e7d62c
Bump ruff to 0.3.4 (#112690)
Co-authored-by: Sid <27780930+autinerd@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2024-03-26 00:02:16 +01:00
J. Nick Koston e8cb6a8e29
Optimize loading of translations (#114089) 2024-03-23 22:22:09 -10:00
J. Nick Koston 65358c129a
Replace periodic tasks with background tasks (#112726)
* Phase out periodic tasks

* false by default or some tests will block forever, will need to fix each one manually

* kwarg works

* kwarg works

* kwarg works

* fixes

* fix more tests

* fix more tests

* fix lifx

* opensky

* pvpc_hourly_pricing

* adjust more

* adjust more

* smarttub

* adjust more

* adjust more

* adjust more

* adjust more

* adjust

* no eager executor

* zha

* qnap_qsw

* fix more

* fix fix

* docs

* its a wrapper now

* add more coverage

* coverage

* cover all combos

* more fixes

* more fixes

* more fixes

* remaining issues are legit bugs in tests

* make tplink test more predictable

* more fixes

* feedreader

* grind out some more

* make test race safe

* one more
2024-03-08 21:45:10 -05:00
Marc Mueller 32f3f46542
Add empty line after module docstring (2) [tests.components] (#112737) 2024-03-08 19:16:21 +01:00
Marc Mueller 87165c0d6e
Add empty line after module docstring [tests t-z] (#112712) 2024-03-08 14:44:56 +01:00
J. Nick Koston ec1400d392
Fix flakey tplink test (#112135)
The test here was assuming the first slow was the one it
wanted, but sometimes the other flow wins the race
2024-03-03 21:29:45 +01:00
J. Nick Koston 59b7f8d103
Fix tplink blocking startup by waiting for discovery (#111788)
* Fix tplink blocking statup by waiting for discovery

* remove started
2024-02-28 21:34:08 -05:00
J. Nick Koston f71343a3ba
Import tplink in the executor to avoid blocking the event loop (#111691)
* Import tplink in the executor to avoid blocking the event loop

2024-02-27 22:44:19.908 DEBUG (MainThread) [homeassistant.loader] Component tplink import took 1.620 seconds (loaded_executor=False)

* patch out discovery because it happens too fast now
2024-02-28 15:06:33 +01:00
J. Nick Koston 98a8714705
Improve error reporting in tplink config flow (#111166)
* Improve error reporting in tplink config flow

* coverage, fixes
2024-02-23 02:38:46 +01:00
J. Nick Koston cd1c633ff9
Fix tplink not updating IP from DHCP discovery and discovering twice (#110557)
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
2024-02-14 23:03:30 +01:00
J. Nick Koston bc0a78d069
Migrate tplink to use async_update_entry to alter config entries (#110406) 2024-02-12 21:39:37 +01:00
Teemu R 6f88cd3273
Bump python-kasa to 0.6.2 (#109064) 2024-01-29 10:19:44 -10:00
J. Nick Koston 7667024a2f
Remove extra confirmation step in tplink authenticated discovery flow (#109016)
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.
2024-01-28 20:23:07 +01:00
Erik Montnemery 4a2a7872fb
Fix light color mode in tplink (#108760) 2024-01-24 15:28:40 +01:00
Steven B 393dee1524
Handle IP address changes properly for tplink (#108731)
* 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>
2024-01-24 11:24:44 +01:00
J. Nick Koston f6bc5c98b3
Handle tplink credential change at run time (#108692) 2024-01-22 13:30:21 -10:00
Steven B 9b3d3b3b2d
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>
2024-01-21 16:25:12 +01:00
J. Nick Koston 554c27a31a
Clamp tplink color temp to valid range (#107695) 2024-01-09 17:08:49 -10:00
J. Nick Koston dc7d817398
Incease tplink setup timeout (#103671)
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
2023-11-09 01:13:11 +01:00
Teemu R f944c68e01
Bump python-kasa to 0.5.4 for tplink (#103038) 2023-10-31 19:54:51 -05:00
Paul Bottein c98c18f25e
Return 'None' for light attributes when off instead of removing them (#101946) 2023-10-19 01:08:08 +02:00
J. Nick Koston d17ffff3e3
Retry tplink setup later if device has an unexpected mac address (#98784)
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
2023-08-27 19:00:39 +02:00
J. Nick Koston 0cc80a9d29
Add OUI to tplink diagnostics (#97646)
* 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
2023-08-03 22:49:55 -04:00
J. Nick Koston db5d1b10ea
Fix tplink child plug state reporting (#97658)
regressed in https://github.com/home-assistant/core/pull/96246
2023-08-03 12:35:22 +02:00
Joost Lekkerkerker 2dc86364f3
Migrate TPLink to has entity name (#96246) 2023-07-24 20:49:40 +02:00
Teemu R a93b4e7197
Use device-native kelvins for tplink color temperature (#85646) 2023-02-21 12:52:50 -06:00
Teemu R 1d928f05fa
Update python-kasa to 0.5.1 (#88416) 2023-02-18 22:39:08 -06:00
epenet 9a5f88f55f
Add type hints to integration tests (part 23) (#88235) 2023-02-17 16:40:46 +01:00
Franck Nijhof ed79265843
Enable Ruff PT006 (#88165)
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Teemu R 5335dfbc67
Prefer effect over other light settings for tplink (#85642) 2023-02-14 10:29:11 -06:00
epenet 278050a73f
Add type hints to integration tests (t-z) (#87707) 2023-02-08 19:10:53 +01:00
epenet a79be493e5
Adjust hass_client type hint in integration tests (#86954)
* Adjust hass_client type hint in integration tests

* Adjust hass_client_no_auth

* Fix rebase
2023-02-02 16:29:57 -05:00
Franck Nijhof bba9ad3243
Revert "Adapt tplink to use has_entity_name" (#85595)
Revert "Adapt tplink to use has_entity_name (#85577)"

This reverts commit ca0fe488ba.
2023-01-10 10:06:58 +01:00
Teemu R ca0fe488ba
Adapt tplink to use has_entity_name (#85577)
* Adapt tplink to use has_entity_name

* Set the name for individual smartstrip sockets

* Fix tests
2023-01-10 09:40:29 +01:00
Franck Nijhof a6244eea28
Search/replace RESULT_TYPE_* by FlowResultType enum (#74656) 2022-07-07 21:28:18 +02:00
J. Nick Koston 689b347904
Increase tplink effects random seed allowed range to 1-600 (#69725)
* Increase tplink effects random seed allowed range to 1-600

Reported https://community.home-assistant.io/t/tp-link-integration-support-for-kl430-led-light-strip/190635/62?u=bdraco

* cover
2022-04-09 10:08:17 +03:00
J. Nick Koston 6dc72ebf6c
Mark backgrounds optional for tplink random effects (#69622) 2022-04-07 23:19:17 +02:00
J. Nick Koston 8b2948f030
Ensure state is restored when turning on tplink lights without a color mode (#69308) 2022-04-05 13:46:12 -07:00
J. Nick Koston fb41734342
Add support for custom effects to tplink light strips (#68502) 2022-03-30 09:34:09 -07:00
J. Nick Koston 49bc572d6d
Fix tplink effect not being restored when turning back on (#68533)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2022-03-23 10:01:20 +01:00
J. Nick Koston 94cd656670
Use new internal_state property in tplink diagnostics (#68497) 2022-03-22 14:58:16 +01:00