Open IJMacD opened 1 year ago
Hi, This looks great. Do you know what units the inputs should be so it can be added to the documentation?
Hey,
it should be called like this:
startTs = 1667556000 # Unix Timestamp 2022-11-04T10:00:00+0000
endTs = 1667642400 # Unix Timestamp 2022-11-05T10:00:00+0000
interval = 60 # One of: { 60, 1440, 43200 } for hourly, daily, or monthly precision
p110.getEnergyData(startTs, endTs, interval)
It's important to note though, the timestamps do need to be provided and in the correct order but they are somewhat ignored by the plug.
The data returned will always be at the start of a local day (00:00) regardless what time of day the timestamp referred to.
e.g. if you provide the timestamps above and your local timezone is UTC+0 then results will be returned from midnight rather than 10 am.
Example output:
{
"result": {
"local_time": "2022-11-04 10:59:57",
"data": [1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"start_timestamp": 1667520000,
"end_timestamp": 1667606400,
"interval": 60
},
"error_code": 0
}
It works indeed, but their API is really chaotic:
Dropping this comment here, since I just spent a whole morning figuring out how data are returned ...
Authored by @bacheshrew in https://github.com/fishbigger/TapoP100/issues/86#issuecomment-1291699800
Pull request suggested in https://github.com/fishbigger/TapoP100/issues/86#issuecomment-1293625105