Skip to content

Commit ef1834a

Browse files
authored
Experimental workaround for small refresh_interval (#303)
1 parent 9988f6c commit ef1834a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/cache/Cache.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ async function fetchSingleRange(
7777
// | '--- discarded as it is fictitious
7878
// '--- point at the edge, kept
7979

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

0 commit comments

Comments
 (0)