Closed syco closed 1 week ago
What timezone are you on?
I think that you might want
_date = datetime.datetime.fromtimestamp(usage.start_timestamp, tz.gettz())
Yes, I'm in GMT+1, but so is the excel file. So if I change usage.start_timestamp from GTM+1 to GMT to compare it with the date in the excel file I would be comparing GMT with GMT+1. So is usage.start_timestamp double moved forward?
I've done a bit more digging, and you're correct. The request is made with the date in UTC when it should be in the local timezone.
This doesn't affect the data returned because the Tapo API will always return data from the start of the day in the local time.
But it does mean that the returned start_timestamp
is indeed incorrect.
The problem is here. It should be local time, not UTC.
Well, I'm happy enough that the data returned is correct. I leave it to you to decide if you want to change start_timestamp or not. Thanks for looking into it. (Should we close this now that we know what it is? Please do if you want.)
I have a fix in progress. It should land soon.
Hi, I'm trying to figure out how to match the start_timestamp with the timestamp in the exported excel.
Here's my code:
the output of that script is:
See that The
start_time
I request and thestart_timestamp
returned are off by 1 hour, and when I compare all this to the exported excel I get from the app, all timestamps are off by 1 hour as well:Am I doing something wrong in my script? Thanks