Tp link smart plugs

Hello im trying to map power usage of my devices, i can successfully monitor and control the devices but the corresponding total wh does not tally with what the app shows me. I could probe the plug every 1s or so and log the value and then perform some calculations over time etc but to get any reasonably accurate i would need to request data very often, does anyone have a setup doing this? I use the kasa tp link plugin.

Welcome to the forum @Swampyjim

Why not? How are you calculating or reading it? Provide examples of what the app shows and what you get.

Im not recording any data at the moment, the device returns a total wh value but that is different from the total wh that the kasa app reports. I suppose my general question is how fast can i request data without breaking things, how often is too much 15+ devices been probed at 1s would probably be best for data resolution. Im looking for someone already doing this and how they have it working

Is that just a fixed difference or does it go up at a different rate?

How do the devices communicate with node-red? What device are you running node-red on.

Im not sure if its a fixed difference ive not experimented with it yet but it shows something alone the lines of total wh 1234 and the app might show total wh per day 12 per week 30 per 30 days 100 but non of which are even close to the reporting value that node receives from the device so some kind of logging in the cloud is happening so i think i just need to start by logging the data myself at a repeating interval.

Node red is running on an ubuntu container within proxmox.

The plugin is

node-red-contrib-tplink

I was hoping you were going to say that it uses something like MQTT to communicate, in which case you would have been able to get data hundreds of times a second before you ran into problems with node-red. Sorry, I don't know anything about tplink smart home so I can't comment on how often you can poll it. You are not going to have problems with the node-red end of it unless you poll many hundreds of times a second.

This ongoing thread might be of interest to you. How to compare 2 data sets with either an integral or derivative

great thanks, ive set it up so far to log the power usage to a graph and im polling once per second at the moment. i need to now save this data and then either use a time stamp somehow or maybe even just calculate on entries? if they are polling at 1s with any accuracy this should be ok? its not the end of the world if the data is slightly out.

I don't think you want to be updating a graph once a second as you will have far too many datapoints.

It will be better to aggregate the info somehow -
What do you get from the node, can you post here ?

The node calls for data each second then adds it to the graph, i was looking at using the graph array to work on the data but youre right id be better storing the data in a database or a global array maybe

Do you want to be able to review old data? If so then I suggest storing it in Influxdb and viewing with Grafana, as in the thread I linked to earlier.

Thats a good plan actually as i was using grafana for server resource monitoring, thank you

Ive gone down the mysql route locally, i have the data saving as a float each second and the datetime column auto fills as its modified so now i can pull all the data for an hour or a day.

So i guess per hour would be all data entries added together the divided by 3600 for watts per hour then divide by 1000 for kwh.

I need to test that mysql does actually return around 3600 data entries then i can validate against my kasa application.

Its still a work in progress but much cleaner than when i started, thanks for the help so far.

Have a look at influxdb. It is designed for real time data and has many features to make life easier (after the initial learning curve). For example you can configure it to automatically downsample the data to reduce the amount of data to be kept long term. or it can automatically delete data after a certain time.
It has tight integration with Grafana and is very well supported by node-red.

is it all cloud based? Is the free membership is enough to get these features?

Is what all cloud based? MySQL is not normally cloud based.

Free membership of what?

when i went to influxdb website it seemed to want me to create an account with different tiers of membership, there is a free membership. Did i go to the correct place?

ive found some tutorials so i will watch those, thanks

You can easily install influxdb locally. It is completely free.

Yes im all setup, watched a few videos and im ready to store some data and then process it. Thanks for your help, although i might be bsck for more help later :grinning:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.