DPL requirement: disabled inverter commands

if the inverter is not configured to be sent commands to, the DPL is
unable to control it, so the loop is aborted.
This commit is contained in:
Bernhard Kirchen 2023-06-27 22:32:29 +02:00
parent 18b1076660
commit 2970e84193
2 changed files with 7 additions and 0 deletions

View File

@ -33,6 +33,7 @@ public:
PowerMeterPending, PowerMeterPending,
InverterInvalid, InverterInvalid,
InverterOffline, InverterOffline,
InverterCommandsDisabled,
InverterLimitPending, InverterLimitPending,
InverterPowerCmdPending, InverterPowerCmdPending,
InverterStatsPending, InverterStatsPending,

View File

@ -34,6 +34,7 @@ std::string const& PowerLimiterClass::getStatusText(PowerLimiterClass::Status st
{ Status::PowerMeterPending, "waiting for sufficiently recent power meter reading" }, { Status::PowerMeterPending, "waiting for sufficiently recent power meter reading" },
{ Status::InverterInvalid, "invalid inverter selection/configuration" }, { Status::InverterInvalid, "invalid inverter selection/configuration" },
{ Status::InverterOffline, "inverter is offline (polling enabled? radio okay?)" }, { 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::InverterLimitPending, "waiting for a power limit command to complete" },
{ Status::InverterPowerCmdPending, "waiting for a start/stop/restart command to complete" }, { Status::InverterPowerCmdPending, "waiting for a start/stop/restart command to complete" },
{ Status::InverterStatsPending, "waiting for sufficiently recent inverter data" }, { Status::InverterStatsPending, "waiting for sufficiently recent inverter data" },
@ -124,6 +125,11 @@ void PowerLimiterClass::loop()
return announceStatus(Status::InverterOffline); 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) // concerns active power commands (power limits) only (also from web app or MQTT)
auto lastLimitCommandState = inverter->SystemConfigPara()->getLastLimitCommandSuccess(); auto lastLimitCommandState = inverter->SystemConfigPara()->getLastLimitCommandSuccess();
if (CMD_PENDING == lastLimitCommandState) { if (CMD_PENDING == lastLimitCommandState) {