Unable to add TP Link EM plug to kasa Integration app

Hi @djgutheinz , one of my TPLink EM plugs lost its DHCP reservation and consequently received a new IP lease and stopped working on HE.

I created a new reservation ( Dlink won't let me delete/amend the current one) and I can see the device on the Kasa Integration app however I am unable to add it despite the fact that I removed the device from the Kasa Integration app, reset the device database, ran the search a few times now, rebooted the hub, rebooted my router, removed the device from the Kasa native app and re-added it.

Capture 2

Please can you assist?

Thanks in advance.

Try this and tell me if it works. What it is doing is assuring the device is awake. [Some of the newer devices have low power wifi chips that go to standby too soon. To make it worse, the devices appear to wake up but ignore the command that wakes them up. A second command is required.] This is handled in the driver but not in the application (technical reasons). Opening the phone app and assuring the device can be controlled assures it is awake.

See phone screen below. Note that Couch Right is shadowed. That is because the phone app has not detected the device on first try. It later comes into focus (2nd post). This may be what is happening to you (not sure).

  • Open the App to the first page.
  • Open your Kasa Phone app and make sure the device is controllable.
  • In the Kasa Integration App (Hubitat), select install and see if it works.

Discussion on your WiFi. Something caused the reservation to be ignored. It could be your wifi configuration, mesh systems or repeaters. So, if the above fails, some more information would help us and may point to the problem - if not solved by the above.

  • Kasa Device:
    • Model/year
    • firmware version (get this from the Phone app)
    • Path to your router (i.e., direct, range-extender, mesh)
  • Hubitat Hub
    • Model
    • Path to your router (i.e., direct, range-extender, mesh, wired)
    • If wifi, did you recently change to wifi?
  • Router:
    • Model?
    • Is it Wifi 6 (AX) capable? (Wifi 6 and legacy IOT devices can have issues. The Kasa devices and the Hubitat wifi dongle are legacy.)
    • Have you changed the internal wifi parameters recently (past month or so)?

Hi @djgutheinz , apologies for the late response but I got busy with work stuff.

I can confirm that I'd already checked the device for functionality on the Kasa app and ensured I could control it through there - I even deleted the plug then re-added it.

Before I saw your reply, I tried restoring HE to an earlier backup then the Kasa Integration app started working as expected again.

To answer your last questions though, the device model is KP115, firmware 1.0.17 and I am not using mesh - My Unify 6 LR access point broadcasts 3 different SSID and I have a dedicated one (2.4Ghz only) for my IOT devices & no changes were made recently. As for my HE, it's a C7, ver connected via the wired network.

Thanks for you assistance again. Cheers.

First. If it is working on the previous version, keep the previous version.

I have a KP115, fw version 1.0.18 and have not had any issues during a LOT of install testing during development (probably 100 times so far this year). But...

I strongly recommend that JUST PRIOR to discovery, you exercise the device on the Kasa Phone App. This will wake up the device if it is going to sleep (not all devices do this). I even have some bulbs that must be turned-on to be discovered the first time. I think that this is caused by new, low energy wifi chips.

The discovery design in the APP is simple:

  • Create sendHubCommand and send to the Hubitat OS.
  • Hubitat OS covers the actual sending message and receiving the respones.
  • If a response is received, the driver parses it; including generating an error message if the response is invalid.
  • if there is no response, hubitat times out the message and informs my driver. I generally ignore these as there is no device.

For the drivers, I have implemented a similar; however, if no response is received, I retry the command immediately. I still get some first-time failures, but rarely get more than 1 consecutive error. This is not practical in the app. It would just take too long to retry the timeout on the 240 devices that are simply not going to respond. (I will test this further - I really do not like the idea - but it may help.)

With literally thousands of successful messages from the Hub over the network (just in my house), Hub external factors are the likely cause:

  • Hub to router/switch issues (you are directly connected - but I have seen bad cables cause problems in my past experience)
  • Device issues (you saw that discussion earlier).
  • Interference from a wifi 6 communication
  • Wifi 6 prioritizes comms between wifi 6 connected devices
  • usually handled by disabling wifi 6 on the 2.4Ghz band
  • Something wrong with the mesh or range extender equipment (if used)

I really wish I could help more - but without your exact wifi configuration to play with, I have little hope.

what is the firmware version on it?

You can also change the Display settings in Unifi to display offline devices and from there you can turn off "set fixed IP address" for it.

I have decided to add a single-device at at time Manual Installation to the app. You would input the deviceIp and the app would cause the poll command up to four times (until a success is noted) with an increased timeout. Would then add that device to the array for adding with other devices.

It will take about 20 SLOC changes and an additional 40 SLOC plus regression testing for the other discovery methods.

Use would be suggested if you only have one device OR if you are having a problem with the app detecting your device.

Also, see the following thread on a Unify Router and wifi issue.

bleBox Device Integration - Developers / Code Share - Hubitat