Commit Graph

91 Commits (619e7fbbce8ba85d510d1e35428911d45843e2c1)

Author SHA1 Message Date
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
J. Nick Koston 06ebb0b8b3
Add support for effects to tplink light strips (#65166) 2022-03-21 20:20:40 -10:00
Teemu R 16cc2b790b
Create LED switches for tplink dimmers (#66839) 2022-02-21 19:02:11 +01:00
J. Nick Koston 38b9bea9a3
Switch tplink to use integration discovery (#66575) 2022-02-16 12:06:58 +01:00
Teemu R fd7e2e76e7
Add tplink diagnostics (#65822) 2022-02-06 16:50:44 -06:00
Teemu R f4ebb03bab
Add tplink hardware version to device info (#65951)
* Add tplink hardware version to device info

* Update mocks

Co-authored-by: J. Nick Koston <nick@koston.org>
2022-02-07 00:37:54 +02:00
Marc Mueller ef7316d8d9
Update typing (5) [tests] (#63926) 2022-01-11 21:28:13 +01:00
J. Nick Koston e0ef066022
Remove legacy migration and yaml from tplink (#62457)
- tplink has been fully migrated to a config flow in previous
  versions.
2021-12-21 11:24:32 +01:00
epenet 560546f65e
Use dataclass for DhcpServiceInfo (#60136)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-23 13:35:53 +01:00
epenet eb70d328ca
Use DhcpServiceInfo in tplink (#60114)
Co-authored-by: epenet <epenet@users.noreply.github.com>
2021-11-22 11:51:47 +01:00
Raphaël Beamonte e42bb244b7
Add TP-Link LED control for Kasa plugs and strips (#59621) 2021-11-13 17:50:37 -06:00
J. Nick Koston 5b3711ed19
Use switch format unique ids for tplink dimmers (#57346) 2021-10-10 00:02:33 -07:00
J. Nick Koston e77fae56d9
Migrate tplink hosts that were previously imported from yaml (#57308) 2021-10-08 08:58:18 -07:00
Teemu R 8fb0da7720
Stopgap fix for inconsistent upstream API of tplink dimmers (#57285) 2021-10-07 20:15:13 -07:00
Teemu R 36a22400e5
Fix transition handling for tplink lights (#57272)
* 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>
2021-10-08 00:20:26 +02:00
J. Nick Koston ac3741df41
Fix RGB only (no color temp) devices with tplink (#57267) 2021-10-07 10:14:14 -10:00
J. Nick Koston a2dcc0308b
Discover tplink devices periodically (#57221)
- 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.
2021-10-07 17:52:24 +02:00
Paulus Schoutsen a4d9019ffc
Refactor persistent notification to no longer route all data via a service (#57157)
* 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>
2021-10-07 12:58:00 +02:00
J. Nick Koston 77af741099
Prevent tplink from opening sockets in tests (#57058)
Supports #55516
2021-10-04 20:25:09 +02:00