Hi,
I’m trying to fetch historical data from the HA REST API and I get an empty response when using the end_time parameter.
The API works when end_time is not passed, in:
I experience empty responses with the /history endpoint as well. However, it happens only when setting the start date to far back in the past (greater than 20 days).
Following request gives me a response, setting the timestamp and end_time one day earlier gives me an empty response.
Perhaps the empty response for >20 days in the past in your case is related to retention period configuration? see here
However, my problem is different: I get empty response when using the end_time, when retrieving data for different than 1 day period (the default period). When I want to get data for, e.g., a period of 3 days, or even half a day, setting the end_time, I get empty response. This happens for many entities I tried with and for dates that I checked that there are available data to retrieve.
Do you see any problem in the URL I use?
This happens on Home Assistant Core 2022.12.6.
Indeed, your are right @athanassis. Figured that one out myself after my post. I should have looked more carefully at the docs.
However, taking a look at your curl call I think I can spot your problem. You should use the ? symbol once to indicate there are query options to the call. In order to concatenate multiple query options, use the & symbol. Please try the following call;