cmcgerty / Sofar2mqtt

A smart home interface for Sofar solar and battery inverters.
GNU General Public License v3.0
79 stars 45 forks source link

setup() resets the inverter to auto mode which may be undesirable #52

Open rbrooklyn opened 1 year ago

rbrooklyn commented 1 year ago

Hi,

Firstly, LOVE this project! Had a blast figuring it out, doing the soldering and generally getting this thing to work.

I am noticing that the setup() function has the line: sendPassiveCmd(SOFAR_SLAVE_ID, SOFAR_FN_AUTO, 0, "startup_auto");

Which will put the inverter into "auto" mode.

Why is this done? Odds are, the inverter would survive any power cut better than the microcontroller which is likely to be on mains electrics. Even if it was somehow also connected to the EPS, there is a delay of several seconds, causing it to be rebooted in any case. Whatever mode the inverter was in might be the desired mode. I don't think the software should force this setting if it can be avoided.

Maybe this is required so the microcontroller can be in sync with the inverter and it's somehow not possible to read the setting from the inverter from a cold boot. But if it could be read from the inverter and set internally instead of being set from the microcontroller on start-up, then I feel that would be more desirable.

Again, loving your work. Thank you for making this.