Universal Solar Inverter over Modbus RS485 / TCP custom_component (Growatt, Sofar, SolaX, Solis)

As far as I know, the default for these attributes is to hold the last value.
Only attributes with sleepmode=SLEEPMODE_ZERO or SLEEPMODE_NONE should be zeroed or set to invalid. I will check where this can go wrong…
Keep in mind that we do not have a complete testing environment for all models ;-). Furthermore, my inverter has not gone to sleep for more than a year …

For total yield we could try
state_class=STATE_CLASS_MEASUREMENT,
instead of
state_class=STATE_CLASS_TOTAL_INCREASING,

TOTAL_INCREASING is designed to reset to zero. Where I think measurement just keeps counting?

Unless the Inverter is actually returning zero on Total Yield.

Thanks for looking into it.

Not sure we can solve this without your help. Are there other messages in the full log around the time the inverter goes to sleep?

Please don’t do that, that will break things. It will cause the sum column to no longer be updated.

The inverter is actually returning zero from the registers. When run mode goes back to normal, it will provide the last value again (it continues where it left of, it doesn’t reset).

Yes, it logs errors (0.6.4 didn’t):

Deze fout is ontstaan door een aangepaste integratie.

Logger: custom_components.solax_modbus
Source: /config/custom_components/solax_modbus/__init__.py:365
Integration: SolaX Inverter Modbus (documentation, issues)
First occurred: 11:48:11 (4 occurrences)
Last logged: 16:38:41

SolaX X3-MIC error reading input registers at device 1 position 0x40e
SolaX X3-MIC error reading input registers at device 1 position 0x407
SolaX X3-MIC error reading input registers at device 1 position 0x423
SolaX X3-MIC error reading input registers at device 1 position 0x400
NoneType: None

Thanks this might help, no errors or warnings preceding these errors?
I would expect an error at the block level, not at the individual register levels as we see now …

Actually I see now that these errors started occuring earlier, they seem unrelated to the run mode:

2022-12-10 11:48:11.175 ERROR (MainThread) [custom_components.solax_modbus] SolaX X3-MIC error reading input registers at device 1 position 0x40e
NoneType: None
2022-12-10 15:40:41.526 ERROR (MainThread) [custom_components.solax_modbus] SolaX X3-MIC error reading input registers at device 1 position 0x407
NoneType: None
2022-12-10 16:33:41.934 ERROR (MainThread) [custom_components.solax_modbus] SolaX X3-MIC error reading input registers at device 1 position 0x423
NoneType: None
2022-12-10 16:38:41.469 ERROR (MainThread) [custom_components.solax_modbus] SolaX X3-MIC error reading input registers at device 1 position 0x400
NoneType: None
2022-12-10 16:47:11.486 ERROR (MainThread) [custom_components.solax_modbus] SolaX X3-MIC error reading input registers at device 1 position 0x400
NoneType: None

It switched to “Waiting” at 15:53.

Correction: these errors are at block level, but we seem to start a lot of blocks for MIC (newblock attribute). Still that does not explain why hub.data[entity_name] would be set to zero upon this failure

Very strange, still does not explain why we would not keep last known value.
Is your polling rate set to a very short inverval? (less than 5 sec)

For your information: such errors are only shown during the first 5 polling cycles. Maybe you started your integration when the inverter was already asleep

No, I actually set it a bit slower, to 30 seconds.

OK thanks, I search further …

Nope, last restart was at 11:37:36 (that was when I re-added the integration).

Maybe we should take this thread to Gitter? Or to personal messages?

Correction: we only show these errors if the system state changes from awake to asleep (not during the first cycles… )

good idea. This part of the code change has be done by me, so either git or personal message is fine.

@Kars Do you want to try out 2022.12.4

Sure do! Inverter is “Waiting” though, so I can only check that mode.

It might be worth waiting till you have PV again before restarting HA otherwise it won’t make the initial connection.