You’ve opened up a few issues here. I’ll start by saying that your result should be different, but not in the way you expect.
The history log has resolution of 1 minute and you are asking for 5 second grouping. That presents a dilemma as to the appropriate response. Some possibilities are:
- Reject the query as not possible.
- Adjust the grouping 1m.
- Respond with only current log data.
- Respond with 5 second timestamps but only one in 12 for history log data.
- For Watts, Amps etc respond with the 1m value for all 12 groups from history log and 1/12 for Wh.
It does seem to work as expected with history log data when the grouping is a multiple of 1m.
I’ll revisit the failure mode after giving any others a reasonable time to comment on this thread.