From 2970e841939fe5b1fa0101a3900ac2a7d0d2c7c8 Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Tue, 27 Jun 2023 22:32:29 +0200 Subject: [PATCH] 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. --- include/PowerLimiter.h | 1 + src/PowerLimiter.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/PowerLimiter.h b/include/PowerLimiter.h index 2b212527..342d6092 100644 --- a/include/PowerLimiter.h +++ b/include/PowerLimiter.h @@ -33,6 +33,7 @@ public: PowerMeterPending, InverterInvalid, InverterOffline, + InverterCommandsDisabled, InverterLimitPending, InverterPowerCmdPending, InverterStatsPending, diff --git a/src/PowerLimiter.cpp b/src/PowerLimiter.cpp index 16682b8d..0304f599 100644 --- a/src/PowerLimiter.cpp +++ b/src/PowerLimiter.cpp @@ -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" }, @@ -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) {