-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Add support for lightstrips (KL430) #74
Add support for lightstrips (KL430) #74
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loogs good to me
Thanks for the review, this is merely a draft until we get someone to test it. The commands can then be cleaned up prior the merge :-) |
I have a light strip but how do I test this? Where do I run "kasa --ledstrip --host " ? |
The simplest way is to do the following:
|
I've installed poetry but I still can't run "poetry install". How do I set up poetry? |
Update: I installed the dependencies with pip and now I am getting the following error message after running "python kasa" from the python-kasa directory: |
https://python-poetry.org/docs/#installation has the installation instructions for poetry, that's the simplest way to make sure your environment is correctly set. However, if you managed to install it manually, that is also fine. The command is |
I already tried to install poetry with this method and PowerShell is not
letting me run any poetry commands inside of the python-kasa directory. I
can only use the poetry commands if I am in the .poetry\bin directory. Can
I install pykasa from poetry\bin?
…On Mon, Jun 29, 2020 at 6:06 PM Teemu R. ***@***.***> wrote:
https://python-poetry.org/docs/#installation has the installation
instructions for poetry, that's the simplest way to make sure your
environment is correctly set. However, if you managed to install it
manually, that is also fine. The command is kasa, not python kasa (which
tries to execute python script with the name of kasa), so that's the
reason for the error.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APLETHHNWZEYKZ5XHOIKD5LRZE3AJANCNFSM4ODM4SDQ>
.
|
That's really odd, as the page says this:
As far as I know, the install command cannot be executed outside the source tree, but you could try to modify the PATH (https://stackoverflow.com/a/1333717 is perhaps relevant) to add poetry's bin directory to it. Or you could always simply execute the command using the whole path like |
OK, I have one of these KL430 light strips and I am versed in Python but don't know anything about Poetry (or anything Home Assistant aside from being a user). I have followed the instructions above (I didn't edit cli.py) and believe I have it all setup correctly. When I run 'poetry run kasa --ledstrip --host state', I get this result: Using python3.8 (3.8.0)
Traceback (most recent call last): I will continue poking at it. |
OK looks like smartbulb.py's TPLINK_KELVIN is missing a value for the KL430. According to the tech specs at https://www.kasasmart.com/us/products/smart-lighting/kasa-smart-led-light-strip-kl430, the color temperature range for the KL430 is 2500K to 9000K, so I added the KL430 to TPLINK_KELVIN using those values. Specifically I added 'r"KL430(US)": (2500, 9000),' below line 19 in smartbulb.py. Now I get this: Using python3.8 (3.8.0)
Is there more I can do to test this? What is needed? |
Thanks for testing and figuring out how to get it working, I'll adapt the PR based on your feedback! Could you check out if the commands are working correctly (on, off, hsv, temperature, etc.)? Are there some other locally controllable features that should be added? Also, it'd be great if you could contribute a fixture file (running `kasa dump-discover) for the unit tests (and for discovery). You could create a PR on top of this PR, then I can also add it to the test suite. |
* Use lightstrip instead of {led,light}strip consistently everywhere * The cli flag is now --lightstrip
b909b4c
to
16ae4ff
Compare
Codecov Report
@@ Coverage Diff @@
## master #74 +/- ##
==========================================
+ Coverage 72.37% 72.86% +0.48%
==========================================
Files 9 10 +1
Lines 1191 1227 +36
Branches 182 185 +3
==========================================
+ Hits 862 894 +32
- Misses 296 299 +3
- Partials 33 34 +1
Continue to review full report at Codecov.
|
Signed-off-by: Kevin Wells <darkoppressor@gmail.com>
OK, I submitted a PR for adding a fixture file for the KL430. @rytilahti, the PR is for merging my change to your fork. Let me know if that is the wrong way to do that, I've never actually done a PR on GitHub before... As for testing the commands:
discover: working
led: working (correctly doesn't work since this is not a plug...)
on: not working:
raw-command: did not test because I wasn't sure how
time: returns an empty string, but I assume that is OK because I don't think this thing has a clock |
Merged the fixture file, thanks! And thanks a lot for doing so thorough testing on it :-) So, looks like the sysinfo is the only thing that is working currently. You could manually modify the Or try this raw command:
(or Another way to figure the API out would be to sniff the traffic from the app, and use the |
OK, testing using the raw command method you outlined: brightness: working
hsv: working
off: working
on: working
temperature: working
|
Great! I just pushed the |
Initial PR to add support for KL430 and other light strips (if any). The API looks similar to smart bulb, only difference being a different service name.
kasa --ledstrip --host <host>
can be used for testing.TBD:
Closes #67.