Browse Source

0.7.37

* fix alarm time on WebGui #1099
* added RSSI info for HMS and HMT inverters (MqTT + REST API)
pull/1116/head
lumapu 1 year ago
parent
commit
4d19e2dde4
  1. 21
      src/CHANGES.md
  2. 2
      src/defines.h
  3. 2
      src/hm/hmInverter.h
  4. 8
      src/hms/hmsPayload.h
  5. 6
      src/publisher/pubMqttIvData.h
  6. 1
      src/web/RestApi.h
  7. 4
      src/web/html/api.js
  8. 7
      src/web/html/visualization.html

21
src/CHANGES.md

@ -1,15 +1,8 @@
Changelog v0.7.36
# Development Changes
* added Ethernet variant
* fix configuration of ePaper
* fix MI inverter support
* endpoints `/api/record/live`, `/api/record/alarm`, `/api/record/config`, `/api/record/info` are obsolete
* added `/api/inverter/alarm/[ID]` to read inverter alarms
* added Alarms in Live View as modal window
* added MqTT transmission of last 10 alarms
* updated documentation
* changed `ESP8266` default NRF24 pin assignments (`D3` = `CE` and `D4` = `IRQ`)
* changed live view to gray once inverter isn't available -> fast identify if inverters are online
* added information about maximum power (AC and DC)
* updated documentation
* several small fixes
## 0.7.37 - 2023-08-18
* fix alarm time on WebGui #1099
* added RSSI info for HMS and HMT inverters (MqTT + REST API)
## 0.7.36
* last Release

2
src/defines.h

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

2
src/hm/hmInverter.h

@ -151,6 +151,7 @@ class Inverter {
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms
uint8_t alarmNxtWrPos; // indicates the position in array (rolling buffer)
uint16_t alarmCnt; // counts the total number of occured alarms
int8_t rssi; // HMS and HMT inverters only
static uint32_t *timestamp; // system timestamp
@ -171,6 +172,7 @@ class Inverter {
status = InverterStatus::OFF;
alarmNxtWrPos = 0;
alarmCnt = 0;
rssi = -127;
}
~Inverter() {

8
src/hms/hmsPayload.h

@ -19,6 +19,7 @@ typedef struct {
//uint8_t invId;
uint32_t ts;
uint8_t data[MAX_PAYLOAD_ENTRIES][MAX_RF_PAYLOAD_SIZE];
int8_t rssi[MAX_PAYLOAD_ENTRIES];
uint8_t len[MAX_PAYLOAD_ENTRIES];
bool complete;
uint8_t maxPackId;
@ -160,6 +161,7 @@ class HmsPayload {
memcpy(mPayload[iv->id].data[(*pid & 0x7F) - 1], &p->data[11], p->data[0] - 11);
mPayload[iv->id].len[(*pid & 0x7F) - 1] = p->data[0] -11;
mPayload[iv->id].gotFragment = true;
mPayload[iv->id].rssi[(*pid & 0x7F) - 1] = p->rssi;
}
if ((*pid & ALL_FRAMES) == ALL_FRAMES) {
@ -281,6 +283,8 @@ class HmsPayload {
memset(payload, 0, 150);
int8_t rssi = -127;
for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId); i++) {
if((mPayload[iv->id].len[i] + payloadLen) > 150) {
DPRINTLN(DBG_ERROR, F("payload buffer to small!"));
@ -288,6 +292,9 @@ class HmsPayload {
}
memcpy(&payload[payloadLen], mPayload[iv->id].data[i], (mPayload[iv->id].len[i]));
payloadLen += (mPayload[iv->id].len[i]);
// get worst RSSI
if(mPayload[iv->id].rssi[i] > rssi)
rssi = mPayload[iv->id].rssi[i];
yield();
}
payloadLen -= 2;
@ -310,6 +317,7 @@ class HmsPayload {
iv->addValue(i, payload, rec);
yield();
}
iv->rssi = rssi;
iv->doCalculations();
notify(mPayload[iv->id].txCmd, iv);

6
src/publisher/pubMqttIvData.h

@ -106,6 +106,12 @@ class PubMqttIvData {
snprintf(mVal, 40, "%d", mIv->getLastTs(rec));
mPublish(mSubTopic, mVal, true, QOS_0);
if((mIv->ivGen == IV_HMS) || (mIv->ivGen == IV_HMT)) {
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/ch0/rssi", mIv->config->name);
snprintf(mVal, 40, "%d", mIv->rssi);
mPublish(mSubTopic, mVal, false, QOS_0);
}
mIv->isProducing(); // recalculate status
mState = SEND_DATA;
} else if(mSendTotals && mTotalFound)

1
src/web/RestApi.h

@ -367,6 +367,7 @@ class RestApi {
obj[F("generation")] = iv->ivGen;
obj[F("status")] = (uint8_t)iv->status;
obj[F("alarm_cnt")] = iv->alarmCnt;
obj[F("rssi")] = iv->rssi;
JsonArray ch = obj.createNestedArray("ch");

4
src/web/html/api.js

@ -126,8 +126,8 @@ function toIsoDateStr(d) {
return new Date(d.getTime() + (d.getTimezoneOffset() * -60000)).toISOString().substring(0, 19).replace('T', ', ');
}
function toIsoTimeStr(d) {
return new Date(d.getTime() + (d.getTimezoneOffset() * -60000)).toISOString().substring(11, 19).replace('T', ', ');
function toIsoTimeStr(d) { // UTC!
return new Date(d.getTime()).toISOString().substring(11, 19).replace('T', ', ');
}
function setHide(id, hide) {

7
src/web/html/visualization.html

@ -166,7 +166,7 @@
]);
}
function tsInfo(ts) {
function tsInfo(ts, gen, rssi) {
var ageInfo = "Last received data requested at: ";
if(ts > 0) {
var date = new Date(ts * 1000);
@ -175,6 +175,9 @@
else
ageInfo += "nothing received";
if((gen >= 2) && (rssi > -127))
ageInfo += " (RSSI: " + rssi + "dBm)";
return ml("div", {class: "mb-5"}, [
ml("div", {class: "row p-1 ts-h mx-2"},
ml("div", {class: "col"}, "")
@ -200,7 +203,7 @@
ml("div", {}, [
ivHead(obj),
ml("div", {class: "row mb-2"}, chn),
tsInfo(obj.ts_last_success)
tsInfo(obj.ts_last_success, obj.generation, obj.rssi)
])
);

Loading…
Cancel
Save