Files
python-kasa/kasa
ZeliardM 347ce1ba9b Try the account e-mail with the Kasa setup password over KLAP (#1840)
Some Kasa IoT devices accept the account e-mail with `kasaSetup`
instead of the account password over KLAP. python-kasa only tries that
password with the default Kasa account, so these devices fail to
authenticate even with the correct account credentials.

This PR checks the account e-mail with the setup password locally
against handshake1, after the supplied credentials, without an extra
request.

In details:
- Try the e-mail as given, then trimmed and lowercased as the Kasa app
  sends it.
- Keep the fallbacks in one ordered list, with an explicit `save_hash`
  flag controlling hash persistence.
- Save only a matching account/setup hash as `credentials_hash`, so
  stored configs can reconnect without the e-mail.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 11:59:18 -05:00
..