Closed mikepqr closed 3 years ago
Looking more carefully at ambientweather.net, the fact that I can't get any data after midnight UTC out of aioambient seems likely to be a bug in the upstream API. This is a plot of the "last 24 hours". It ends abruptly at 4pm PST, i.e. midnight UTC. I took this screenshot at 22:41 PST on Dec 27, i.e. 06:41 UTC on Dec 28.
OK presumably 99% of this issue is due to the fact that I happen to be trying aioambient during an upstream API outage:
So please ignore all of this except the bit about the README being wrong about the type of end_date
:-)
Thanks, @mikepqr! You're right: those methods are supposed to take date
objects. I'll fix.
The README example has things like this
but
end_date
is typed here as adatetime
(with anisoformat
method). I assume this is a minor README bug, i.e. these should beend_date=datetime.datetime(2019, 01, 16)
.I would submit a PR for this, but I'm actually unclear on the intended behavior of the
end_date
parameter. The comment above theend_date
example isGet all stored readings from a device (starting at a datetime)
. I'm struggling to reconcile "starting at" with "end_date
", and either of these with the actual behaviour I see.I'm verifying that behavior with this script:
Without
end_date
(i.e. as above), I get this:i.e. I appear to get a set of data that starts approximately 24 hours ago, and ends at the most recent UTC midnight. I would expect to get the last 24 hours of data.
With
end_date
set to the current UTC time, i.e.end_date=datetime.now(tz=timezone.utc)
. I get the same thing, i.e. a slice of data that is less than 24 hours, that runs from 24 hours ago until the most recent UTC midnight.With
end_date
set to the current UTC date, i.e.end_date=datetime(2020, 12, 28)
at the time of writing, I get 24 hours of data ending at 2020-12-27T23:55:00.000Z.With
end_date
set to a date in the past, e.g.end_date=datetime(2020, 12, 01)
, I get 24 hours of data ending at2020-12-01T00:00:00.000Z
.Either there is a bug in my understanding of what
end_date
is supposed to do, or there are some actual bug(s) here. Most importantly, it seems like there is no way to get any data after the most recent UTC midnight (other than the most recent timestamp you get fromget_devices()
). Am I missing something?