FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Implement the new protocol (HTTP over 80/tcp, 20002/udp for discovery) · Issue #115 · python-kasa/python-kasa · GitHub

Repository navigation

Implement the new protocol (HTTP over 80/tcp, 20002/udp for discovery) #115

Closed

Description

Help needed! New firmware versions are replacing the old, insecure local communication protocol.

If you update your devices to the newer firmware versions, you won't be able to use this library to control your devices until someone adds support for this new protocol.

This issue is for tracking the implementation of the new communication protocol used at least by some newer firmwares.
The previously used 9999/udp is not used anymore, and the new protocol uses stronger encryption for the communication. A response from tplink for some background information: home-assistant/core#43088 (comment)

Related to #114, potentially #113.

Steps required for implementation:

  • Adapting the discovery process. Both ways for discovery could be used per default, an enum to allow limiting discovery using a specific discovery could be added.
  • Extending TPLinkSmartHomeProtocol to allow changeable encryption handling, as the change does not change the payloads, only the encryption.
    • This likely requires breaking the API, or alternatively, adding a separate method to add username/password if those are used for the encryption as hinted in one of the comments above. Latter is preferred, using empty values (which seems to work for non-cloud connected devices).

Help needed from someone who wants to implement this! I have personally no plans nor time in the foreseeable future to brick my own devices, sorry, but I will gladly help however else I can with code reviews etc. :-)

Activity

  1. pinned this issue on Nov 16, 2020
  2. robbrad commented on Nov 17, 2020

    I’d be happy to pony up two broken plugs. Is it easier to liaise test (I’m quite technical and available on discord if that works) or me send you one?

  3. SimonWilkinson commented on Nov 17, 2020

    Contributor

    I've opened pull request #117 which is a simple implementation of the new encryption protocol, currently tested with an HS110 and the command line interface. Comments appreciated.

  4. Enzo-Matrix commented on Nov 25, 2020

    Please ensure the 9999/UDP functionality remains for devices that have not/will not be updated.

  5. rytilahti commented on Nov 25, 2020

    MemberAuthor

    @Enzo-Matrix, in the end, both protocol implementations should be work fine side-by-side with minor change (namely the authentication credentials input) required to use the new klap protocol. There will be no API changes for the 9999/UDP ("legacy") protocol, so no worries.

    @robbrad thanks for the offer, if you want to help with testing, check out the PR by @SimonWilkinson. To my understanding it should already be in a working state even when the implementation is not yet finished.

  6. robbrad commented on Nov 28, 2020

    @SimonWilkinson @rytilahti - I got Simon's PR cloned but when I do kasa --plug the broke plugs are not returned - any ideas?

  7. SimonWilkinson commented on Nov 28, 2020

    Contributor

    @robbrad - so this will depend on how your broken plugs are configured.

    If they are associated with a kasa cloud account, you will need to use kasa --user <email-address> --password <cloud-password> to discover them.

    If they still don't show up, use kasa --debug, and let me take a look at the output.

  8. robbrad commented on Nov 28, 2020

    OK got the debug - anything I should strip from this before sharing?

  9. SimonWilkinson commented on Nov 28, 2020

    Contributor

    Have a scan through and make sure there's nothing you'd rather not share.

    Providing you are using the PR with all of the changes, it won't log usernames or passwords. It will record device IDs, MAC addresses, names of and (possibly) location of plugs. It will contain some details of the authentication handshake, but not enough for anyone to be able to impersonate you to your plugs.

  10. robbrad commented on Nov 28, 2020

    Have a scan through and make sure there's nothing you'd rather not share.

    Providing you are using the PR with all of the changes, it won't log usernames or passwords. It will record device IDs, MAC addresses, names of and (possibly) location of plugs. It will contain some details of the authentication handshake, but not enough for anyone to be able to impersonate you to your plugs.

    Can I email you it - or im on discord?

  11. SimonWilkinson commented on Nov 28, 2020

    Contributor

    Email is probably easiest - simon@sxw.org.uk

  12. robbrad commented on Dec 1, 2020

    So @SimonWilkinson and I have been doing some debugging - on v4.1 and HS110 / HS100 plugs with the new PR. Initially it looks like HS110 works fine but HS100 crash/reboot on new protocol connection. Suspected that HS100 v4.1 doesnt like being asked for things it cant do. (energy monitoring?)

  13. SimonWilkinson commented on Dec 2, 2020

    Contributor

    Just to update here, we've confirmed that asking a software version 1.1.0 HS100 for emeter information crashes it. We either need to determine type and features from the discovery payload, or from a sysinfo query on its own.

  14. wilsonnkwan commented on Jan 10, 2021

    @SimonWilkinson, first time using this repo, so a total noob here. I am not sure what am I doing wrong.

    To use your github's repo version which I believe where your changed codes are, I used the manual instruction which is to git clone your repo's code, do poetry install. But problem, after the poetry install, it doesn't have the app "kasa"

    Doing the first method will get the latest kasa but that doesn't have your code in it I believe.

    Can teach me how to use your code to test? Much appreciated.

  15. rct commented on Jan 25, 2021

    @wilsonnkwan - the executable kasa winds up in the /bin of the Python virtual environment after the poetry install. If the python virtual env is activated source <path-to-env>/bin/active then that bin directory should get added to your path.

    Steps I used (from memory) which isn't quite what the docs say.

    As a regular user:

    • python3 -m venv /path/to/where/venv/should be.
    • source /path/to/where/venv/bin/activate
    • pip install poetry # poetry will only be installed for that virtual env.
    • git clone this repo.
    • cd python-kasa
    • poetry install

    If you wind up logging back in/etc. don't forget the activate step.

  16. GoliathLabs commented on May 18, 2021

    Found a project which might bring some light in the current situation. Correct me if I'm wrong 😄

    Kind Regards,
    thegoliath

  17. rytilahti commented on Nov 20, 2023

    MemberAuthor

    Fixed by #509

  18. unpinned this issue on Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL