Skip to content

Commit 24ceb3e

Browse files
committed
0.8.130
* add timestamp to JSON output #1707 * restart Ahoy using MqTT #1667
1 parent a8117ee commit 24ceb3e

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

src/CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* merge PR: Power limit command accelerated #1704
66
* merge PR: reduce update cycle of ePaper from 5 to 10 seconds #1706
77
* merge PR: small fixes in different files #1711
8+
* add timestamp to JSON output #1707
9+
* restart Ahoy using MqTT #1667
810

911
## 0.8.129 - 2024-07-11
1012
* sort alarms ascending #1471

src/publisher/pubMqtt.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ class PubMqtt {
285285
tickerMinute();
286286
publish(mLwtTopic.data(), mqttStr[MQTT_STR_LWT_CONN], true, false);
287287

288+
snprintf(mVal.data(), mVal.size(), "ctrl/restart_ahoy");
289+
subscribe(mVal.data());
290+
288291
for(uint8_t i = 0; i < MAX_NUM_INVERTERS; i++) {
289292
snprintf(mVal.data(), mVal.size(), "ctrl/limit/%d", i);
290293
subscribe(mVal.data(), QOS_2);
@@ -386,9 +389,9 @@ class PubMqtt {
386389
pos++;
387390
}
388391

389-
/*char out[128];
392+
char out[128];
390393
serializeJson(root, out, 128);
391-
DPRINTLN(DBG_INFO, "json: " + String(out));*/
394+
DPRINTLN(DBG_INFO, "json: " + String(out));
392395
(mSubscriptionCb)(root);
393396

394397
mRxCnt++;

src/publisher/pubMqttIvData.h

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class PubMqttIvData {
231231
publish = true;
232232

233233
if (publish) {
234+
doc[F("ts")] = rec->ts;
234235
// if next channel or end->publish
235236
serializeJson(doc, mVal.data(), mVal.size());
236237
snprintf(mSubTopic.data(), mSubTopic.size(), "%s/ch%d", mIv->config->name, rec->assign[mPos].ch);

src/web/RestApi.h

+2
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,8 @@ class RestApi {
10721072
} else if(F("dev") == jsonIn[F("cmd")]) {
10731073
DPRINTLN(DBG_INFO, F("dev cmd"));
10741074
iv->setDevCommand(jsonIn[F("val")].as<int>());
1075+
} else if(F("restart_ahoy") == jsonIn[F("cmd")]) {
1076+
mApp->setRebootFlag();
10751077
} else {
10761078
jsonOut[F("error")] = F("ERR_UNKNOWN_CMD");
10771079
return false;

0 commit comments

Comments
 (0)