caseyjhol / node-red-contrib-tplink

A collection of Node-RED nodes for TP-Link Smart Home devices
https://www.npmjs.com/package/node-red-contrib-tplink-iot
MIT License
16 stars 15 forks source link

Energy Usage - Get the Total Consumption (kWh) for "Today" #56

Open StuFrankish opened 3 years ago

StuFrankish commented 3 years ago

I use several KP115 smart plugs with energy monitoring to feed an Energy Meter integration in Home Assistant. Quite often, the plugs will become unresponsive / disconnect from wifi. After a power cycle (cutting power to the smart plug itself), the plug returns to operation but the statistics in the "getMeterInfo" command are all empty. So when my NodeRed loop runs to query the data, all the energy usage is reset and I end up with what appears to be energy returned rather than no continued usage.

The Kasa app has several statistics that appear to survive the restart of the device - all of the runtime data, and as far as I can tell, the Total Consumption for "Today" in kWh. There doesn't appear to be any command in the available nodes that returns this data - I have tried all commands and everything appears reset.

Is there a way to access this information that the app appears to have access to and expose it through the nodes commands?

Here's an image of the output of "getMeterInfo"; The fact that the data appears under a dedicated object call realtime suggests there are further stats that are not currently available. image

Here's an image of the Kasa app for the same smart plug, apparently with today's energy usage still intact. image image