⚡ Improve TP-Link driver interaction #86
Labels
bug
Something isn't working
difficulty:hard
Issue will be a challenge to complete
driver
Issue is about a driver
help wanted
Extra attention is needed
priority
This issue needs immediate attention.
Milestone
The TP-Link driver "works", but it has a latency that I can't figure out.
I own 3 HS220 dimmers from Kasa. The DrMem driver can control them, but it can take up to 3 seconds for a change to occur. I believe it should be much quicker.
I based the design of the driver from information gleaned from tplink_smartplug.py and tplink-smarthome-commands.txt.
When the driver sends the command, it takes up to 3 seconds before a reply is received. What's confusing is that the Python script (mentioned above) almost always gets a reply in less than 10 ms! As of the latest commit, the DrMem driver sends the EXACT same request packet as the Python script, and yet it consistently gets a delayed response.
This is a
tcpdump
of the DrMem driver trying to turn on the LED indicator:and this is the Python script:
The TP-Link protocol uses a weak, XOR form of encryption so you can't read the JSON payload. However, you can see that the DrMem packet contents is the same as Python's. And you can see the replies are the same. It's just DrMem's interaction always has that middle reply from the dimmer that never gets sent when it's from Python.
Both, the Python script and DrMem, are running on the same machine -- so it's not an OS difference.
Right now, I need to work on other items in DrMem. This driver works -- even though it takes a awhile for it to perform a command. Maybe someone can see what I'm missing or come up with a test to make this work.
The text was updated successfully, but these errors were encountered: