From a0e69425374933cb42ad3a8024e2d0e2369aeb16 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Tue, 31 Dec 2024 16:08:37 +0100 Subject: [PATCH] Feature: Detect if inverter supports 'Power Distribution Logic' The detection of 'Power Distribution Logic' is based on the firmware version for specific models and is needed to disable any means of overscaling, as it simply does not work when 'Power Distrbution Logic' is available. Based on the code from @AndreasBoehm --- lang/es.lang.json | 9 +++++++-- lang/it.lang.json | 9 +++++++-- lib/Hoymiles/src/inverters/HMS_4CH.cpp | 7 +++++++ lib/Hoymiles/src/inverters/HMS_4CH.h | 3 ++- lib/Hoymiles/src/inverters/HM_Abstract.cpp | 5 +++++ lib/Hoymiles/src/inverters/HM_Abstract.h | 3 ++- lib/Hoymiles/src/inverters/InverterAbstract.h | 3 +++ src/WebApi_devinfo.cpp | 1 + webapp/src/components/DevInfo.vue | 8 ++++++++ webapp/src/locales/de.json | 9 +++++++-- webapp/src/locales/en.json | 9 +++++++-- webapp/src/locales/fr.json | 9 +++++++-- webapp/src/types/DevInfoStatus.ts | 1 + 13 files changed, 64 insertions(+), 12 deletions(-) diff --git a/lang/es.lang.json b/lang/es.lang.json index 21da6235..d56748c2 100644 --- a/lang/es.lang.json +++ b/lang/es.lang.json @@ -45,7 +45,9 @@ "Refreshing": "Refrescando", "Pull": "Tira hacia abajo para refrescar", "Release": "Soltar para refrescar", - "Close": "Cerrar" + "Close": "Cerrar", + "Yes": "Yes", + "No": "No" }, "wait": { "NotReady": "OpenDTU is not yet ready", @@ -193,7 +195,10 @@ "FirmwareVersion": "Versión del firmware", "FirmwareBuildDate": "Fecha de construcción del firmware", "HardwarePartNumber": "Número de parte de hardware", - "HardwareVersion": "Versión de hardware" + "HardwareVersion": "Versión de hardware", + "SupportsPowerDistributionLogic": "'Power Distribution Logic' supported", + "Yes": "@:base.Yes", + "No": "@:base.No" }, "gridprofile": { "NoInfo": "@:devinfo.NoInfo", diff --git a/lang/it.lang.json b/lang/it.lang.json index 8fe013d2..8eefc649 100644 --- a/lang/it.lang.json +++ b/lang/it.lang.json @@ -45,7 +45,9 @@ "Refreshing": "Aggiorna", "Pull": "Trascina in basso per aggiornare", "Release": "Rilascia per aggiornare", - "Close": "Chiudi" + "Close": "Chiudi", + "Yes": "Yes", + "No": "No" }, "wait": { "NotReady": "OpenDTU is not yet ready", @@ -193,7 +195,10 @@ "FirmwareVersion": "Versione Firmware", "FirmwareBuildDate": "Data Firmware", "HardwarePartNumber": "Hardware Part Number", - "HardwareVersion": "Hardware Version" + "HardwareVersion": "Hardware Version", + "SupportsPowerDistributionLogic": "'Power Distribution Logic' supported", + "Yes": "@:base.Yes", + "No": "@:base.No" }, "gridprofile": { "NoInfo": "@:devinfo.NoInfo", diff --git a/lib/Hoymiles/src/inverters/HMS_4CH.cpp b/lib/Hoymiles/src/inverters/HMS_4CH.cpp index 60a59d86..a8338015 100644 --- a/lib/Hoymiles/src/inverters/HMS_4CH.cpp +++ b/lib/Hoymiles/src/inverters/HMS_4CH.cpp @@ -75,3 +75,10 @@ uint8_t HMS_4CH::getByteAssignmentSize() const { return sizeof(byteAssignment) / sizeof(byteAssignment[0]); } + +bool HMS_4CH::supportsPowerDistributionLogic() +{ + // This feature was added in inverter firmware version 01.01.12 and + // will limit the AC output instead of limiting the DC inputs. + return DevInfo()->getFwBuildVersion() >= 10112U; +} diff --git a/lib/Hoymiles/src/inverters/HMS_4CH.h b/lib/Hoymiles/src/inverters/HMS_4CH.h index 9d49de07..545f91a7 100644 --- a/lib/Hoymiles/src/inverters/HMS_4CH.h +++ b/lib/Hoymiles/src/inverters/HMS_4CH.h @@ -10,4 +10,5 @@ public: String typeName() const; const byteAssign_t* getByteAssignment() const; uint8_t getByteAssignmentSize() const; -}; \ No newline at end of file + bool supportsPowerDistributionLogic() final; +}; diff --git a/lib/Hoymiles/src/inverters/HM_Abstract.cpp b/lib/Hoymiles/src/inverters/HM_Abstract.cpp index 5fd0b276..d58324da 100644 --- a/lib/Hoymiles/src/inverters/HM_Abstract.cpp +++ b/lib/Hoymiles/src/inverters/HM_Abstract.cpp @@ -219,3 +219,8 @@ bool HM_Abstract::sendGridOnProFileParaRequest() return true; } + +bool HM_Abstract::supportsPowerDistributionLogic() +{ + return false; +} diff --git a/lib/Hoymiles/src/inverters/HM_Abstract.h b/lib/Hoymiles/src/inverters/HM_Abstract.h index 491149dc..9f5c4b31 100644 --- a/lib/Hoymiles/src/inverters/HM_Abstract.h +++ b/lib/Hoymiles/src/inverters/HM_Abstract.h @@ -16,6 +16,7 @@ public: bool sendRestartControlRequest(); bool resendPowerControlRequest(); bool sendGridOnProFileParaRequest(); + bool supportsPowerDistributionLogic() override; private: uint8_t _lastAlarmLogCnt = 0; @@ -23,4 +24,4 @@ private: PowerLimitControlType _activePowerControlType = PowerLimitControlType::AbsolutNonPersistent; uint8_t _powerState = 1; -}; \ No newline at end of file +}; diff --git a/lib/Hoymiles/src/inverters/InverterAbstract.h b/lib/Hoymiles/src/inverters/InverterAbstract.h index 29fba12f..10da4d69 100644 --- a/lib/Hoymiles/src/inverters/InverterAbstract.h +++ b/lib/Hoymiles/src/inverters/InverterAbstract.h @@ -103,6 +103,9 @@ public: virtual bool sendChangeChannelRequest(); virtual bool sendGridOnProFileParaRequest() = 0; + // This feature will limit the AC output instead of limiting the DC inputs. + virtual bool supportsPowerDistributionLogic() = 0; + HoymilesRadio* getRadio(); AlarmLogParser* EventLog(); diff --git a/src/WebApi_devinfo.cpp b/src/WebApi_devinfo.cpp index 449cd177..45078ffe 100644 --- a/src/WebApi_devinfo.cpp +++ b/src/WebApi_devinfo.cpp @@ -35,6 +35,7 @@ void WebApiDevInfoClass::onDevInfoStatus(AsyncWebServerRequest* request) root["hw_model_name"] = inv->DevInfo()->getHwModelName(); root["max_power"] = inv->DevInfo()->getMaxPower(); root["fw_build_datetime"] = inv->DevInfo()->getFwBuildDateTimeStr(); + root["pdl_supported"] = inv->supportsPowerDistributionLogic(); } WebApi.sendJsonResponse(request, response, __FUNCTION__, __LINE__); diff --git a/webapp/src/components/DevInfo.vue b/webapp/src/components/DevInfo.vue index 7a998e1c..da2d81aa 100644 --- a/webapp/src/components/DevInfo.vue +++ b/webapp/src/components/DevInfo.vue @@ -46,6 +46,12 @@ {{ $t('devinfo.HardwareVersion') }} {{ devInfoList.hw_version }} + + {{ $t('devinfo.SupportsPowerDistributionLogic') }} + + + + @@ -53,6 +59,7 @@