TP-Link Kasa and Tapo Discovery

I have been playing with the Tapo devices for Hubitat (now they work) and had a user identify a problem with a Kasa KP125M (M=matter) plug (would not install). What I found out is interesting to consumers and developers (mainly me). And although TP-Link has not sunsetted the Kasa line (in the US), it looks like there are merging the interfaces going forward (makes matter implementation simpler).

TP-Link is replicating the TAPO API in new Kasa Devices.

Evidence: I used my tapo code (with RSA security) to discover, install, and control the KP125M.

How to tell the difference: Kasa LAN discovery will not work (I am fixing for cloud). On the cloud devicesList, the type is now "SMART.KASAPLUG", vice previous "IOT.KASAPLUGSWITCH". (the SMART.KASAPLUG matches the Tapo nomenclature SMART.TAPOPLUG.

Probable affected wifi devices
KP125M (MATTER) - proven
KH100 (hub) - working on proof

Quagmire is to update the community app to include the KP125M or create a common TP-Link infrastructure?

2 Likes

Sounds like they are easy enough to tell apart programmatically, and I assume the existing Kasa (pre-Tapo) interfaces are pretty stable.

Rather than have to go to great lengths to describe in user documentation which devices belong with which distinct integration, I would personally put them all in the same integration and let the code sort it out seamlessly for the user.

This is the path I took with my Broadlink integration, where there are two different API versions and the marketing names for devices don't always match what the expected API version would be.

1 Like

Since Hubitat has included my integration as built-in, I loose a lot of flexibility. I will have to discuss with @gopher.ny the path forward with minimal impact. Will probably list the non-compliant devices on the App start page and tell the user to install those using a tpLinkRsa community Integration. Still a lot to work out - but all technical issues are solved except automatically updating RSA tokens.

2 Likes

It seems like you could ease toward supporting the new devices in the built-in integration, based on yours and the Hubitat team's comfort level with your new code as it matures and stabilizes.

Telling users in the app that you detected a device that requires a different integration seems helpful. Later, you could add the ability to create the needed children using either community installed or built-in drivers based on your code.

What is it about being built-in that constricts your ability to add support when the time is right for the new protocol into the existing integration?

Hubitat assumes more responsibility for performance of built-in apps. Therefore, other than error corrections I like to pre-coordinate.

This is going to be an on-going issue as Kasa rolls-out new devices (especially Matter). They have built the RSA (Tapo) api porotcol into the Kasa phone app, so why would they continue to use the legacy (LINKIE) api in new devices. Cost $$ to maintain two api's across the many device types.

2 Likes

I would merge Kasa and Tapo into one device and just call it TP-Link Integration or something like that. Have the separate drivers like you already do to make it easy to identify devices, just add Tapo in as well.

Below is a list of short-term plans for TP-Link and Matter. I think the Kasa Matter devices will be like the Kasa KP125M (i.e., new Kasa Smart devices). @gopher.ny


Note - no Kasa Light Bulbs. Also note the NEW Thermostats. There is a Kasa Hub (KH100) that is the parent for the KE100 Thermostat - Radiator Valve (TRV) available in UK.

My roadmap is now defined.

Definition:

  • IOT API. The current Kasa API using port 9999, XOR encoding, and the command string: [component:[capability:[method[param1Name: param1Value, param2Name, param2Value,...]]]]
  • SMART API. The new TP-Link (currently TAPO) API using RSA handshaking, AES encryption, and the command string: [method:[params:[param1Name: param1Value, param2Name, param2Value,...]]]

Versions:

  • Upgrade the Kasa Integration to take the new SMART.KASA devices (using SMART API). This will take approximately one month for the community version and negotiation for the built-in version.
    1. It will include new drivers for the Hub, Hub children, and multi-plug children.
    2. It will have a soft exclusion for TAPO devices.
  • Clone the Above and make it TAPO only as a community integration. The soft exclusionwill be for Kasa devices.

I have created a manual driver for the KP125M Matter plug. Will integrate with the apps later.

Link: https://github.com/DaveGut/Test-Code/blob/master/README.md

1 Like

Hi all,

Any luck with the TP-Link Tapo integration? Or better a combined TP-Link Tapo & Kasa integration?

Regards
Max

Almost done with the Tapo integration. I think next week. I do not plan on combining the two. Although feasible, there are many api and protocol differences between the Legacy Kasa devices and the TAPO and Kasa Matter devices.

1 Like

Thanks. I will stick with just Tapo devices in this case.

I tried it on my new KP125M and getting a StackOverflowError:


any recommendations. I would love to get an Energy Monitor running on a few items and this seamed like a good way to do it.

Upgrade to the latest version and try again. The error above looks like your credentials are not correct (i.e., username and password). Handshake works, but login fails.

Path to latest integration: [RELEASE] TP-LINK TAPO Plug, Switch, Bulb, and Hub Integration

Thanks for looking at it. I checked password many times. I misspelled my name. Sorry to have requested help. You clearly stated that most problems are with name and password.