johanmeijer / grott

Growatt inverter monitor
https://github.com/johanmeijer/grott/wiki
375 stars 103 forks source link

Feature request: Option to use server date/time instead of date/time from message received by inverter #442

Closed anoppe closed 9 months ago

anoppe commented 9 months ago

Basically what the title says. Today I saw my graphs to stall, i.e. miss data:

image

and started to investigate the cause, maybe some service halted or something alike. When reviewing the logs from the grott-server, I saw that the date was adjusted to my local timezone for InfluxDB, nice. However, the time was very wrong: - Grott original time : 2023-10-09T10:24:17 adjusted UTC time for influx : 2023-10-09T09:24:17 and, at the moment of writing this issue the time is 17:44h.

It would be nice if grott-server could override the date/time of the message received by the Growatt inverter and send the server date time to Influxdb.

johanmeijer commented 9 months ago

Is it really a problem? It is rather normal that you store data records in influxdb in GMT. Tools like grafana then correct this for the local time.

But it might be possible to add a options to skip this if needed.

anoppe commented 9 months ago

No, in this case, the Growatt inverter sends a date/time that doesn't correspond to the actual date time. When I created this feature request, my local time (GMT+2) was 0545h. However, grott seems to receive a date time from the inverter which was 1024h, which doesn't make sense for this timezone. I can only imagine that it got the date time pushed from the Growatt servers since the time suddenly had an offset of 5 hours, but that still doesn't clarify the data from 2010. I can illustrate this with a piece of logging, which contains dates/times from 2010!

- Possible Inverter serial QYL2CJ***
     - Inverter serial not recognised - using inverter type default
     - Growatt new layout processing
         - decrypt       :  True
         - offset        :  6
         - record layout :  T06NNNNX

     - Grott data record date/time processing started
     - date-time:  2010-07-31T12:09:56
     - Grott values retrieved:
         -  datalogserial        :  XGD6CH***
         -  pvserial             :  QYL2CJ***
         -  pvstatus             :  0
         -  pvpowerin            :  0.0
         -  pv1voltage           :  144.9
         -  pv1current           :  0.0
         -  pv1watt              :  0.0
         -  pv2voltage           :  144.7
         -  pv2current           :  0.0
         -  pv2watt              :  0.0
         -  pvpowerout           :  0.0
         -  pvfrequentie         :  50.0
         -  pvgridvoltage        :  235.9
         -  pvgridcurrent        :  0.0
         -  pvgridpower          :  0.0
         -  pvgridvoltage2       :  0.0
         -  pvgridcurrent2       :  0.0
         -  pvgridpower2         :  0.0
         -  pvgridvoltage3       :  0.0
         -  pvgridcurrent3       :  0.0
         -  pvgridpower3         :  0.0
         -  totworktime          :  25.2
         -  pvenergytoday        :  0.0
         -  pvenergytotal        :  5.7
         -  epvtotal             :  5.8
         -  epv1today            :  0.0
         -  epv1total            :  2.8
         -  epv2today            :  0.0
         -  epv2total            :  3.0
         -  pvtemperature        :  18.5
         -  pvipmtemperature     :  22.5
         -  battery1soc          :  0
     - MQTT jsonmsg: 
             {"device": "QYL2CJ1**", "time": "2010-07-31T12:09:56", "buffered": "no",
             "values": {"datalogserial": "XGD6CHH***", "pvserial": "QYL2CJ1***",
             "pvstatus": 0, "pvpowerin": 0, "pv1voltage": 1449, "pv1current": 0,
             "pv1watt": 0, "pv2voltage": 1447, "pv2current": 0, "pv2watt": 0,
             "pvpowerout": 0, "pvfrequentie": 5002, "pvgridvoltage": 2359,
             "pvgridcurrent": 0, "pvgridpower": 0, "pvgridvoltage2": 0, "pvgridcurrent2":
             0, "pvgridpower2": 0, "pvgridvoltage3": 0, "pvgridcurrent3": 0,
             "pvgridpower3": 0, "totworktime": 181213, "pvenergytoday": 0,
             "pvenergytotal": 57, "epvtotal": 58, "epv1today": 0, "epv1total": 28,
             "epv2today": 0, "epv2total": 30, "pvtemperature": 185, "pvipmtemperature":
             225, "battery1soc": 0}}
     - Grott MQTT topic used : energy/growatt
     - MQTT message message sent
     - Grott send data to PVOutput systemid:  ***** for inverter:  QYL2CJ1***
         -  {'X-Pvoutput-Apikey': '***************************************', 'X-Pvoutput-SystemId': '*****'}
         -  {'d': '20100731', 't': '12:09', 'v2': 0.0, 'v6': 235.9, 'v1': 0}
     - Grott PVOutput response: 
         -  Bad request 400: Date is older than 14 days [20100731]
     - Grott InfluxDB publihing started
     - Timezone local specified default timezone used
     - Grott original time :  2010-07-31T12:09:56 adjusted UTC time for influx :  2010-07-31T11:09:56
     - Grott influxdb jsonmsg: 
             [{'measurement': 'QYL2CJ1***', 'time': '2010-07-31T11:09:56', 'fields':
             {'datalogserial': 'XGD6CHH***', 'pvserial': 'QYL2CJ1***', 'pvstatus': 0,
             'pvpowerin': 0, 'pv1voltage': 1449, 'pv1current': 0, 'pv1watt': 0,
             'pv2voltage': 1447, 'pv2current': 0, 'pv2watt': 0, 'pvpowerout': 0,
             'pvfrequentie': 5002, 'pvgridvoltage': 2359, 'pvgridcurrent': 0,
             'pvgridpower': 0, 'pvgridvoltage2': 0, 'pvgridcurrent2': 0, 'pvgridpower2':
             0, 'pvgridvoltage3': 0, 'pvgridcurrent3': 0, 'pvgridpower3': 0,
             'totworktime': 181213, 'pvenergytoday': 0, 'pvenergytotal': 57, 'epvtotal':
             58, 'epv1today': 0, 'epv1total': 28, 'epv2today': 0, 'epv2total': 30,
             'pvtemperature': 185, 'pvipmtemperature': 225, 'battery1soc': 0}}]
     - Grott write to influxdb v1
     - Grott extension processing disabled 

PVOutput also detects that the date/time is off:


         -  Bad request 400: Date is older than 14 days [20100731]```
anoppe commented 9 months ago

FYI: I'm using a Growatt MIN-2500TL-X with ShineWifi-X.

anoppe commented 9 months ago

It started just now again:

- Grott original time :  2023-10-10T08:08:20 adjusted UTC time for influx :  2023-10-10T07:08:20
anoppe commented 9 months ago

I've found out that you can also override the Growatt date/time completely, by using the time=server setting. This issue can be closed, as far as I'm concerned.