3rd Party Library for Kasa

Posted on
Mon Aug 31, 2020 1:16 pm
vtmikel offline
Posts: 643
Joined: Aug 31, 2012
Location: Boston, MA

3rd Party Library for Kasa

I would like to utilize this library to build a plugin for the Kasa KL430 LED light strip, however the python library plus it's framework (asyncio) is Python 3.3+ only. Does anyone have any ideas of ways to make this work?

https://github.com/python-kasa/python-kasa

Posted on
Tue Sep 01, 2020 2:07 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: 3rd Party Library for Kasa

Unfortunately, I'm not sure there is a good / easy solution to this. You can either try to back-port that library to run on Indigo 2.7 (possibly finding a replacement for asyncio), or you use some type of IPC (interprocess communication) to have an Indigo Plugin (which always run under Python 2.7, at least for the short to near term future) communicate with the library running in a python process that is v3.3+.

Image

Posted on
Tue Sep 01, 2020 2:27 pm
vtmikel offline
Posts: 643
Joined: Aug 31, 2012
Location: Boston, MA

Re: 3rd Party Library for Kasa

That's what I feared. I'm thinking about going down the path you suggested with an intermediary. I'd put a basic ReST service together that will call the python library.

Posted on
Tue Sep 01, 2020 2:29 pm
vtmikel offline
Posts: 643
Joined: Aug 31, 2012
Location: Boston, MA

Re: 3rd Party Library for Kasa

I haven't decided if I will turn this into a plugin. Maybe just a script that is used in a trigger and I wont represent the kasa device as a indigo device. Unless someone has a seriously easy way to map a json object to a indigo device. Sounds like more trouble than it's worth but still thinking about it.

Posted on
Tue Sep 01, 2020 3:39 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: 3rd Party Library for Kasa

Actually, take a look at this plugin, and see the developer's sub-forum here.

Image

Posted on
Tue Sep 01, 2020 4:52 pm
vtmikel offline
Posts: 643
Joined: Aug 31, 2012
Location: Boston, MA

Re: 3rd Party Library for Kasa

I’ll check that out!


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Sep 02, 2020 12:12 am
siclark offline
Posts: 1960
Joined: Jun 13, 2017
Location: UK

Re: 3rd Party Library for Kasa

There is a TP-Link Kasa plug-in already. Does that not work for this light?


TP-Link Plugin - How To (v0.1.2)
https://r.tapatalk.com/shareLink/topic? ... source=app

Posted on
Thu Sep 10, 2020 7:02 am
vtmikel offline
Posts: 643
Joined: Aug 31, 2012
Location: Boston, MA

Re: 3rd Party Library for Kasa

Realized I did not respond to this:

siclark wrote:
There is a TP-Link Kasa plug-in already. Does that not work for this light?


TP-Link Plugin - How To (v0.1.2)
https://r.tapatalk.com/shareLink/topic? ... source=app


The TP-Link plugin does not appear to support lights, but I did not confirm with the plugin author. The underlying library the plugin uses doesnt seem to be getting updated any longer.

I thought about forking and making the additions to support the broader Kasa product library myself, but I'm not really up for maintaining the library. The library that already supports the broader product family is quite thourough and well maintained, but Python 3 only.

I've written a very basic ReST API using Python Flask. It can be hosted on the Flask dev server or something like gunicorn. I personally have it running on a LXC container. I also have used the GhostXML plugin to create Indigo devices for each light. I forked the GhostXML plugin and added a native RGBW device so that it can send commands to the lights.

I'm going to continue to test for reliability. I'm happy to share any and all of this code if anyone else wants to have a Kasa device natively supported in Indigo. I dont think this will turn into a plugin as the requirement for a external to Indigo web server may be a bit much for most people to take on. Open to ideas.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests