Kasa Devices Spamming HE

Up time is over 1h13m and no issues despite the debug still being on for the test plug.
Overall devices logs appear to be low compared to before:

Now

Before

1 Like

That's good. Might be worth checking over your setup with Dave in the morning (just to make sure), and working through the setup of Hub Info with @thebearmay when you have some time (maybe sometime soon :slight_smile: )

1 Like

Hmmm. Not sure why you’d get that error just did a repair from HPM on it to check and didn’t get the error although the message you’re gettting is pointing to the driver code and not the manifest.

Trying to remember if there is a way to "refresh" the repo's in HPM?....

I used this link:

That link can be used in the Import option when adding or updating the code directly via the Drivers Code tab (outside of HPM). Could use it to do a manual install, and then do Match Up from HPM to let HPM know to monitor it for changes.

I've just attempted this but it threw an error too:

You’re in the Apps Code tab, go to the Drivers Code..

I thought it was an app - Worked now, thank you:

Where do I find the actual stats from the driver code?

1 Like

Go into the device page, and hit Configure and then set up the polling options for the attributes you want to monitor and Save Preferences. One of the options most people use is the ability to generate an html attribute for dashboards that will display the most commonly used information. If you’re looking for detailed trending, you might want to consider exporting the events to something like InfluxDb/Grafana to do charts, i.e.

1 Like

Fantastic, I'll give this a shot over the next few days.

Thank you so much for this, that's much appreciated.

1 Like

I disabled this option and reduced these messages to a minimum (Info). For devices, these only occur on an attribute change. They in-log verify proper operation w/o correlating to the events tab.

If you must have, I can reintroduce in next version.
Dave

1 Like

Summary for what happened
The code went into a data request loop while getting the current EM Statistics. Fix is in new release 6.5.1. Temporary fix is disable EM function from devices, restart the hub, then update to 6.5.1 and re-enable EM functions.

This was caused by the below code not working as expected (my error obviously).

def month = new Date().format("M").toInteger() 
if (month != 1) { 
    setLastMonth(response) 
} else {
    (request previous years monthly statistics for last month)
}

Code would read the first statement as false and always go to the second statement - causing the loop.

Interesting, the fix was to reverse the logic. No change in data types nor anything else.

def month = new Date().format("M").toInteger() 
if (month == 1) { 
    (request previous years monthly statistics for last month)
} else {
    setLastMonth(response) 
}

Still not sure why.
I found another error that was my fault (first year with a full year of data). Also fixed that.

4 Likes

Thank you so much for this - I updated it to 6.5.1 and the issue has been solved.

2 Likes

Hey everyone, I have this same issue, but tried the solution above with no luck (disable EM, restart, update [although, I didn't need the update], enable EM).
The EM plug was sitting at 133,000,000 before my restart, in a 24 hour period. Event/history states are at 11.
This is my only Kasa plug that I use EM for (for now).

Any ideas?

That looks like it may still be ok....maybe... but to be sure...

To test, open the Device Edit page for the plug, along with a second tab displaying the logs for the HE hub.
Enable 30 mins of Debug logging for the plug in the Preference Settings, then save preference.
Check the logs immediately after this change. If you see a continuous stream of logs for the device, then you do still have a problem. If you see anywhere from 15-30 logs, but importantly, then a break in the debug logs until the next poll, then you are ok.

Yeah the logs are crazy with debug on

Hmmm... What driver is shown on the Device Edit page (the Type drop-down next to the name). Note that and then check the Drivers Code page to see if that driver is listed more than once. Both pieces of info may be useful...

Driver is Kasa EM Plug, and the driver code is only listed once.
Date on the code is 24/12.
I just re-imported the code to see if that makes a difference too.

1 Like

For now that should hopefully do the trick, you will just need to go through those original steps again of disabling EM, reboot, etc

1 Like

Download the Hubitat app