This query below gives 720 lines of good historical data using a begin of ‘jan 9 2025’ and an end of ‘jan 10 2025 00:00:04’. My i.sh script below adds line numbers to the output and extracts the first and last five lines (the echo is needed because the last record is always missing its CRLF):
$ ./i.sh 'jan 9 2025' 'jan 10 2025 00:00:04'
wget -q -O - "http://ianiotaw.local/query?select=[time.utc.unix,FurnaceBlower.watts]&begin=2025-01-09T00:00:00&end=2025-01-10T00:00:04&group=auto&resolution=high&format=csv" ; echo ''
1 1736398800, 10.9
2 1736398920, 11
3 1736399040, 11
4 1736399160, 11
5 1736399280, 11
...
716 1736484600, 11
717 1736484720, 10.9
718 1736484840, 10.8
719 1736484960, 10.8
720 1736485080, 10.9
I can change the ending year, the month, or the minute and all those queries give good historical data. I can change the start date and all those queries give good historical data.
But if I add one single second to the end time (00:00:05), the query generates a bad last record (record 721):
$ ./i.sh 'jan 9 2025' 'jan 10 2025 00:00:05'
wget -q -O - "http://ianiotaw.local/query?select=[time.utc.unix,FurnaceBlower.watts]&begin=2025-01-09T00:00:00&end=2025-01-10T00:00:05&group=auto&resolution=high&format=csv" ; echo ''
1 1736398800, 10.9
2 1736398920, 11
3 1736399040, 11
4 1736399160, 11
5 1736399280, 11
...
717 1736484720, 10.9
718 1736484840, 10.8
719 1736484960, 10.8
720 1736485080, 10.9
721 1736485200, null <===== BAD RECORD
I can change the ending year, the month, or the minute and all those queries still generate a bad last record for historical data (data older than one year) if the end second is any value from :05 up to :59. Seconds from :00 to :04 all work fine for historical data. I can use ISO time or Unix time; they all fail the same way.