Skip to content

Commit 1c30ce8

Browse files
committed
v3.0.4 Minor changes
1 parent 5f5cdf3 commit 1c30ce8

File tree

11 files changed

+92
-24
lines changed

11 files changed

+92
-24
lines changed

DSMRloggerAPI.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ uint8_t settingMbus2Type = 0;
252252
uint8_t settingMbus3Type = 0;
253253
uint8_t settingMbus4Type = 0;
254254
uint8_t settingPreDSMR40 = 0;
255+
uint8_t settingDailyReboot = 0;
255256
char settingHostname[30];
256257
char settingIndexPage[50];
257258
char settingMQTTbroker[101], settingMQTTuser[40], settingMQTTpasswd[40], settingMQTTtopTopic[21];

DSMRloggerAPI.ino

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
***************************************************************************
33
** Program : DSMRloggerAPI (restAPI)
44
*/
5-
#define _FW_VERSION "v3.0.3 (04-09-2022)"
5+
#define _FW_VERSION "v3.0.4 (13-10-2022)"
66
/*
7-
** Copyright (c) 2020, 2021, 2022 Willem Aandewiel
7+
** Copyright (c) 2020, 2021, 2022, 2023 Willem Aandewiel
88
**
99
** TERMS OF USE: MIT License. See bottom of file.
1010
***************************************************************************
@@ -188,6 +188,8 @@ void setup()
188188
}
189189
}
190190
digitalWrite(LED_BUILTIN, LED_OFF); // HIGH is OFF
191+
//-- Press [Reset] -> "External System"
192+
//-- Software reset -> "Software/System restart"
191193
lastReset = ESP.getResetReason();
192194

193195
startTelnet();
@@ -251,6 +253,11 @@ void setup()
251253
readSettings(true);
252254
oled_Init();
253255

256+
if (settingDailyReboot)
257+
{
258+
if (!lastReset.equals("Software/System restart")) telegramCount = 0;
259+
}
260+
254261
//=============start Networkstuff==================================
255262
if (settingOledType > 0)
256263
{
@@ -679,6 +686,22 @@ void loop ()
679686
setSyncInterval(3600);
680687
check4DST(ntpTime);
681688
}
689+
690+
#ifndef HAS_NO_SLIMMEMETER
691+
//-- hier moet nog even over worden nagedacht
692+
//-- via een setting in- of uit-schakelen
693+
if (settingDailyReboot && (hour() == 4) && (minute() == 5))
694+
{
695+
slotErrors = 0;
696+
nrReboots = 0;
697+
writeLastStatus();
698+
//-- skip to next minute (6)
699+
delay(60000);
700+
ESP.restart();
701+
delay(3000);
702+
}
703+
#endif
704+
682705
yield();
683706

684707
} // loop()

FSYSstuff.ino

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ int16_t bytesWritten;
1616
//====================================================================
1717
void readLastStatus()
1818
{
19-
char buffer[50] = "";
20-
char dummy[50] = "";
19+
char buffer[100] = "";
20+
char dummy[50] = "";
2121
char spiffsTimestamp[20] = "";
2222

2323
File _file = FSYS.open("/DSMRstatus.csv", "r");
@@ -30,12 +30,17 @@ void readLastStatus()
3030
int l = _file.readBytesUntil('\n', buffer, sizeof(buffer));
3131
buffer[l] = 0;
3232
DebugTf("read lastUpdate[%s]\r\n", buffer);
33-
sscanf(buffer, "%[^;]; %u; %u; %[^;]", spiffsTimestamp, &nrReboots, &slotErrors, dummy);
34-
DebugTf("values timestamp[%s], nrReboots[%u], slotErrors[%u], dummy[%s]\r\n"
35-
, spiffsTimestamp
36-
, nrReboots
37-
, slotErrors
38-
, dummy);
33+
sscanf(buffer, "%[^;]; %u; %u; %u; %[^;]", spiffsTimestamp
34+
, &nrReboots
35+
, &slotErrors
36+
, &telegramCount
37+
, dummy);
38+
DebugTf("values timestamp[%s], nrReboots[%u], slotErrors[%u], telegramCount[%u], dummy[%s]\r\n"
39+
, spiffsTimestamp
40+
, nrReboots
41+
, slotErrors
42+
, telegramCount
43+
, dummy);
3944
yield();
4045
}
4146
_file.close();
@@ -57,18 +62,26 @@ void writeLastStatus()
5762
writeToSysLog("Bailout low heap (%d bytes)", ESP.getFreeHeap());
5863
return;
5964
}
60-
char buffer[50] = "";
61-
DebugTf("writeLastStatus() => %s; %u; %u;\r\n", actTimestamp, nrReboots, slotErrors);
62-
writeToSysLog("writeLastStatus() => %s; %u; %u;", actTimestamp, nrReboots, slotErrors);
65+
char buffer[100] = "";
66+
DebugTf("writeLastStatus() => %s; %u; %u; %u;\r\n", actTimestamp
67+
, nrReboots
68+
, slotErrors
69+
, telegramCount);
70+
writeToSysLog("writeLastStatus() => %s; %u; %u; %u;", actTimestamp
71+
, nrReboots
72+
, slotErrors
73+
, telegramCount);
6374
File _file = FSYS.open("/DSMRstatus.csv", "w");
6475
if (!_file)
6576
{
6677
DebugTln("write(): No /DSMRstatus.csv found ..");
6778
}
68-
snprintf(buffer, sizeof(buffer), "%-13.13s; %010u; %010u; %s;\n", actTimestamp
69-
, nrReboots
70-
, slotErrors
71-
, "meta data");
79+
snprintf(buffer, sizeof(buffer), "%-13.13s; %010u; %010u; %010u; %s;\n"
80+
, actTimestamp
81+
, nrReboots
82+
, slotErrors
83+
, telegramCount
84+
, "meta data");
7285
_file.print(buffer);
7386
_file.flush();
7487
_file.close();

MinderGas.ino

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,10 @@ void writePostToFile()
410410
, gasDelivered);
411411
// , DSMRdata.mbus1_delivered.val());
412412
//--- write the POST to a file...
413-
minderGasFile.println(F("POST /api/gas_meter_readings HTTP/1.1"));
413+
//-- api aanroep is veranderd per 1 jan. 2021 (??)
414+
//-- was: minderGasFile.println(F("POST /api/gas_meter_readings HTTP/1.1"));
415+
//-- hieronder de nieuwe URL
416+
minderGasFile.println(F("POST /api/meter_readings HTTP/1.1"));
414417
minderGasFile.print(F("AUTH-TOKEN:"));
415418
minderGasFile.println(settingMindergasToken);
416419
minderGasFile.println(F("Host: mindergas.nl"));

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@ Documentation can be found [here](https://mrwheel-docs.gitbook.io/dsmrloggerapi/
99

1010
<table>
1111
<tr><th>Versie</th><th align="Left">Opmerking</th></tr>
12+
<tr>
13+
<td valign="top">3.0.4</td>
14+
<td>"One Fits All" Release
15+
<br>Nieuwe optie op DSMR-logger dagelijks te rebooten
16+
<br>URL mindergas API aangepast
17+
</td>
18+
</tr>
1219
<tr>
1320
<td valign="top">3.0.3</td>
1421
<td>"One Fits All" Release
1522
<br>Zet Wifi mode op "WIFI_STA" in startWiFi()
1623
</td>
24+
</tr>
1725
<tr>
1826
<td valign="top">3.0.2</td>
1927
<td>"One Fits All" Release

data/DSMRindex.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<!--
22
***************************************************************************
33
** Program : DSMRindex.html, part of DSMRloggerAPI
4-
** Version : v3.0.1
4+
** Version : v3.0.4
55
**
6-
** Copyright (c) 2021 Willem Aandewiel
6+
** Copyright (c) 2021, 2022, 2023 Willem Aandewiel
77
**
88
** TERMS OF USE: MIT License. See bottom of file.
99
***************************************************************************
@@ -23,7 +23,7 @@
2323
<!-- KEEP THIS --->
2424

2525
<!-- Pin to bottom right corner -->
26-
<div class="bottom right-0">2021 &copy; Willem Aandewiel</div>
26+
<div class="bottom right-0">2021, 2022, 2023 &copy; Willem Aandewiel</div>
2727

2828
<!-- Pin to bottom left corner -->
2929
<div id="message" class="bottom left-0">-</div>

data/DSMRindex.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
22
***************************************************************************
33
** Program : DSMRindex.js, part of DSMRfirmwareAPI
4-
** Version : v3.0.1
4+
** Version : v3.0.4
55
**
6-
** Copyright (c) 2021 Willem Aandewiel
6+
** Copyright (c) 2021, 2022, 2023 Willem Aandewiel
77
**
88
** TERMS OF USE: MIT License. See bottom of file.
99
***************************************************************************
@@ -36,6 +36,7 @@
3636
var gas_netw_costs = 0;
3737
var hostName = "-";
3838
var pre_dsmr40 = 0;
39+
var dailyreboot = 0;
3940
var mbus_nr_gas = 1;
4041

4142
var data = [];
@@ -1024,6 +1025,10 @@
10241025
{
10251026
pre_dsmr40 = json.settings[i].value;
10261027
}
1028+
else if (json.settings[i].name == "dailyreboot")
1029+
{
1030+
dailyreboot = json.settings[i].value;
1031+
}
10271032
else if (json.settings[i].name == "hostname")
10281033
{
10291034
hostName = json.settings[i].value;
@@ -2037,6 +2042,7 @@ http://DSMR-API.local/api/v1/dev/settings</pre>", false);
20372042
,[ "smhasfaseinfo", "SM Has Fase Info (0=No, 1=Yes)" ]
20382043
,[ "sm_has_fase_info", "SM Has Fase Info (0=No, 1=Yes)" ]
20392044
,[ "pre_dsmr40", "Pré DSMR 40 (0=No, 1=Yes)" ]
2045+
,[ "dailyreboot", "Dagelijkse Reboot (0=No, 1=Yes)" ]
20402046
,[ "oled_type", "OLED type (0=None, 1=SDD1306, 2=SH1106)" ]
20412047
,[ "oled_flip_screen", "Flip OLED scherm (0=No, 1=Yes)" ]
20422048
,[ "tlgrm_interval", "Telegram Lees Interval (Sec.)" ]

data/DSMRversion.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.0.1 - First One Fits All Release
1+
v3.0.4 - Fits All Release (small changes)

menuStuff.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ void handleKeyInput()
238238
showRawCount = 0;
239239
break;
240240
case 'R':
241+
slotErrors = 0;
242+
nrReboots = 0;
243+
//telegramCount = 0;
244+
telegramErrors = 0;
245+
writeLastStatus();
241246
DebugT(F("Reboot in 3 seconds ... \r\n"));
242247
DebugFlush();
243248
delay(3000);

restAPI.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ void sendDeviceInfo()
419419
sendNestedJsonObj("wifirssi", WiFi.RSSI());
420420
sendNestedJsonObj("uptime", upTime());
421421
sendNestedJsonObj("uptime_secs", (int)upTimeSeconds, "sec");
422+
sendNestedJsonObj("dailyreboot", (int)settingDailyReboot);
422423
sendNestedJsonObj("oled_type", (int)settingOledType);
423424
sendNestedJsonObj("oled_flip_screen", (int)settingOledFlip);
424425
sendNestedJsonObj("smhasfaseinfo", (int)settingSmHasFaseInfo);
@@ -472,6 +473,7 @@ void sendDeviceSettings()
472473

473474
sendJsonSettingObj("hostname", settingHostname, "s", sizeof(settingHostname) -1);
474475
sendJsonSettingObj("pre_dsmr40", settingPreDSMR40, "i", 0, 1);
476+
sendJsonSettingObj("dailyreboot", settingDailyReboot, "i", 0, 1);
475477
sendJsonSettingObj("ed_tariff1", settingEDT1, "f", 0, 10, 5);
476478
sendJsonSettingObj("ed_tariff2", settingEDT2, "f", 0, 10, 5);
477479
sendJsonSettingObj("er_tariff1", settingERT1, "f", 0, 10, 5);

0 commit comments

Comments
 (0)