Browse Source

0.7.17

* next attempt to fix total yield day for multiple inverters #1016
* added two more states for the inverter status (also docu)
pull/1048/head
lumapu 2 years ago
parent
commit
812adce64e
  1. 2
      Getting_Started.md
  2. 2
      README.md
  3. 4
      User_Manual.md
  4. 4
      src/CHANGES.md
  5. 6
      src/app.cpp
  6. 3
      src/app.h
  7. 6
      src/defines.h
  8. 18
      src/publisher/pubMqtt.h
  9. 5
      src/publisher/pubMqttIvData.h

2
Getting_Started.md

@ -14,6 +14,8 @@ Hoymiles Inverters
| ----- | ----- | ------ | ------- | | ----- | ----- | ------ | ------- |
| ✔️ | MI | 300, 600, 1000/1200/⚠️ 1500 | 4-Channel is not tested yet | | ✔️ | MI | 300, 600, 1000/1200/⚠️ 1500 | 4-Channel is not tested yet |
| ✔️ | HM | 300, 350, 400, 600, 700, 800, 1000?, 1200, 1500 | | | ✔️ | 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). | | ⚠️ | 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 ## Table of Contents

2
README.md

@ -22,7 +22,7 @@ Table of approaches:
| Board | MI | HM | HMS/HMT | comment | HowTo start | | 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/) | ❌ | ✔️ | ❌ | | | [Arduino Nano, C++](tools/nano/NRF24_SendRcv/) | ❌ | ✔️ | ❌ | |
| [Raspberry Pi, Python](tools/rpi/) | ❌ | ✔️ | ❌ | | | [Raspberry Pi, Python](tools/rpi/) | ❌ | ✔️ | ❌ | |
| [Others, C/C++](tools/nano/NRF24_SendRcv/) | ❌ | ✔️ | ❌ | | | [Others, C/C++](tools/nano/NRF24_SendRcv/) | ❌ | ✔️ | ❌ | |

4
User_Manual.md

@ -48,9 +48,11 @@ The AhoyDTU will publish on the following topics
| status code | Remarks | | status code | Remarks |
|---|---| |---|---|
| 0 | not available and not producing | | 0 | off: not available and not producing |
| 1 | available but not producing | | 1 | available but not producing |
| 2 | available and producing | | 2 | available and producing |
| 3 | available and was producing |
| 4 | was available |
### `<TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch0/#` ### `<TOPIC>/<INVERTER_NAME_FROM_SETUP>/ch0/#`

4
src/CHANGES.md

@ -1,5 +1,9 @@
# Development Changes # 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 ## 0.7.16 - 2023-07-24
* next attempt to fix yield day for multiple inverters #1016 * next attempt to fix yield day for multiple inverters #1016
* fix export settings date #1040 * fix export settings date #1040

6
src/app.cpp

@ -322,14 +322,14 @@ void app::tickComm(void) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void app::tickZeroValues(void) { void app::tickZeroValues(void) {
zeroIvValues(false); zeroIvValues(!CHECK_AVAIL, SKIP_YIELD_DAY);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void app::tickMinute(void) { void app::tickMinute(void) {
// only triggered if 'reset values on no avail is enabled' // 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 uint32_t nxtTrig = gTimezone.toUTC(localTime - (localTime % 86400) + 86400); // next midnight local time
onceAt(std::bind(&app::tickMidnight, this), nxtTrig, "mid2"); onceAt(std::bind(&app::tickMidnight, this), nxtTrig, "mid2");
zeroIvValues(false, false); zeroIvValues(!CHECK_AVAIL, !SKIP_YIELD_DAY);
if (mMqttEnabled) if (mMqttEnabled)
mMqtt.tickerMidnight(); mMqtt.tickerMidnight();

3
src/app.h

@ -239,6 +239,9 @@ class app : public IApp, public ah::Scheduler {
} }
private: private:
#define CHECK_AVAIL true
#define SKIP_YIELD_DAY true
typedef std::function<void()> innerLoopCb; typedef std::function<void()> innerLoopCb;
void resetSystem(void); void resetSystem(void);

6
src/defines.h

@ -13,7 +13,7 @@
//------------------------------------- //-------------------------------------
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 7 #define VERSION_MINOR 7
#define VERSION_PATCH 16 #define VERSION_PATCH 17
//------------------------------------- //-------------------------------------
typedef struct { typedef struct {
@ -74,10 +74,6 @@ union serial_u {
#define MIN_MQTT_INTERVAL 60 #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}; enum {MQTT_STATUS_OFFLINE = 0, MQTT_STATUS_PARTIAL, MQTT_STATUS_ONLINE};
//------------------------------------- //-------------------------------------

18
src/publisher/pubMqtt.h

@ -49,7 +49,7 @@ class PubMqtt {
mRxCnt = 0; mRxCnt = 0;
mTxCnt = 0; mTxCnt = 0;
mSubscriptionCb = NULL; 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); memset(mIvLastRTRpub, 0, MAX_NUM_INVERTERS * 4);
mLastAnyAvail = false; mLastAnyAvail = false;
mZeroValues = false; mZeroValues = false;
@ -488,24 +488,22 @@ class PubMqtt {
rec = iv->getRecordStruct(RealTimeRunData_Debug); rec = iv->getRecordStruct(RealTimeRunData_Debug);
// inverter status // inverter status
uint8_t status = MQTT_STATUS_NOT_AVAIL_NOT_PROD; iv->isProducing(); // recalculate status
if (iv->isAvailable()) { if (iv->isAvailable())
anyAvail = true; anyAvail = true;
status = (iv->isProducing()) ? MQTT_STATUS_AVAIL_PROD : MQTT_STATUS_AVAIL_NOT_PROD;
}
else // inverter is enabled but not available else // inverter is enabled but not available
allAvail = false; allAvail = false;
if(mLastIvState[id] != status) { if(mLastIvState[id] != iv->status) {
// if status changed from producing to not producing send last data immediately // 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); sendData(iv, RealTimeRunData_Debug);
mLastIvState[id] = status; mLastIvState[id] = iv->status;
changed = true; changed = true;
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/available", iv->config->name); 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); publish(mSubTopic, mVal, true);
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/last_success", iv->config->name); snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/last_success", iv->config->name);
@ -596,7 +594,7 @@ class PubMqtt {
subscriptionCb mSubscriptionCb; subscriptionCb mSubscriptionCb;
bool mLastAnyAvail; bool mLastAnyAvail;
bool mZeroValues; bool mZeroValues;
uint8_t mLastIvState[MAX_NUM_INVERTERS]; InverterStatus mLastIvState[MAX_NUM_INVERTERS];
uint32_t mIvLastRTRpub[MAX_NUM_INVERTERS]; uint32_t mIvLastRTRpub[MAX_NUM_INVERTERS];
uint16_t mIntervalTimeout; uint16_t mIntervalTimeout;

5
src/publisher/pubMqttIvData.h

@ -99,9 +99,10 @@ class PubMqttIvData {
mLastIvId++; mLastIvId++;
mPos = 0; mPos = 0;
if(found) if(found) {
mIv->isProducing(); // recalculate status
mState = SEND_DATA; mState = SEND_DATA;
else if(mSendTotals && mTotalFound) } else if(mSendTotals && mTotalFound)
mState = SEND_TOTALS; mState = SEND_TOTALS;
else { else {
mSendList->pop(); mSendList->pop();

Loading…
Cancel
Save