[RELEASE] TP-LINK TAPO Plug, Switch, Bulb, Hub and Robovac Integration

YES. All of my TP-Link (Kasa and Tapo) had the same issue last night simultaneously. Seems like a system-wide reset (yikes).

The forbidden message is (one case) caused by the HTTP path not being valid. What was made invalid is the token data and sequence number. If either of these were reset, then the errors. After several errors, the device (driver code) will try to recover once. After that it will wait until the user selects configure, the periodic deviceHandshake occurs (every three hours), or the app is run updating the device's data and commanding configure.

Bottom line, if you are not reviewing logs and nothing is wrong with the device itself, the recovery is eventually automatic. Therefore, the initial message is a info message. If it does not recover, you will get a failure message.

Has there been any further movement on adding the "Ring" property to the doorbells? If there is anything I can do to help...

1 Like

Sorry, been busy on other things. Will look at next year.

1 Like

OK. Final answer. The Tapo doorbells do not expose the "ring" event to the LAN API activity log. The Motion is available (1-6 sec delay with 5 second polling interval) as a Hubitat event.

Note on BATTERY Doorbells: I have a D210 (can not be hard-wired). It is not suitable for Hubitat event detection due to battery power drain on any automatic polling. It can be controlled via Hubitat with an acceptable power drain. May not be true for the D230.

Darn. Thanks for looking into it.

I recently purchased a Tapo Smart Outlet Matter version P210M, using Tapo Integration the Tapo plug is added into Hubitat but there is no plug 1 & plug 2 option to control the outlets, I assume I missing drivers but can't find any.

Go to preferences, select "Install Child Devices" and save.

I do need to darn some socks. More serious, one idea for capturing the camera events into hubitat:

Buy a cheap Tapo Matter plug (about 10$) and install it in the Tapo phone App then Hubitat as a Matter Plug (interestingly, the Tapo phoneapp acts as an Matter initiator for tapo Matter plugs - so you do not have to install in amazon/google/smart things first). Next:

  • Install as a Matter device in Hubitat. It would not be used for anything else.
  • In the Tapo phone app, set up a smart action triggered by a doorbell ring. It would turn on the plug, wait 30 seconds, then turn off the plug after a 20 second wait.
  • Set up a Hubitat rule to start follow-on actions when the plug switch value turns to "ON"

You could also use an existing spare plug with a 5 second poll interval - but matter event transfer into Hubitat is almost instantaneous.

I have tested this using a Tapo Matter bulb. Works like a charm. I have rules for motion and then ring. Motion turns the bulb on to 30% and a ring to 100%. Can then use Hubitat rules for both detections. (I also set the bulb to a window by the door and turn to RED on motion and White on ring.) Bulb has some nuancesL
a. Must initiate matter via amazon/google/smartThings.
b. The light is great for hearing impaired or just as a visual alert on it's own.
c. My house has a window next to the front door. Really gets attention when the light turns on. Scares animals away and alerts intruders that they are being watched.

Thank you, that worked.

1 Like

What I ended up doing is:

  • I added the Kasa skill to Alexa.
  • Then I created a virtual switch in HE.
  • Then a routine in Alexa to turn on the virtual switch when the doorbell button is pressed.
  • Then a piston in Webcore to turn on my porch light when the virtual switch is on.

Works fine, if a little kludgy. I have the camera itself recording to Synology Surveillience station. I just wanted the porch light to turn on to help me on those nights when I come in late.

I'm having trouble getting my first Tapo device to be discovered. It's the P100 non-Matter plug. It's alive, exercised through the app, but cannot be discovered. I can ping the IP on our network and it responds. I've ensured that the scan range includes the IP and that it's on the same subnet as the hubitat.

any hope of ever getting cloud support back? .. i still have devices that are on a secondary network for backup and therefore not reacheable on the hubitat network.. would be nice if i could get myrules to control them working again.

In the Tapo app, you need to enable Third Party Compatibility. See the quick start instructions at the top of the app.

image

It may take a while for the device to update. Also, some debug logs would be helpful if this does not work. This will actually allow me to do something.

This integration never had cloud support. However, the Kasa did and it died when Kasa killed their cloud and moved everything to Tapo.

When I have some spare time from appointments I will see what can be done as a SEPARATE community app or set of device drivers. But absolutely no guarantee.

Dave

1 Like

Thanks. I certainly read the Quick Instructions, though I skipped the task about enabling third-party integration on my account since I already did it days prior. But just to be sure, I disabled it and re-enabled it since I already had the P100 plug added to my Tapo account. That being said, I'm still unable to add the device to the app.

Note: I am 1000% sure my Tapo credentials are correct.

Here's the debug log snippet:

app:7652026-01-07 06:33:30.825 AMdebugTapo Integration-2.4.2a: [method:getInstalledDrivers, drivers:[Samsung TV Remote, TpLink Child Plug, TpLink Hub Plug, TpLink Parent, TpLink Plug, TpLink Plug]]
app:7652026-01-07 06:33:25.548 AMdebugTapo Integration-2.4.2a: [method:udpTimeout, status:no devices found, error:udpTimeout]
app:7652026-01-07 06:33:10.577 AMinfoTapo Integration-2.4.2a: [method:findTpLinkDevices, action:getTpLinkLanData, timeOut:10, hostArray:[109, 109], pollSegments:[192.168.1], pollSegment:192.168.1, pass1:port 20002, pass2:port 20004]
app:7652026-01-07 06:32:54.968 AMdebugTapo Integration-2.4.2a: [method:getAllTpLinkDeviceData, discData:1]
app:7652026-01-07 06:32:54.937 AMwarnTapo Integration-2.4.2a: [method:sendKlapDataCmd, handshake:[method:parseKlapHandshake2, respStatus:LOGIN FAILED, reason:ERROR in HTTP response, resp:[headers:[Connection:close, Content-Length:1, Content-Type:application/json;charset=UTF-8], warningMessages:[], class:class hubitat.scheduling.AsyncResponse, status:200, data:AQ==]], data:[data:[devData:[udpPort:4e22, type:SMART.TAPOPLUG, model:P100, baseUrl:http://192.168.1.109:80/app, dni:1C3BF335380E, ip:192.168.1.109, port:80, protocol:KLAP, status:OK], cookie:TP_SESSIONID=39ECD01D599C5825292C502199145425, seqNo:1141770872, encIv:[10, -108, 87, -114, -79, 60, 53, 22, -115, -41, 71, -33], encSig:[-80, 117, 100, -116, -97, -52, 19, -58, -69, 116, 123, 86, 42, 110, -58, 106, 37, -2, -27, 124, -115, 84, -16, -115, 81, -104, 10, 97], encKey:[-88, 16, 54, -52, -16, -32, 102, -7, 8, 47, -60, -64, 53, 125, 59, -92], hs1Success:true]]]
app:7652026-01-07 06:32:54.932 AMwarnTapo Integration-2.4.2a: [method:parseKlapHandshake2, respStatus:LOGIN FAILED, reason:ERROR in HTTP response, resp:[headers:[Connection:close, Content-Length:1, Content-Type:application/json;charset=UTF-8], warningMessages:[], class:class hubitat.scheduling.AsyncResponse, status:200, data:AQ==]]
app:7652026-01-07 06:32:54.579 AMdebugTapo Integration-2.4.2a: [parseKlapHandshake:[devData:[udpPort:4e22, type:SMART.TAPOPLUG, model:P100, baseUrl:http://192.168.1.109:80/app, dni:1C3BF335380E, ip:192.168.1.109, port:80, protocol:KLAP, status:OK]]]
app:7652026-01-07 06:32:53.953 AMdebugTapo Integration-2.4.2a: [udpPort:4e22, type:SMART.TAPOPLUG, model:P100, baseUrl:http://192.168.1.109:80/app, dni:1C3BF335380E, ip:192.168.1.109, port:80, protocol:KLAP, status:OK]

@djgutheinz - This seems to be the same issue I'm experiencing.

Need some quick piece of data from the App data - settings. I need the approximate lengths of the following to validate the credentials were created properly

  1. encPassword
  2. encUsername
  3. localHash
  4. userName
  5. userPassword

(As much for me as for you)
What the messages mean:

  • The device is found using the UDP message.
  • The first handshake was successful and returned the data to encrypt the session-specific encryption data.
    • Uses the localHash - a multi-encoded version of your password and credential data.
    • return data is used to generate the initial comms sequence number and the AES encoding vectors/key.
  • The second (Login) fails internally. It does provide validation that proper format data is returned.

Investigation will concentrate on what happens with invalid credentials and then what happens if the Third party is enabled.

Possibly.

Error is in the Handshake2 response (so the Handshake2 query). No matter how I change the query for handshake2, I am unable to generate the error you are getting. I have ordered a P100 so I can see better what is going on. Note: This is the oldest device in the Tapo array - so who knows. Device arrives Saturday.

Found a Problem Report in another integration. Basically says that the P100 (and only the P100) has an issue with synchronous comms where one message follows another without a wait. This causes the follow-on message to fail. This may be applicable to the failing message here (or may not).

Did a quick test for adverse impact on my other devices. Need to know if it possibly corrects your issue.

Test: Modify the Tapo Integration Application at line 1877 to insert a pause

From:

1877:  asynchttpPost("parseKlapHandshake2", reqParams, [data: reqData])

To;

1877:     pauseExecution(500)
1878:     asynchttpPost("parseKlapHandshake2", reqParams, [data: reqData])

Need logs if it fails.

I got the P100 I ordered today. Did not update firmware, so does not use same Protocol as yours. Will wait a few days and see if the firmware updates. (sigh)

If it does not work initially, CHANGE the "pauseExecution(500)" to "pauseExecution(2000)"

Testing on my earlier version and different protocol P100 required the pause to work. Solved with that.