DaveGut / HubitatActive

Hubitat Environment Developments
64 stars 87 forks source link

KP125 Polling Interval and energy-monitoring alerts #25

Closed snarkywolverine closed 2 years ago

snarkywolverine commented 2 years ago

I have a Kasa KP125, which supports energy monitoring. My goal is to have hubitat send me alerts whenever the power draw drops below a threshold (i.e., the downstream device is turned off).

I have configured a static IP (via DHCP lease) on my router for my Kasa plug, which has driver version 6.6.0, and the plug is set to control via LOCAL (not cloud). However, I'm seeing a couple of things I can't quite make sense of -- and the troubleshooting guide didn't really help with.

(1) I tried to change the setPollInterval in the dropdown to something other than 30 minutes, but it seems I can't. After changing the dropdown, I've tried to hit 'save device' or 'save preferences' to lock in a new time window, but upon refresh, the setting is still set to 'default' in the dropdown, and 30 minutes in the "State Variables" section.

(2) In the event logs, I saw a few log entries for power and energy usage, but the last one was over a week ago - I'm not sure how to troubleshoot this (I don't see any failure events either). Would log values show up if the switch was in the 'off' state? What if it were switched on manually (at the plug)?

In the course of troubleshooting, I tried to use the IP Comms test tool - but it showed no Kasa devices installed (???). However, when I go to the switch in Hubitat, I can still turn it on/off (the switch responds accordingly, and the logs show a switch on/off event). Note: I didn't reset the device DB, since I still have basic communication with the devices (but am happy to if that would make a difference here).

I can enable debug logs and try some things if that helps - but how would I retrieve those debug logs -- are they written to the same events view, or are they in a different location to retrieve?

I've only had the kasa plugs for a couple weeks - looking forward to getting them to be more stable. Any wisdom here?

DaveGut commented 2 years ago

"(1) I tried to change the setPollInterval in the dropdown to something other than 30 minutes, but it seems I can't. After changing the dropdown, I've tried to hit 'save device' or 'save preferences' to lock in a new time window, but upon refresh, the setting is still set to 'default' in the dropdown, and 30 minutes in the "State Variables" section."

"(2) In the event logs, I saw a few log entries for power and energy usage, but the last one was over a week ago - I'm not sure how to troubleshoot this (I don't see any failure events either). Would log values show up if the switch was in the 'off' state? What if it were switched on manually (at the plug)?"

"In the course of troubleshooting, I tried to use the IP Comms test tool - but it showed no Kasa devices installed (???). However, when I go to the switch in Hubitat, I can still turn it on/off (the switch responds accordingly, and the logs show a switch on/off event). Note: I didn't reset the device DB, since I still have basic communication with the devices (but am happy to if that would make a difference here)."

snarkywolverine commented 2 years ago

Thanks for your guidance! The first bullet is solved - I'm not sure why I didn't think of hitting the setPollInterval button after setting a new value.

For (2), I had EM enabled for a lengthy period of time but only saw two jobs - poll, and one that sounded related to energy polling (but it was scheduled for ONCE, not a recurring interval). I have since disabled EM and will reenable in a little while.

For (3), I'm not so much concerned about that not working as wondering if that was an indication that something isn't right in my environment.

Will update after I reenable energy monitoring on the device.

snarkywolverine commented 2 years ago

I had energy monitoring disabled for about an hour yesterday before re-enabling it. It has now been over 20 hours since re-enabling, and there are no scheduled jobs listed at the bottom of the device page -- how do I get those added/restored?

DaveGut commented 2 years ago

The preferences section should look like the below: image

The ScheduleJobs should look like the below: image

snarkywolverine commented 2 years ago

Thanks for the screenshot - for some reason "Kasa Cloud Binding" was checked in preferences. After I removed it, I got three of the scheduled jobs, plus a bunch of power events.

I don't see 'getEnergyToday' in my scheduled job list. I'm guessing I shouldn't be concerned?

image

Thanks for your help with this!