Skip to content

Commit

Permalink
Experimental workaround for small refresh_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
dbuezas committed Jul 31, 2023
1 parent 9988f6c commit b0004bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cache/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ async function fetchSingleRange(
// | '--- discarded as it is fictitious
// '--- point at the edge, kept

const start = new Date(startT - 1);
const l = Math.max(0, 5000 - (endT - startT)); // The HA API doesn't add the fake boundary if the interval requested is too small
const start = new Date(startT - 1 - l);
endT = Math.min(endT, Date.now());
const end = new Date(endT);
let history: CachedEntity[];
Expand Down

0 comments on commit b0004bf

Please sign in to comment.