diff --git a/src/CHANGES.md b/src/CHANGES.md index d3721677..1cef0a8a 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -5,6 +5,7 @@ * fix typo in English versions * add yield day to history graph #1614 * added script and [instructions](../manual/factory_firmware.md) how to generate factory firmware which includes predefined settings +* merge PR: Fix MI overnight behaviour #1626 ## 0.8.118 - 2024-05-10 * possible fix reset max values #1609 diff --git a/src/hm/Communication.h b/src/hm/Communication.h index c4881535..3192c513 100644 --- a/src/hm/Communication.h +++ b/src/hm/Communication.h @@ -895,7 +895,7 @@ class Communication : public CommQueue<> { uint8_t oldState = rec->record[q->iv->getPosByChFld(0, FLD_EVT, rec)]; if ( prntsts != oldState ) { // sth.'s changed? stsok = false; - if(!oldState) { // initial zero value? => just write this channel to main state and raise changed flags + if( (!oldState) || (!q->iv->alarmCnt) ) { // initial zero value? => just write this channel to main state and raise changed flags changedStatus = true; q->iv->alarmCnt = 1; // minimum... } else { diff --git a/src/web/RestApi.h b/src/web/RestApi.h index f3ca6bc9..eaa18a0f 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -103,8 +103,10 @@ class RestApi { else if(path == "setup/getip") getIp(root); #endif /* !defined(ETHERNET) */ else if(path == "live") getLive(request,root); + #if defined(ENABLE_HISTORY) else if (path == "powerHistory") getPowerHistory(request, root, HistoryStorageType::POWER); else if (path == "powerHistoryDay") getPowerHistory(request, root, HistoryStorageType::POWER_DAY); + #endif /*ENABLE_HISTORY*/ else { if(path.substring(0, 12) == "inverter/id/") getInverter(root, request->url().substring(17).toInt()); @@ -927,9 +929,9 @@ class RestApi { } } + #if defined(ENABLE_HISTORY) void getPowerHistory(AsyncWebServerRequest *request, JsonObject obj, HistoryStorageType type) { getGeneric(request, obj.createNestedObject(F("generic"))); - #if defined(ENABLE_HISTORY) obj[F("refresh")] = mApp->getHistoryPeriod(static_cast(type)); uint16_t max = 0; @@ -954,12 +956,12 @@ class RestApi { } obj[F("lastValueTs")] = mApp->getHistoryLastValueTs(static_cast(type)); - #endif /*ENABLE_HISTORY*/ } + #endif /*ENABLE_HISTORY*/ - /*void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) { - //getGeneric(request, obj.createNestedObject(F("generic"))); - #if defined(ENABLE_HISTORY) && defined(ENABLE_HISTORY_YIELD_PER_DAY) + + #if defined(ENABLE_HISTORY_YIELD_PER_DAY) + void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) { obj[F("refresh")] = mApp->getHistoryPeriod((uint8_t)HistoryStorageType::YIELD); uint16_t max = 0; for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) { @@ -969,8 +971,8 @@ class RestApi { max = value; } obj[F("max")] = max; - #endif - }*/ + } + #endif /*ENABLE_HISTORY_YIELD_PER_DAY*/ bool setCtrl(JsonObject jsonIn, JsonObject jsonOut, const char *clientIP) { if(jsonIn.containsKey(F("auth"))) {