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

Lightbulbs appear offline but work fine with Tapo app. #23

Open
Leekao opened this issue Nov 11, 2023 · 4 comments
Open

Lightbulbs appear offline but work fine with Tapo app. #23

Leekao opened this issue Nov 11, 2023 · 4 comments

Comments

@Leekao
Copy link

Leekao commented Nov 11, 2023

I have 4 Tapo Lightbulbs connected, all 4 are working fine with Tapo app, kasa.getDevices() works but every Lightbulb I try to connect to returns the error Device is offline, any idea why or how to fix?

@konsumer
Copy link
Owner

konsumer commented Nov 11, 2023

I am not sure what is going on.

I have 6 devices on my network, to test, only 1 says offline, but it's similar to your situation (checked are good):

  • LB120(US) - 1.8.11 Build 191113 Rel.105336
  • LB130(US) - 1.8.6 Build 180809 Rel.091659
  • KL60(US) - 1.1.13 Build 210524 Rel.082619
  • LB130(US) - 1.8.6 Build 180809 Rel.091659
  • HS200(US) - 1.5.5 Build 181204 Rel.081041
  • HS200(US) - 1.5.5 Build 181204 Rel.081041

Here is the code I used:

import KasaControl from 'kasa_control'

const kasa = new KasaControl()
const { KASA_EMAIL, KASA_PASSWORD } = process.env
if (!KASA_EMAIL || !KASA_PASSWORD) {
  console.error('Set KASA_EMAIL & KASA_PASSWORD in your environment.')
  process.exit(1)
}
await kasa.login(KASA_EMAIL, KASA_PASSWORD)

// turn all lights off
for (const { deviceId, deviceModel, fwVer } of await kasa.getDevices()) {
  try {
    await kasa.power(deviceId, false)
    console.log(`- [X] ${deviceModel} - ${fwVer}`)
  }catch(e) {
    console.log(`- [ ] ${deviceModel} - ${fwVer}`)
  }
}

So maybe it is a problem with the specific device/firmware.

If you are cool with controlling it directly (not running via Kasa Cloud) you might have better luck with my other lib: tplink-lightbulb. It sends messages over wifi directly, instead of routing through Kasa Cloud. I prefer this method because it doesn't require the internet/external-servers (still needs local wifi, though)

@konsumer
Copy link
Owner

konsumer commented Nov 11, 2023

I just tested with local, and see that the light that is showing up offline for me, is indeed offline (old light I added to app.) So it seems I can't reproduce, with any devices I have for testing.

Running local I did this:

tplight scan
Press Ctrl-C to stop
192.168.86.25 - Office - KL60(US)
192.168.86.235 - livingroom - LB130(US)
192.168.86.26 - Porch - HS200(US)
192.168.86.29 - Entryway - HS200(US)
192.168.87.22 - bathroom light - LB130(US)

(no LB120) but all the others seems to work fine with local or kasa. What is the model-number? What version of firmware does the device use?

@konsumer
Copy link
Owner

konsumer commented Nov 11, 2023

This library only works for Kasa-compatible devices (I am testing with tplink bulbs/switches/outlets, that send you to the Kasa ap) not sure what tapo is (they look similar, but it is a different brand) maybe try the regular kasa app and see if it works, first, then we might be able to add support to this lib, if it's similar (sounds similar.) The output from kasa.getDevices() (specifically fwVer/deviceModel/appServerUrl) would be very helpful.

According to this they don't work together, but maybe in the future. I am really not sure, since I don't have any Tapo test-devices.

@konsumer
Copy link
Owner

konsumer commented Nov 12, 2023

As another test, I installed Tapo app, and it seems to control the same lights I have for testing, and I see all the same stuff with kasa app, and even used the same auth-credentials, so I have a strong feeling they are compatible, just need more info for testing. I will buy a 2-pack of Tapo bulbs (it's only $12 and I could use a couple more RGBW lights, anyway) and I will see if I can reverse the (similar) protocol.

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