jedie / inverter-connect

Get information from Deye Microinverter
https://pypi.org/project/inverter-connect/
GNU General Public License v3.0
29 stars 9 forks source link

Wrong reads being pushed into MQTT #107

Open bernhardschmidt opened 11 months ago

bernhardschmidt commented 11 months ago

There are occasional wrong readings being returned from the inverter and being pushed into MQTT, i.e. here pv1current/pv1power/totalpower

Good:

Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv1voltage': 27.5,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv2voltage': 27.0,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv1current': 0.4,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv2current': 0.4,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_dailyproduction': 0.1,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_dailyproduction1': 0.0,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_dailyproduction2': 0.0,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalproduction': 0.4,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalproduction1': 0.1,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalproduction2': 0.1,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv1power': 11.0,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv2power': 10.8,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalpower': 21.8,
Dec 15 13:43:26 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_looprunningtime': 392

Bad:

Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv1voltage': 33.5,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv2voltage': 31.8,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv1current': 51.4,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv2current': 0.3,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_dailyproduction': 0.1,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_dailyproduction1': 0.0,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_dailyproduction2': 0.0,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalproduction': 0.4,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalproduction1': 0.1,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalproduction2': 0.1,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv1power': 1721.9,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_pv2power': 9.54,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_totalpower': 1731.44,
Dec 15 13:43:36 vzlogger inverter_connect[4766]: <E2><94><82>   'inverter_3811199530_looprunningtime': 402

It's a Deye SUN-M80G3-EU-Q0. I thought those wrong reads for power would be guarded by the definitions in inverter/definitions/deye_2mppt_validations.yaml, but apparently they go through at least to MQTT. Unfortunately I have never observed these values with manual readouts, so I can't tell whether print-values would behave differently.

However, "PV1 Power/PV2 Power/Total Power" appear as "Computed". Can they actually be limited by deye_2mppt_validations.yaml?

These wrong reads happen for pretty much all values

Dec 15 13:46:16 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:46:26 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:46:36 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 514,
Dec 15 13:46:46 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:47:04 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
[...]
Dec 15 13:52:23 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:52:34 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:52:43 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 1,
Dec 15 13:52:53 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:53:03 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 1,
Dec 15 13:53:14 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
Dec 15 13:53:23 vzlogger inverter_connect[4766]: │   'inverter_3811199530_activepowerregulations': 100,
bernhardschmidt commented 11 months ago

If I understand the code correctly the validator only checks values directly retrieved from the inverter

https://github.com/jedie/inverter-connect/blob/main/inverter/api.py#L113

while the PV1 Power/PV2 Power/Total Power values are computed afterwards.

https://github.com/jedie/inverter-connect/blob/main/inverter/api.py#L123 calls https://github.com/jedie/inverter-connect/blob/main/inverter/api.py#L29

So the current sanity limits on *Power are effectively a noop

One could limit the Voltage/Current with the validator, but since all other values are also occasionally give bogus data this might just be solved by aborting on bogus reads altogether (I haven't checked yet what the inverter really replies)