tplink-energy-monitor icon indicating copy to clipboard operation
tplink-energy-monitor copied to clipboard

Pulling historical data from the switches

Open slvrscoobie opened this issue 5 years ago • 5 comments

Is there a way to pull that Monthly data down to export it to excel? id love to have the Daily records of power usage to log against temps for my freezer and heater.. but running the console seems to slow my network down (noticed a significant number of re-requests and sluggishness with my KASA app since starting it.) Id love to be able to log in once a month, capture the previous 30 days data for both devices and put them in an XLS or JSON file to record keeping.

slvrscoobie avatar Jan 30 '19 20:01 slvrscoobie

Hi, sorry for the slow reply. I’m afraid there's no build in way to do this currently.

As a workaround, you can open your browsers dev tools (usually F12, or ctrl+shift+i) and paste this into the console:

var csv = "date,usage"
dash.dailyUsageChart.data.labels.forEach(function(val,idx) {
var usage = dash.dailyUsageChart.data.datasets[0].data[idx];
csv += "\n"+val+","+usage;
});
console.log(csv);

This will export the last 30 days usage as a CSV string. You can then copy the output from the console and paste it into excel.

It's a bit convoluted but hopefully that will work for your use case. I'll look at enhancing the currently logging capability to include the daily usage. Thanks

jamesbarnett91 avatar Feb 23 '19 18:02 jamesbarnett91

Easy enough!!!

slvrscoobie avatar Feb 24 '19 04:02 slvrscoobie

Got it! Sweet!! now i just log in at least every 30 days and Ive got my data.

slvrscoobie avatar Feb 25 '19 01:02 slvrscoobie

Is there a way to pull more than just the last 30 days with the console method above? 60/90/120? 365??

slvrscoobie avatar Feb 26 '19 20:02 slvrscoobie

Is there a way to pull data from a specific date or date range? I missed 3 days between my 30 day downloads and theres a gap.

slvrscoobie avatar Aug 01 '19 12:08 slvrscoobie