Browse Source

0.7.4

* fix MqTT `P_AC` send if inverters are available #987
* fix assignments for HMS 1CH and 2CH devices
* fixed uptime overflow #990
pull/1005/head
lumapu 2 years ago
parent
commit
f649d26f66
  1. 5
      src/CHANGES.md
  2. 2
      src/app.cpp
  3. 2
      src/defines.h
  4. 3
      src/hm/hmDefines.h
  5. 28
      src/hm/hmInverter.h
  6. 7
      src/publisher/pubMqtt.h
  7. 3
      src/publisher/pubMqttIvData.h
  8. 2
      src/utils/scheduler.h
  9. 1
      src/web/html/visualization.html

5
src/CHANGES.md

@ -1,5 +1,10 @@
# Development Changes
## 0.7.4 - 2023-06-15
* fix MqTT `P_AC` send if inverters are available #987
* fix assignments for HMS 1CH and 2CH devices
* fixed uptime overflow #990
## 0.7.3 - 2023-06-09
* fix hidden SSID scan #983
* improved NRF24 missing message on home screen #981

2
src/app.cpp

@ -81,7 +81,7 @@ void app::setup() {
#if !defined(AP_ONLY)
mMqttEnabled = (mConfig->mqtt.broker[0] > 0);
if (mMqttEnabled) {
mMqtt.setup(&mConfig->mqtt, mConfig->sys.deviceName, mVersion, &mSys, &mTimestamp);
mMqtt.setup(&mConfig->mqtt, mConfig->sys.deviceName, mVersion, &mSys, &mTimestamp, &mUptime);
mMqtt.setSubscriptionCb(std::bind(&app::mqttSubRxCb, this, std::placeholders::_1));
mPayload.addAlarmListener(std::bind(&PubMqttType::alarmEventListener, &mMqtt, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
mMiPayload.addAlarmListener(std::bind(&PubMqttType::alarmEventListener, &mMqtt, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 7
#define VERSION_PATCH 3
#define VERSION_PATCH 4
//-------------------------------------
typedef struct {

3
src/hm/hmDefines.h

@ -32,7 +32,8 @@ const char* const fields[] = {"U_DC", "I_DC", "P_DC", "YieldDay", "YieldWeek", "
const char* const notAvail = "n/a";
const uint8_t fieldUnits[] = {UNIT_V, UNIT_A, UNIT_W, UNIT_WH, UNIT_KWH, UNIT_KWH,
UNIT_V, UNIT_A, UNIT_W, UNIT_HZ, UNIT_C, UNIT_NONE, UNIT_PCT, UNIT_PCT, UNIT_VAR,
UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_V, UNIT_A, UNIT_A, UNIT_A, UNIT_A,
UNIT_W, UNIT_HZ, UNIT_C, UNIT_NONE, UNIT_PCT, UNIT_PCT, UNIT_VAR,
UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_NONE, UNIT_PCT, UNIT_NONE};
// mqtt discovery device classes

28
src/hm/hmInverter.h

@ -422,16 +422,28 @@ class Inverter {
switch (cmd) {
case RealTimeRunData_Debug:
if (INV_TYPE_1CH == type) {
rec->length = (uint8_t)(HM1CH_LIST_LEN);
rec->assign = (byteAssign_t *)hm1chAssignment;
rec->pyldLen = HM1CH_PAYLOAD_LEN;
channels = 1;
if(IV_HM == ivGen) {
rec->length = (uint8_t)(HM1CH_LIST_LEN);
rec->assign = (byteAssign_t *)hm1chAssignment;
rec->pyldLen = HM1CH_PAYLOAD_LEN;
} else if(IV_HMS == ivGen) {
rec->length = (uint8_t)(HMS1CH_LIST_LEN);
rec->assign = (byteAssign_t *)hms1chAssignment;
rec->pyldLen = HMS1CH_PAYLOAD_LEN;
}
channels = 1;
}
else if (INV_TYPE_2CH == type) {
rec->length = (uint8_t)(HM2CH_LIST_LEN);
rec->assign = (byteAssign_t *)hm2chAssignment;
rec->pyldLen = HM2CH_PAYLOAD_LEN;
channels = 2;
if(IV_HM == ivGen) {
rec->length = (uint8_t)(HM2CH_LIST_LEN);
rec->assign = (byteAssign_t *)hm2chAssignment;
rec->pyldLen = HM2CH_PAYLOAD_LEN;
} else if(IV_HMS == ivGen) {
rec->length = (uint8_t)(HMS2CH_LIST_LEN);
rec->assign = (byteAssign_t *)hms2chAssignment;
rec->pyldLen = HMS2CH_PAYLOAD_LEN;
}
channels = 2;
}
else if (INV_TYPE_4CH == type) {
if(IV_HM == ivGen) {

7
src/publisher/pubMqtt.h

@ -56,12 +56,13 @@ class PubMqtt {
~PubMqtt() { }
void setup(cfgMqtt_t *cfg_mqtt, const char *devName, const char *version, HMSYSTEM *sys, uint32_t *utcTs) {
void setup(cfgMqtt_t *cfg_mqtt, const char *devName, const char *version, HMSYSTEM *sys, uint32_t *utcTs, uint32_t *uptime) {
mCfgMqtt = cfg_mqtt;
mDevName = devName;
mVersion = version;
mSys = sys;
mUtcTimestamp = utcTs;
mUptime = uptime;
mIntervalTimeout = 1;
mSendIvData.setup(sys, utcTs, &mSendList);
@ -126,7 +127,7 @@ class PubMqtt {
}
void tickerMinute() {
snprintf(mVal, 40, "%ld", millis() / 1000);
snprintf(mVal, 40, "%d", (*mUptime));
publish(subtopics[MQTT_UPTIME], mVal);
publish(subtopics[MQTT_RSSI], String(WiFi.RSSI()).c_str());
publish(subtopics[MQTT_FREE_HEAP], String(ESP.getFreeHeap()).c_str());
@ -582,7 +583,7 @@ class PubMqtt {
HMSYSTEM *mSys;
PubMqttIvData<HMSYSTEM> mSendIvData;
uint32_t *mUtcTimestamp;
uint32_t *mUtcTimestamp, *mUptime;
uint32_t mRxCnt, mTxCnt;
std::queue<sendListCmdIv> mSendList;
std::queue<alarm_t> mAlarmList;

3
src/publisher/pubMqttIvData.h

@ -121,7 +121,8 @@ class PubMqttIvData {
case FLD_YD:
if ((rec->assign[mPos].ch == CH0) && (!mIv->isProducing(*mUtcTimestamp))) { // avoids returns to 0 on restart
mPos++;
mSendTotals = false; // avoid send total values on not producing, because the sum of values is no built
if(!mIv->isAvailable(*mUtcTimestamp))
mSendTotals = false; // avoid send total values on not producing, because the sum of values is no built
return;
}
retained = true;

2
src/utils/scheduler.h

@ -117,6 +117,7 @@ namespace ah {
protected:
uint32_t mTimestamp;
uint32_t mUptime;
private:
inline uint8_t addTicker(scdCb c, uint32_t timeout, uint32_t reload, bool isTimestamp, const char *name) {
@ -162,7 +163,6 @@ namespace ah {
sP mTicker[MAX_NUM_TICKER];
bool mTickerInUse[MAX_NUM_TICKER];
uint32_t mMillis, mPrevMillis, mDiff;
uint32_t mUptime;
uint8_t mDiffSeconds;
uint8_t mMax;
};

1
src/web/html/visualization.html

@ -19,7 +19,6 @@
var units, ivEn;
var mIvHtml = [];
var mNum = 0;
var names = ["Voltage", "Current", "Power", "Yield Day", "Yield Total", "Irradiation"];
var total = Array(5).fill(0);
function parseGeneric(obj) {

Loading…
Cancel
Save