-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Unable to scan or connect to wifi #60
Comments
This is a new feature, so bare with us. It appears this is only for scanning for what wifi the bub sees, so you might be able to jump directly to I think it's this part I am guessing that Would you mind installing node and running it that way, if you haven't already? This should work on kubuntu curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs git After that, get a fresh copy and run it directly from the js file: git clone https://github.com/konsumer/tplink-lightbulb.git
cd tplink-lightbulb
npm i
# now this is essentially the same as the regular CLI too
node ./src/cli.js wifi <IP_OF_BULB> This will probably give you the same error, but you can edit src/cli.js to give some debugging. In this part just remove this line: .then(r => r.netif.get_scaninfo.ap_list) then run |
Good catch on the quotes, hadn't thought to try that. I factory reset the bulb and tried with both quoted (using the copy I got from npm) but still got the same error. After cloning the repo I got the same error with 1 additional line:
After commenting out line 82 in
I also tried join with the git copy, both with that line commented and without. Errors are identical to |
It looks like this is sending
After changing this line to
Seems like this part could be fixed by trying However, I'm still unable to join after making this change - but I get a new error:
I then reverted my changes to I was able to connect after editing
So something seems to be going wrong when it parses for |
Hmm, I probably need some checking for model to figure out the correct shape. |
That would be much cleaner than my idea haha, I didn't realize I could get the model with Any idea what's going on with |
find should be Array.find so my guess is wifi is not an array ( |
I just added some tooling and I was super-annoyed with the old ES style (I like ES6 with builds for older node.) If you want to run from git, now you have to So, with my new tools setup and improvements all around, I wrote a script that works on my network to scan and I think I have it working for both style devices, in the CLI tool. Can you try the CLI tool to scan/setup wifi, and if it doesn't work, try modifying the bash script to get it working? Lines that start with I am hoping the changes I made will just work for you, now, but we might need to play with it a bit to get it working. Here is my script I used to test raw messages & try out each part. if the regular |
I do wish I had more info about how to know what kind of message a device wants (from firmware id or something) It would be cool to not have to fallthrough. You can see the library does this quite a bit, but it'd be neat to just know what kind of message to send before I send it. |
The python script uses all of what I am calling "new style", but I actually don't know which came first, the messages that are longer, like Maybe we could all collect some version-numbers, and what style the device supports to save 1 failed operation (which retrys with other format) for some devices.
It might be a simple: const msg = (this.info.hw_ver === '2.0) ? newMessage : oldMessage or similar |
Wow looks like a pretty significant rewrite, great work! After cloning the repo everything seems to be working fine! Here's everything I tried, devices were factory reset before each test:
I didn't even need to mess with the bash script, everything worked fine with One very minor note: when scanning for networks the output formatting is different depending on if the device uses "old style" or "new style". Doesn't really matter since the user will likely only see one or the other, but probably an easy fix. Device using
Device using
|
Awesome!
Yep. I actually work around it by guessing some of the missing fields in the less-verbose output. I could map it so it looks the same, but I kinda like it give more info if the bulb supports it. |
Ah neat, yeah not a real issue just wanted to point it out in case it was unintentional. |
Unfortunately I did notice that |
Ah, that sucks. Well, the fall-through method seems to work ok for wifi setup and others, so I think I will close this issue, but make a new issue for working out better message-format selection, in the future. |
Here's the full details for all my devices in case it's helpful. Couple possibilities:
Thanks again! |
Agreed. I'd prefer to not keep a big table of all the supported versions (it's more fragile, and requires a lot more maintenance.) I think we might be able to try some other stuff to figure it out, though. I am ok with the fall-through for now, but I bet it could be improved.
I saw this on mine, too. super-weird. Please continue tracking this issue at #61, as it's really a separate thing. |
OS: Kubuntu 20.04
Node: v14.17.2
Bulb: KL130
There appears to be a bug effecting wifi onboarding - I received the same error when attempting to scan available networks and connect to a network (both while connected to the bulb's setup network). Other functions I tried (turn light on/off, change color temp) worked perfectly. To rule out issues with my node setup, I fresh installed node on a different computer (same OS + node version) and got identical errors.
Scan:
Connect:
Unfortunately I'm not able to debug this as I don't know javascript.
I can however confirm that the bulb is capable of connecting without the kasa app. I had previously used this python client to onboard and control my TP-Link HS220 smart dimmers. It includes an option for sending raw JSON to the device from CLI. However, it didn't work with my new KL130 bulb which led me to this project.
After reading this commit, I noticed that the first JSON parameter is different than what I had used for the dimmers (Bulb=
smartlife.iot.common.softaponboarding
, dimmer=netif
), while the rest was identical. I went back to the python client and swapped these parameters out. The bulb connected without issue, confirming that TP-Link hasn't disabled this with a firmware update.While I'm not able to debug, I'd be happy to reproduce the problem and test out potential solutions if that would help. Great project, much more user-friendly than what I had used previously!
The text was updated successfully, but these errors were encountered: