mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-23 13:56:10 +02:00
0.7.37
* fix alarm time on WebGui #1099 * added RSSI info for HMS and HMT inverters (MqTT + REST API)
This commit is contained in:
parent
ba218edbdb
commit
4d19e2dde4
8 changed files with 32 additions and 19 deletions
|
@ -1,15 +1,8 @@
|
||||||
Changelog v0.7.36
|
# Development Changes
|
||||||
|
|
||||||
* added Ethernet variant
|
## 0.7.37 - 2023-08-18
|
||||||
* fix configuration of ePaper
|
* fix alarm time on WebGui #1099
|
||||||
* fix MI inverter support
|
* added RSSI info for HMS and HMT inverters (MqTT + REST API)
|
||||||
* endpoints `/api/record/live`, `/api/record/alarm`, `/api/record/config`, `/api/record/info` are obsolete
|
|
||||||
* added `/api/inverter/alarm/[ID]` to read inverter alarms
|
## 0.7.36
|
||||||
* added Alarms in Live View as modal window
|
* last Release
|
||||||
* 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
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 7
|
#define VERSION_MINOR 7
|
||||||
#define VERSION_PATCH 36
|
#define VERSION_PATCH 37
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -151,6 +151,7 @@ class Inverter {
|
||||||
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms
|
std::array<alarm_t, 10> lastAlarm; // holds last 10 alarms
|
||||||
uint8_t alarmNxtWrPos; // indicates the position in array (rolling buffer)
|
uint8_t alarmNxtWrPos; // indicates the position in array (rolling buffer)
|
||||||
uint16_t alarmCnt; // counts the total number of occured alarms
|
uint16_t alarmCnt; // counts the total number of occured alarms
|
||||||
|
int8_t rssi; // HMS and HMT inverters only
|
||||||
|
|
||||||
|
|
||||||
static uint32_t *timestamp; // system timestamp
|
static uint32_t *timestamp; // system timestamp
|
||||||
|
@ -171,6 +172,7 @@ class Inverter {
|
||||||
status = InverterStatus::OFF;
|
status = InverterStatus::OFF;
|
||||||
alarmNxtWrPos = 0;
|
alarmNxtWrPos = 0;
|
||||||
alarmCnt = 0;
|
alarmCnt = 0;
|
||||||
|
rssi = -127;
|
||||||
}
|
}
|
||||||
|
|
||||||
~Inverter() {
|
~Inverter() {
|
||||||
|
|
|
@ -19,6 +19,7 @@ typedef struct {
|
||||||
//uint8_t invId;
|
//uint8_t invId;
|
||||||
uint32_t ts;
|
uint32_t ts;
|
||||||
uint8_t data[MAX_PAYLOAD_ENTRIES][MAX_RF_PAYLOAD_SIZE];
|
uint8_t data[MAX_PAYLOAD_ENTRIES][MAX_RF_PAYLOAD_SIZE];
|
||||||
|
int8_t rssi[MAX_PAYLOAD_ENTRIES];
|
||||||
uint8_t len[MAX_PAYLOAD_ENTRIES];
|
uint8_t len[MAX_PAYLOAD_ENTRIES];
|
||||||
bool complete;
|
bool complete;
|
||||||
uint8_t maxPackId;
|
uint8_t maxPackId;
|
||||||
|
@ -160,6 +161,7 @@ class HmsPayload {
|
||||||
memcpy(mPayload[iv->id].data[(*pid & 0x7F) - 1], &p->data[11], p->data[0] - 11);
|
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].len[(*pid & 0x7F) - 1] = p->data[0] -11;
|
||||||
mPayload[iv->id].gotFragment = true;
|
mPayload[iv->id].gotFragment = true;
|
||||||
|
mPayload[iv->id].rssi[(*pid & 0x7F) - 1] = p->rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*pid & ALL_FRAMES) == ALL_FRAMES) {
|
if ((*pid & ALL_FRAMES) == ALL_FRAMES) {
|
||||||
|
@ -281,6 +283,8 @@ class HmsPayload {
|
||||||
|
|
||||||
memset(payload, 0, 150);
|
memset(payload, 0, 150);
|
||||||
|
|
||||||
|
int8_t rssi = -127;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId); i++) {
|
for (uint8_t i = 0; i < (mPayload[iv->id].maxPackId); i++) {
|
||||||
if((mPayload[iv->id].len[i] + payloadLen) > 150) {
|
if((mPayload[iv->id].len[i] + payloadLen) > 150) {
|
||||||
DPRINTLN(DBG_ERROR, F("payload buffer to small!"));
|
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]));
|
memcpy(&payload[payloadLen], mPayload[iv->id].data[i], (mPayload[iv->id].len[i]));
|
||||||
payloadLen += (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();
|
yield();
|
||||||
}
|
}
|
||||||
payloadLen -= 2;
|
payloadLen -= 2;
|
||||||
|
@ -310,6 +317,7 @@ class HmsPayload {
|
||||||
iv->addValue(i, payload, rec);
|
iv->addValue(i, payload, rec);
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
|
iv->rssi = rssi;
|
||||||
iv->doCalculations();
|
iv->doCalculations();
|
||||||
notify(mPayload[iv->id].txCmd, iv);
|
notify(mPayload[iv->id].txCmd, iv);
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,12 @@ class PubMqttIvData {
|
||||||
snprintf(mVal, 40, "%d", mIv->getLastTs(rec));
|
snprintf(mVal, 40, "%d", mIv->getLastTs(rec));
|
||||||
mPublish(mSubTopic, mVal, true, QOS_0);
|
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
|
mIv->isProducing(); // recalculate status
|
||||||
mState = SEND_DATA;
|
mState = SEND_DATA;
|
||||||
} else if(mSendTotals && mTotalFound)
|
} else if(mSendTotals && mTotalFound)
|
||||||
|
|
|
@ -367,6 +367,7 @@ class RestApi {
|
||||||
obj[F("generation")] = iv->ivGen;
|
obj[F("generation")] = iv->ivGen;
|
||||||
obj[F("status")] = (uint8_t)iv->status;
|
obj[F("status")] = (uint8_t)iv->status;
|
||||||
obj[F("alarm_cnt")] = iv->alarmCnt;
|
obj[F("alarm_cnt")] = iv->alarmCnt;
|
||||||
|
obj[F("rssi")] = iv->rssi;
|
||||||
|
|
||||||
JsonArray ch = obj.createNestedArray("ch");
|
JsonArray ch = obj.createNestedArray("ch");
|
||||||
|
|
||||||
|
|
|
@ -126,8 +126,8 @@ function toIsoDateStr(d) {
|
||||||
return new Date(d.getTime() + (d.getTimezoneOffset() * -60000)).toISOString().substring(0, 19).replace('T', ', ');
|
return new Date(d.getTime() + (d.getTimezoneOffset() * -60000)).toISOString().substring(0, 19).replace('T', ', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function toIsoTimeStr(d) {
|
function toIsoTimeStr(d) { // UTC!
|
||||||
return new Date(d.getTime() + (d.getTimezoneOffset() * -60000)).toISOString().substring(11, 19).replace('T', ', ');
|
return new Date(d.getTime()).toISOString().substring(11, 19).replace('T', ', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setHide(id, hide) {
|
function setHide(id, hide) {
|
||||||
|
|
|
@ -166,7 +166,7 @@
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tsInfo(ts) {
|
function tsInfo(ts, gen, rssi) {
|
||||||
var ageInfo = "Last received data requested at: ";
|
var ageInfo = "Last received data requested at: ";
|
||||||
if(ts > 0) {
|
if(ts > 0) {
|
||||||
var date = new Date(ts * 1000);
|
var date = new Date(ts * 1000);
|
||||||
|
@ -175,6 +175,9 @@
|
||||||
else
|
else
|
||||||
ageInfo += "nothing received";
|
ageInfo += "nothing received";
|
||||||
|
|
||||||
|
if((gen >= 2) && (rssi > -127))
|
||||||
|
ageInfo += " (RSSI: " + rssi + "dBm)";
|
||||||
|
|
||||||
return ml("div", {class: "mb-5"}, [
|
return ml("div", {class: "mb-5"}, [
|
||||||
ml("div", {class: "row p-1 ts-h mx-2"},
|
ml("div", {class: "row p-1 ts-h mx-2"},
|
||||||
ml("div", {class: "col"}, "")
|
ml("div", {class: "col"}, "")
|
||||||
|
@ -200,7 +203,7 @@
|
||||||
ml("div", {}, [
|
ml("div", {}, [
|
||||||
ivHead(obj),
|
ivHead(obj),
|
||||||
ml("div", {class: "row mb-2"}, chn),
|
ml("div", {class: "row mb-2"}, chn),
|
||||||
tsInfo(obj.ts_last_success)
|
tsInfo(obj.ts_last_success, obj.generation, obj.rssi)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue