Skip to content

Commit

Permalink
DPL requirement: disabled inverter commands
Browse files Browse the repository at this point in the history
if the inverter is not configured to be sent commands to, the DPL is
unable to control it, so the loop is aborted.
  • Loading branch information
schlimmchen committed Jun 30, 2023
1 parent 18b1076 commit 2970e84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/PowerLimiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class PowerLimiterClass {
PowerMeterPending,
InverterInvalid,
InverterOffline,
InverterCommandsDisabled,
InverterLimitPending,
InverterPowerCmdPending,
InverterStatsPending,
Expand Down
6 changes: 6 additions & 0 deletions src/PowerLimiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ std::string const& PowerLimiterClass::getStatusText(PowerLimiterClass::Status st
{ Status::PowerMeterPending, "waiting for sufficiently recent power meter reading" },
{ Status::InverterInvalid, "invalid inverter selection/configuration" },
{ Status::InverterOffline, "inverter is offline (polling enabled? radio okay?)" },
{ Status::InverterCommandsDisabled, "inverter configuration prohibits sending commands" },
{ Status::InverterLimitPending, "waiting for a power limit command to complete" },
{ Status::InverterPowerCmdPending, "waiting for a start/stop/restart command to complete" },
{ Status::InverterStatsPending, "waiting for sufficiently recent inverter data" },
Expand Down Expand Up @@ -124,6 +125,11 @@ void PowerLimiterClass::loop()
return announceStatus(Status::InverterOffline);
}

// sending commands to the inverter is disabled
if (!_inverter->getEnableCommands()) {
return announceStatus(Status::InverterCommandsDisabled);
}

// concerns active power commands (power limits) only (also from web app or MQTT)
auto lastLimitCommandState = inverter->SystemConfigPara()->getLastLimitCommandSuccess();
if (CMD_PENDING == lastLimitCommandState) {
Expand Down

0 comments on commit 2970e84

Please sign in to comment.