TapoP100: P110.getEnergyUsage() no longer returns historical data
I think historical data is cleared by the firmware update, but should there be empty fields (or zeros) in the data returned? Using the proposed change https://github.com/fishbigger/TapoP100/pull/77 and calling getEnergyUsage() I get two different results, depending on the firmware version.
For devices running the older firmware (v1.0.16 Build 220624 Rel.171733), I get ‘result’ which shows historical data populated as:
{'today_runtime': 1213, 'month_runtime': 42966, 'today_energy': 1414, 'month_energy': 56071, 'local_time': '2022-10-22 20:13:00', 'past24h': [72, 42, 167, 134, 54, 37, 72, 88, 37, 38, 85, 77, 40, 62, 98, 105, 65, 87, 62, 36, 88, 74, 46, 29], 'past30d': [1916, 1766, 1825, 1788, 2050, 2037, 1919, 2081, 1858, 1783, 2044, 1922, 1852, 1907, 1790, 1762, 1851, 1896, 2072, 2046, 1796, 1848, 1941, 1940, 1839, 1894, 1792, 1765, 1677, 1414], 'past1y': [0, 0, 0, 0, 0, 0, 0, 0, 0, 29890, 56387, 40689], 'past7d': [[75, 60, 65, 54, ....<snipped to save space>....]], 'current_power': 129899}, 'error_code': 0}
For devices running the newer firmware (v1.1.2 Build 220930 Rel.144500), I get ‘result’ populated with no historical data fields as:
'result': {'today_runtime': 165, 'month_runtime': 9314, 'today_energy': 33, 'month_energy': 1891, 'local_time': '2022-10-22 20:13:01', 'electricity_charge': [0, 0, 0], 'current_power': 12173}, 'error_code': 0}
About this issue
- Original URL
 - State: open
 - Created 2 years ago
 - Reactions: 2
 - Comments: 17 (2 by maintainers)
 
Commits related to this issue
- Add getEnergyData() Re: #86 Authored by @bacheshrew in https://github.com/fishbigger/TapoP100/issues/86#issuecomment-1291699800 Pull request suggested in https://github.com/fishbigger/TapoP100/iss... — committed to IJMacD/TapoP100 by IJMacD 2 years ago
 - Fix saving for 1.1.2+ firmware Using https://github.com/fishbigger/TapoP100/issues/86 code — committed to L-U-M-E-N/lumen-module-power-tplink-tapo-p110 by Elanis a year ago
 
Thanks all for your detective work on this. I feel it would be better to wait for a firmware update than to code in a temporary fix so I’m going to mark this as won’t fix.
Let me know if there are any further comments on this 😃
Glad to see the solution helped. So the Tapo app is using for intervals: 43200 = 1 month 1440 = 1 day 60 = 1 hour But I’m detecting strange behavior in start_timestamp you need to set the correct value which is the first day of the month at zero hours to work. The tapo app is asking for the last 3 months so I am assuming that new firmware will just store 3 months of daily information.
Clearly, there are several issues with the dates of the firmware update. I’m developing the app Watt for Smart Devices and the solution I have at the moment that matches android Tapo’s app is: startTime = 1st day of the month of the previous month at zero hours EndDate= today with today’s time
I think it is also necessary to pay attention to the GMT
I am also ignoring all the values in the array that are higher than today