Browse Source

Merge branch 'development03' into Ethernet+Wifi

main
lumapu 8 months ago
parent
commit
7f61698618
  1. 1
      src/CHANGES.md
  2. 2
      src/hm/Communication.h
  3. 16
      src/web/RestApi.h

1
src/CHANGES.md

@ -5,6 +5,7 @@
* fix typo in English versions * fix typo in English versions
* add yield day to history graph #1614 * add yield day to history graph #1614
* added script and [instructions](../manual/factory_firmware.md) how to generate factory firmware which includes predefined settings * 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 ## 0.8.118 - 2024-05-10
* possible fix reset max values #1609 * possible fix reset max values #1609

2
src/hm/Communication.h

@ -895,7 +895,7 @@ class Communication : public CommQueue<> {
uint8_t oldState = rec->record[q->iv->getPosByChFld(0, FLD_EVT, rec)]; uint8_t oldState = rec->record[q->iv->getPosByChFld(0, FLD_EVT, rec)];
if ( prntsts != oldState ) { // sth.'s changed? if ( prntsts != oldState ) { // sth.'s changed?
stsok = false; 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; changedStatus = true;
q->iv->alarmCnt = 1; // minimum... q->iv->alarmCnt = 1; // minimum...
} else { } else {

16
src/web/RestApi.h

@ -103,8 +103,10 @@ class RestApi {
else if(path == "setup/getip") getIp(root); else if(path == "setup/getip") getIp(root);
#endif /* !defined(ETHERNET) */ #endif /* !defined(ETHERNET) */
else if(path == "live") getLive(request,root); else if(path == "live") getLive(request,root);
#if defined(ENABLE_HISTORY)
else if (path == "powerHistory") getPowerHistory(request, root, HistoryStorageType::POWER); else if (path == "powerHistory") getPowerHistory(request, root, HistoryStorageType::POWER);
else if (path == "powerHistoryDay") getPowerHistory(request, root, HistoryStorageType::POWER_DAY); else if (path == "powerHistoryDay") getPowerHistory(request, root, HistoryStorageType::POWER_DAY);
#endif /*ENABLE_HISTORY*/
else { else {
if(path.substring(0, 12) == "inverter/id/") if(path.substring(0, 12) == "inverter/id/")
getInverter(root, request->url().substring(17).toInt()); 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) { void getPowerHistory(AsyncWebServerRequest *request, JsonObject obj, HistoryStorageType type) {
getGeneric(request, obj.createNestedObject(F("generic"))); getGeneric(request, obj.createNestedObject(F("generic")));
#if defined(ENABLE_HISTORY)
obj[F("refresh")] = mApp->getHistoryPeriod(static_cast<uint8_t>(type)); obj[F("refresh")] = mApp->getHistoryPeriod(static_cast<uint8_t>(type));
uint16_t max = 0; uint16_t max = 0;
@ -954,12 +956,12 @@ class RestApi {
} }
obj[F("lastValueTs")] = mApp->getHistoryLastValueTs(static_cast<uint8_t>(type)); obj[F("lastValueTs")] = mApp->getHistoryLastValueTs(static_cast<uint8_t>(type));
#endif /*ENABLE_HISTORY*/
} }
#endif /*ENABLE_HISTORY*/
/*void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) {
//getGeneric(request, obj.createNestedObject(F("generic"))); #if defined(ENABLE_HISTORY_YIELD_PER_DAY)
#if defined(ENABLE_HISTORY) && defined(ENABLE_HISTORY_YIELD_PER_DAY) void getYieldDayHistory(AsyncWebServerRequest *request, JsonObject obj) {
obj[F("refresh")] = mApp->getHistoryPeriod((uint8_t)HistoryStorageType::YIELD); obj[F("refresh")] = mApp->getHistoryPeriod((uint8_t)HistoryStorageType::YIELD);
uint16_t max = 0; uint16_t max = 0;
for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) { for (uint16_t fld = 0; fld < HISTORY_DATA_ARR_LENGTH; fld++) {
@ -969,8 +971,8 @@ class RestApi {
max = value; max = value;
} }
obj[F("max")] = max; obj[F("max")] = max;
#endif }
}*/ #endif /*ENABLE_HISTORY_YIELD_PER_DAY*/
bool setCtrl(JsonObject jsonIn, JsonObject jsonOut, const char *clientIP) { bool setCtrl(JsonObject jsonIn, JsonObject jsonOut, const char *clientIP) {
if(jsonIn.containsKey(F("auth"))) { if(jsonIn.containsKey(F("auth"))) {

Loading…
Cancel
Save