cmcgerty / Sofar2mqtt

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

wrong order of if statement? #56

Open IgorYbema opened 1 year ago

IgorYbema commented 1 year ago

Should this be the other way around? https://github.com/cmcgerty/Sofar2mqtt/blob/4f061801fb2c7e3699ccd78cc1b99fed54aead0d/Sofar2mqtt/Sofar2mqtt.ino#L459-L462

cmcgerty commented 1 year ago

Quite possibly. It certainly looks like p would only be set if readSingleReg fails. Do you have one connected with a serial console open? Does it constantly log “modbus error” when in battery save mode? I’ll take a look when I get a chance.

IgorYbema commented 1 year ago

Not using batterysave but I just noticed it while modifying the code a bit to suit my own situation