Skip to content

Commit

Permalink
Improve battery_save mode.
Browse files Browse the repository at this point in the history
With thanks to @Ernest-burgess
  • Loading branch information
cmcgerty committed Nov 26, 2022
1 parent f8c7667 commit 4f06180
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sofar2mqtt/Sofar2mqtt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

// The device name is used as the MQTT base topic. If you need more than one Sofar2mqtt on your network, give them unique names.
const char* deviceName = "Sofar2mqtt";
const char* version = "v2.1";
const char* version = "v2.1.1";

#define WIFI_SSID "xxxxx"
#define WIFI_PASSWORD "xxxxx"
Expand Down Expand Up @@ -468,7 +468,7 @@ void batterySave()
// Switch to auto when any power flows to the grid.
// We leave a little wriggle room because once you start charging the battery,
// gridPower should be floating just above or below zero.
if(p < 65535/2 || p > 65525)
if((p < 65535/2 || p > 65525) && (INVERTER_RUNNINGSTATE != discharging))
{
//exporting to the grid
if(!sendPassiveCmd(SOFAR_SLAVE_ID, SOFAR_FN_AUTO, 0, "bsave_auto"))
Expand Down

0 comments on commit 4f06180

Please sign in to comment.