diff --git a/Getting_Started.md b/Getting_Started.md index d66aeca0..e0254c12 100644 --- a/Getting_Started.md +++ b/Getting_Started.md @@ -14,6 +14,8 @@ Hoymiles Inverters | ----- | ----- | ------ | ------- | | ✔️ | MI | 300, 600, 1000/1200/⚠️ 1500 | 4-Channel is not tested yet | | ✔️ | HM | 300, 350, 400, 600, 700, 800, 1000?, 1200, 1500 | | +| ✔️ | HMS | 350, 500, 800, 1000, 1600, 1800, 2000 | | +| ✔️ | HMT | 1600, 1800, 2250 | | | ⚠️ | TSUN | [TSOL-M350](https://www.tsun-ess.com/Micro-Inverter/M350-M400), [TSOL-M400](https://www.tsun-ess.com/Micro-Inverter/M350-M400), [TSOL-M800/TSOL-M800(DE)](https://www.tsun-ess.com/Micro-Inverter/M800) | others may work as well (need to be verified). | ## Table of Contents diff --git a/README.md b/README.md index 1af6f41d..e744dde8 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Table of approaches: | Board | MI | HM | HMS/HMT | comment | HowTo start | | ------ | -- | -- | ------- | ------- | ---------- | -| [ESP8266/ESP32, C++](Getting_Started.md) | ✔️ | ✔️ | ✔️ development version ✨ | 👈 the most effort is spent here | [create your own DTU](https://ahoydtu.de/getting_started/) | +| [ESP8266/ESP32, C++](Getting_Started.md) | ✔️ | ✔️ | ✔️ ✨ | 👈 the most effort is spent here | [create your own DTU](https://ahoydtu.de/getting_started/) | | [Arduino Nano, C++](tools/nano/NRF24_SendRcv/) | ❌ | ✔️ | ❌ | | | [Raspberry Pi, Python](tools/rpi/) | ❌ | ✔️ | ❌ | | | [Others, C/C++](tools/nano/NRF24_SendRcv/) | ❌ | ✔️ | ❌ | | diff --git a/User_Manual.md b/User_Manual.md index a7be8f80..1508a60f 100644 --- a/User_Manual.md +++ b/User_Manual.md @@ -48,9 +48,11 @@ The AhoyDTU will publish on the following topics | status code | Remarks | |---|---| -| 0 | not available and not producing | +| 0 | off: not available and not producing | | 1 | available but not producing | | 2 | available and producing | +| 3 | available and was producing | +| 4 | was available | ### `//ch0/#` diff --git a/src/CHANGES.md b/src/CHANGES.md index b428404c..17d25923 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -1,5 +1,9 @@ # Development Changes +## 0.7.17 - 2023-07-25 +* next attempt to fix yield day for multiple inverters #1016 +* added two more states for the inverter status (also docu) + ## 0.7.16 - 2023-07-24 * next attempt to fix yield day for multiple inverters #1016 * fix export settings date #1040 diff --git a/src/app.cpp b/src/app.cpp index e13943e9..56a85f18 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -322,14 +322,14 @@ void app::tickComm(void) { //----------------------------------------------------------------------------- void app::tickZeroValues(void) { - zeroIvValues(false); + zeroIvValues(!CHECK_AVAIL, SKIP_YIELD_DAY); } //----------------------------------------------------------------------------- void app::tickMinute(void) { // only triggered if 'reset values on no avail is enabled' - zeroIvValues(true); + zeroIvValues(CHECK_AVAIL, SKIP_YIELD_DAY); } //----------------------------------------------------------------------------- @@ -339,7 +339,7 @@ void app::tickMidnight(void) { uint32_t nxtTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86400); // next midnight local time onceAt(std::bind(&app::tickMidnight, this), nxtTrig, "mid2"); - zeroIvValues(false, false); + zeroIvValues(!CHECK_AVAIL, !SKIP_YIELD_DAY); if (mMqttEnabled) mMqtt.tickerMidnight(); diff --git a/src/app.h b/src/app.h index 6f9cda5d..585147b2 100644 --- a/src/app.h +++ b/src/app.h @@ -239,6 +239,9 @@ class app : public IApp, public ah::Scheduler { } private: + #define CHECK_AVAIL true + #define SKIP_YIELD_DAY true + typedef std::function innerLoopCb; void resetSystem(void); diff --git a/src/defines.h b/src/defines.h index b203aa01..1e7a61ee 100644 --- a/src/defines.h +++ b/src/defines.h @@ -13,7 +13,7 @@ //------------------------------------- #define VERSION_MAJOR 0 #define VERSION_MINOR 7 -#define VERSION_PATCH 16 +#define VERSION_PATCH 17 //------------------------------------- typedef struct { @@ -74,10 +74,6 @@ union serial_u { #define MIN_MQTT_INTERVAL 60 -#define MQTT_STATUS_NOT_AVAIL_NOT_PROD 0 -#define MQTT_STATUS_AVAIL_NOT_PROD 1 -#define MQTT_STATUS_AVAIL_PROD 2 - enum {MQTT_STATUS_OFFLINE = 0, MQTT_STATUS_PARTIAL, MQTT_STATUS_ONLINE}; //------------------------------------- diff --git a/src/publisher/pubMqtt.h b/src/publisher/pubMqtt.h index 943017ed..fa12e969 100644 --- a/src/publisher/pubMqtt.h +++ b/src/publisher/pubMqtt.h @@ -49,7 +49,7 @@ class PubMqtt { mRxCnt = 0; mTxCnt = 0; mSubscriptionCb = NULL; - memset(mLastIvState, MQTT_STATUS_NOT_AVAIL_NOT_PROD, MAX_NUM_INVERTERS); + memset(mLastIvState, (uint8_t)InverterStatus::OFF, MAX_NUM_INVERTERS); memset(mIvLastRTRpub, 0, MAX_NUM_INVERTERS * 4); mLastAnyAvail = false; mZeroValues = false; @@ -488,24 +488,22 @@ class PubMqtt { rec = iv->getRecordStruct(RealTimeRunData_Debug); // inverter status - uint8_t status = MQTT_STATUS_NOT_AVAIL_NOT_PROD; - if (iv->isAvailable()) { + iv->isProducing(); // recalculate status + if (iv->isAvailable()) anyAvail = true; - status = (iv->isProducing()) ? MQTT_STATUS_AVAIL_PROD : MQTT_STATUS_AVAIL_NOT_PROD; - } else // inverter is enabled but not available allAvail = false; - if(mLastIvState[id] != status) { + if(mLastIvState[id] != iv->status) { // if status changed from producing to not producing send last data immediately - if (MQTT_STATUS_AVAIL_PROD == mLastIvState[id]) + if (InverterStatus::WAS_PRODUCING == mLastIvState[id]) sendData(iv, RealTimeRunData_Debug); - mLastIvState[id] = status; + mLastIvState[id] = iv->status; changed = true; snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/available", iv->config->name); - snprintf(mVal, 40, "%d", status); + snprintf(mVal, 40, "%d", (uint8_t)iv->status); publish(mSubTopic, mVal, true); snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/last_success", iv->config->name); @@ -596,7 +594,7 @@ class PubMqtt { subscriptionCb mSubscriptionCb; bool mLastAnyAvail; bool mZeroValues; - uint8_t mLastIvState[MAX_NUM_INVERTERS]; + InverterStatus mLastIvState[MAX_NUM_INVERTERS]; uint32_t mIvLastRTRpub[MAX_NUM_INVERTERS]; uint16_t mIntervalTimeout; diff --git a/src/publisher/pubMqttIvData.h b/src/publisher/pubMqttIvData.h index 7ca51f2e..41e6a0bd 100644 --- a/src/publisher/pubMqttIvData.h +++ b/src/publisher/pubMqttIvData.h @@ -99,9 +99,10 @@ class PubMqttIvData { mLastIvId++; mPos = 0; - if(found) + if(found) { + mIv->isProducing(); // recalculate status mState = SEND_DATA; - else if(mSendTotals && mTotalFound) + } else if(mSendTotals && mTotalFound) mState = SEND_TOTALS; else { mSendList->pop();