mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-22 21:36:11 +02:00
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
This commit is contained in:
parent
bdf43fd522
commit
f649d26f66
9 changed files with 36 additions and 17 deletions
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//-------------------------------------
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 7
|
||||
#define VERSION_PATCH 3
|
||||
#define VERSION_PATCH 4
|
||||
|
||||
//-------------------------------------
|
||||
typedef struct {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -422,15 +422,27 @@ class Inverter {
|
|||
switch (cmd) {
|
||||
case RealTimeRunData_Debug:
|
||||
if (INV_TYPE_1CH == type) {
|
||||
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) {
|
||||
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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -121,6 +121,7 @@ class PubMqttIvData {
|
|||
case FLD_YD:
|
||||
if ((rec->assign[mPos].ch == CH0) && (!mIv->isProducing(*mUtcTimestamp))) { // avoids returns to 0 on restart
|
||||
mPos++;
|
||||
if(!mIv->isAvailable(*mUtcTimestamp))
|
||||
mSendTotals = false; // avoid send total values on not producing, because the sum of values is no built
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue