A Diagnostic for TP-Link Kasa Smart Plugs on Your Network - A Quick Way to Test

Overview
A number of folks have noted various issues with Kasa smart plugs when used with Sense, including recent issues with a non-Sense-compatible version of the EP25. I tried this user-written utility on Github the other day, and found it to be incredibly useful for validating communication with all my Kasa smart plugs for 3 reasons:

  1. Indicative of Sense Integration - This utility communicates with the smart plugs exactly the way Sense does (via broadcasts) so results using it should be indicative of results with the Sense Kasa Integration. So if the utility sees a compatible smart plug, so should Sense. Conversely, if the utility encounters a smart plug (like the new V.26 EP25) that is incompatible or there is a network issue, neither the utility or Sense will see the smart plug. One of the big issues with the TP-Link Kasa phone app is that it uses a different mechanism so it will show Kasa devices that Sense can’t see.

  2. Fast Debugging - The utility gives a result in a few seconds after invoking, so you can try varying things with your network and smart plugs and see the results very quickly. Changes in network configuration or with smart plugs can take far longer to propagate back to visible changes in the Sense app. Plus you can quickly run anytime you notice a missing device or missing data.

  3. More Information - the utility gives lots of information about each smart plug, even more if the utility is used with the --debug option. And the text report the utility commands produce, can be redirected and piped in a unix environment to pull data in structured way. One use I’m thinking about is running the utility hourly (or more) using crontab to find intermittent issues that might stem from network loading.

Installation
For me, on a recent Mac, installation was easy and almost straight out of the “Getting Started” section of the Github project.

The only difference is that I had to invoke pip3 instead of pip.

pip3 install python-kasa

The only other thing I had to be aware of is that the install put the executable in the /Users/kevin/Library/Python/3.9/bin directory, so I have to invoke via:

/Users/kevin/Library/Python/3.9/bin/kasa discover

By grepping, I can see just the list of my Sense compatible smart plugs, and their models.


/Users/kevin/Library/Python/3.9/bin/kasa discover | grep '^=='

== Furnace Up - HS110(US) ==

== KP115 Roamer - KP115(US) ==

== HP LaserJet - HS110(US) ==

== Front Door Dragon - HS110(US) ==

== Kyle’s PC - HS110(US) ==

== Playroom Cluster - HS110(US) ==

== Yamaha - HS110(US) ==

== Kids Bathroom - HS110(US) ==

== Washing Machine - HS110(US) ==

== Traveling HS110 - HS110(US) ==

== Office Always On - HS110(US) ==

== Furnace Down - HS110(US) ==

== Master Bedroom - HS110(US) ==

== Recirculation Pump - HS110(US) ==

== Downstairs - HS110(US) ==

== TP-LINK_Power Strip_13D9 - HS300(US) ==

== TP-LINK_Power Strip_D4F6 - HS300(US) ==

== TP-LINK_Power Strip_FA05 - HS300(US) ==

== Ford Energi Charger - HS110(US) ==

If you are experiencing Kasa smart plug issues, I would recommend trying this utility. It can give you another view on whether the smart plugs are working the way Sense expects them to.

2 Likes

An update on python/kasa utility. Another user posted that python/kasa utility I’m highlighting in this post has been updated to talk to the Kasa smart plugs that are NOT Sense-compatible. He also sent the output for a v2.6 EP25.

When the new version of the utility is run in discovery mode, the non-compatible devices look very different than the Sense-compatible ones - A very different output that includes the model number, but not HW or SW version info, plus lots other parameters not found in the Sense compatible-device output.

$ kasa discover
Discovering devices on 255.255.255.255 for 3 seconds
== Authentication failed for device ==
	== Discovery Result ==
	Device Type:          SMART.KASAPLUG
	Device Model:         EP25(US)
	IP:                   192.168.51.76
	MAC:                  3C-52-A1-<omitted>
	Device Id (hash):     <omitted>
	Owner (hash):         <omitted>
	HW Ver:               None
	Is Support IOT Cloud: True)
	OBD Src:              tplink
	Factory Default:      False
		== Encryption Scheme ==
		Encrypt Type:     AES
		Is Support HTTPS: False
		HTTP Port:        80
		LV (Login Level): 2

To get the version information or power data (emeter info), a user has to “login” to the specific smart plug. That’s because Matter requires authenticate to do anything beyond discovering the device.

$ kasa --username $username --password $password --host 192.168.51.76
== Alien Life Support - EP25 ==
	Host: 192.168.51.76
	Port: 80
	Device state: True
	== Generic information ==
	Time:         2024-01-22 11:21:55-05:00 (tz: {'timezone': 'America/Denver'}
	Hardware:     2.6
	Software:     1.0.2 Build 231108 Rel.163012
	MAC (rssi):   3C:52:A1:<omitted> (-46)
	Location:     {'latitude': 37.2333678, 'longitude': -115.8128972}

	== Device specific information ==
	overheated: False
	signal_level: 3
	SSID: <omitted>
	On since: 2024-01-18 10:55:11
	auto_off_status: off
	auto_off_remain_time: 0

	== Current State ==
	<EmeterStatus power=10.664 voltage=None current=None total=0.155>

	== Modules ==
	+ <Module Emeter (emeter) for 192.168.51.76>