mirror of
https://github.com/python-kasa/python-kasa.git
synced 2026-11-26 16:01:40 +00:00
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>