Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kasa "group" support #533

Open
ccolumbu999 opened this issue Oct 29, 2023 · 3 comments
Open

Kasa "group" support #533

ccolumbu999 opened this issue Oct 29, 2023 · 3 comments

Comments

@ccolumbu999
Copy link

ccolumbu999 commented Oct 29, 2023

As I understand it the Kasa app allows you to create a "group" which is essentially a virtual N-way set (N-way being 3-way, 4-way. 5-way etc).
Meaning I can take 2 HS200 switches in different parts of the house (i.e. no traveler between the boxes) and link them so when I turn either one on or off both will go to that state.

If you can give me the raw commands to do it that would be a good solution, if you can add a --group function to python-kasa that would be a GREAT solution.

If you give me the correct raw commands, but can't add a python-kasa --group function I will try to write a patch for it.
I have been a software developer for about 30 years, but I just started learning python about a month ago.

Thank you for writing and maintaining python-kasa.

@rytilahti
Copy link
Member

Hi @ccolumbu999, the API this library implements is for local (poll) communications only, so if those "group" feature involves event-based actions, it is either being done over the cloud connection or using device triggers.

The device triggers (see #456 and the API docs linked in there) are not currently implemented so figuring out how it works for such use case would require some work to figure out how to interact with them and implement that in this library.

If they are done over the cloud connection, there is not much we can do here. To my understanding, the users of this library are commonly using it through some sort of home automation platform like home assistant, and use their facilities to perform that type of synchronization on top of them.

@ccolumbu999
Copy link
Author

Hi rytilahti,
Thank you so much for your reply.
I am firmly in the no cloud camp, and I have never seen or installed the app.
I used python-kasa to join the switches to my wifi.
I don't know how TP-link has implemented the group feature (i.e. cloud connection or device triggers).
I am hoping for local device triggers.

A little background, I have loads of insteon switches. As you may know they went out of business.
One of the biggest advantages/features of their switches was the ability to create these N-way groups though a simple series of "set switch" press and hold or short taps on the switches themselves. No hub, no app, nothing else needed. They talked to each other via their own mesh network.
It was very fast, reliable, and easy to set them up.
I am hoping for something similar here with the Kasa switches and python-kasa.

I know I can create the virtual N-ways via Home Assistant (and have tested that), but that adds a dependency and there is a pretty big delay (compared to the insteon switches) when the 2nd switch is triggered.

If someone was willing to research the local device trigger possibility it would be greatly appreciated.
I am guessing this is not going to be a high priority, but I actually think if it can be done via python-kasa it would be a significant improvement to the python-kasa library.

I have done a very very small amount of packet sniffing with wireshark, but I don't feel confident that I am capable of discovering the traffic/commands myself.

@rytilahti
Copy link
Member

Hi @ccolumbu999 and sorry for not getting back to you earlier.

So, if (and that's a big if) those groups are communicated from device to device instead of via the cloud, you should be able to see the packets with wireshark. You can use either the wireshark dissector linked in the README.md, or the parse_pcap.py if you have a packet trace to easily check the commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants