diff --git a/lib/Hoymiles/src/Hoymiles.cpp b/lib/Hoymiles/src/Hoymiles.cpp index eda3500b5..b14585905 100644 --- a/lib/Hoymiles/src/Hoymiles.cpp +++ b/lib/Hoymiles/src/Hoymiles.cpp @@ -114,7 +114,7 @@ void HoymilesClass::loop() } // Fetch grid profile - if (iv->Statistics()->getLastUpdate() > 0 && iv->GridProfile()->getLastUpdate() == 0) { + if (iv->Statistics()->getLastUpdate() > 0 && (iv->GridProfile()->getLastUpdate() == 0 || !iv->GridProfile()->containsValidData())) { iv->sendGridOnProFileParaRequest(); } diff --git a/lib/Hoymiles/src/parser/GridProfileParser.cpp b/lib/Hoymiles/src/parser/GridProfileParser.cpp index 37cb1d4ac..a7b912a9e 100644 --- a/lib/Hoymiles/src/parser/GridProfileParser.cpp +++ b/lib/Hoymiles/src/parser/GridProfileParser.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * Copyright (C) 2023 Thomas Basler and others + * Copyright (C) 2023 - 2024 Thomas Basler and others */ #include "GridProfileParser.h" #include "../Hoymiles.h" @@ -446,6 +446,11 @@ std::list GridProfileParser::getProfile() const return l; } +bool GridProfileParser::containsValidData() const +{ + return _gridProfileLength > 6; +} + uint8_t GridProfileParser::getSectionSize(const uint8_t section_id, const uint8_t section_version) { uint8_t count = 0; diff --git a/lib/Hoymiles/src/parser/GridProfileParser.h b/lib/Hoymiles/src/parser/GridProfileParser.h index 1be12e1d3..7afdfb825 100644 --- a/lib/Hoymiles/src/parser/GridProfileParser.h +++ b/lib/Hoymiles/src/parser/GridProfileParser.h @@ -43,6 +43,8 @@ class GridProfileParser : public Parser { std::list getProfile() const; + bool containsValidData() const; + private: static uint8_t getSectionSize(const uint8_t section_id, const uint8_t section_version); static int16_t getSectionStart(const uint8_t section_id, const uint8_t section_version); @@ -52,4 +54,4 @@ class GridProfileParser : public Parser { static const std::array _profileTypes; static const std::array _profileValues; -}; \ No newline at end of file +};