Closed Dizzybacon closed 8 months ago
It can't be a problem with the node. The date is only passed to the server. But if the start and end dates are the same, the server does strange things. Please try to query the day correctly.
historyLastEndDate: new Date().setDate(startDate.getDate() + 1);
The server seems to do strange things regardless of if the start and end dates are the same! If I give different start and end dates and cycle through the offsets until I get no data I get two days worth of data, but not the ones I'd expect.
const startDate = new Date ('2024-3-19')
const endDate = new Date('2024-3-20')
returned data for the 18th and the 19th!
Using the wrong date seems to work consistently at the moment at least, but I'm surprised this hasn't been raised before.
Describe your inverter
Inverter model DNAA025100
Describe the bug
Trying to retrieve the historyAll data for a specific day. Setting startDate and endDate the same day and using offsets works sometimes, but sometimes returns the wrong day.
To Reproduce
This is my growatt.js script:
Running this with
node growatt.js 0 2023-12-10
returns the last 80 records for 2023-12-10, using the offset I can get the rest of the day.Running this with
node growatt.js 0 2024-1-23
returns the last 80 records for 2024-1-22!!These are two specific examples but it seems to be inconsistent around different dates. For the most part I get the second result now, I have to offset the date by one day to get the data I want, but I don't seem to be able to rely on this as sometimes I get the other behaviour.
Expected behavior
startDate and endDate should consistently control the dates data is returned for.
Screenshots & Logfiles
If applicable, add screenshots and logfiles to help explain your problem.
Versions:
Additional context
I don't know if the problem is in my script, the PLCHome app or Growatt. My suspicion is that it's Growatt based on how flaky they seem to be with their API, but I can't see this raised by anyone else.