We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Tapo P110 Download Data
Comments
-
Does this help?Now to make sense of it.# today_runtime = Today's total plug relay on time (in minutes)# month_runtime = Past 30 days total plug relay on time (in minutes)# today_energy = Today's total energy consumption (in Wh, reset at midnight)# month_energy = Total energy consumption for the current month (in Wh)# local_time = Local time# past24h = Total energy consumption for each of the last 24 hourly slots (relative to now, oldest to current hour) (in Wh, or average W over the hour which is the same)# past30d = Total energy consumption for each of the last 30 days (relative to now, oldest to current day) (in Wh)# past1y = Total energy consumption for each of last 12 months (relative to now, oldest to current month) (in Wh)# past7d = Total energy consumption for each hour of the last 7 days (relative to now, oldest to current day and each containing the 24 hourly slots from midnight to midnight) (in Wh)# current_power = Current power consumption (in Watts x 1000)
If you get a couple of day's worth of readings it starts to make more sense what figures are going where, what's being added up to give sub-totals, the order of figures etc.1 -
For the lists of data between square brackets (known as a 'json' data structure, if you want to Google it) here is my summary of what I see:sandy700 said:
I had a look at that site and have come up with an output on my raspberry pi like this.BlueShrew said:If you (or a friend) like playing with Python code, you can actually talk to each plug device to get quite a lot of data from them. Just Google 'fishbigger p110 python' and go to the first GitHub link for example code.
I have mine set up to poll each devices around my network and store all the data in text files. You can then do as you like in whatever tool, eg: Excel, to calculate costs, plot data, etc.
{'result': {'today_runtime': 346, 'month_runtime': 464, 'today_energy': 41, 'month_energy': 46, 'local_time': '2022-09-10 22:56:21', 'past24h': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 12, 12, 2, 0, 0, 5], 'past30d': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 41], 'past1y': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46], 'past7d': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 12, 12, 2, 0, 0, 5, 0]], 'current_power': 0}, 'error_code': 0}
Now to make sense of it.
past24h : Gives you 24 values in a list, each being the total for each of the previous 24hrs, relative to when you retrieved the data
past30d : Gives you 30 values in a list, each being the total for the last 30 days, relative to when you retrieved the data
past1y : Gives you 12 values in a list, each being the total for each of the last 12 months, relative to when you retrieved the data
past7d : Returns a list of lists in the form: [ [..], [..], ..]. Each inner list represents 24Hrs of data (listing the totals for each hour of the 24Hr day). There are 7 of these 24Hrs lists, meaning the 'past7d' value contains 7x24 values, providing you with the total for each hour of a 24Hr day over the last 7 days.
Remember: If you run your script at two different hours of the same day, expect the numbers to shift slightly, as everything is relative to when you run the script.1 -
I can now output the data as a .csv file now to figure out how to output partial data, say, past24h on its own.data = p110.getEnergyUsage()with open("p110.csv", "a", ) as f:f.write(str(data))f.write('\n')f.close()
this forum really screws up formatting.
0
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.6K Banking & Borrowing
- 254.2K Reduce Debt & Boost Income
- 455.1K Spending & Discounts
- 246.7K Work, Benefits & Business
- 603.1K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.7K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards