Skip to content

Commit

Permalink
v2.0.1 First Final Release
Browse files Browse the repository at this point in the history
  • Loading branch information
mrWheel committed Apr 17, 2020
1 parent f0280eb commit 2393d67
Show file tree
Hide file tree
Showing 24 changed files with 172 additions and 36 deletions.
2 changes: 1 addition & 1 deletion DSMRloggerAPI.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : DSMRloggerAPI.h - definitions for DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion DSMRloggerAPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
***************************************************************************
** Program : DSMRloggerAPI (restAPI)
*/
#define _FW_VERSION "v1.2.4 (16-04-2020)"
#define _FW_VERSION "v2.0.1 (17-04-2020)"
/*
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion Debug.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : Debug.h, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
** Met dank aan Erik
Expand Down
4 changes: 2 additions & 2 deletions FSexplorer.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : FSexplorer, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Mostly stolen from https://www.arduinoforum.de/User-Fips
** For more information visit: https://fipsok.de
Expand Down Expand Up @@ -240,7 +240,7 @@ void updateFirmware()
DebugTln(F("Redirect to updateIndex .."));
doRedirect("wait ... ", 1, "/updateIndex", false);
#else
doRedirect("UpdateServer not implemented", 10, "/", false);
doRedirect("UpdateServer not available", 10, "/", false);
#endif

} // updateFirmware()
Expand Down
2 changes: 1 addition & 1 deletion MQTTstuff.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : MQTTstuff, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion MinderGas.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
**************************************************************************
** Program : MinderGas.ino
** Version : v1.2.2
** Version : v2.0.1
**
** Copyright (c) 2020 Robert van den Breemen
**
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ Documentation can be found [here](https://mrwheel-docs.gitbook.io/dsmrloggerapi/
<table>
<tr><th>Versie</th><th>Opmerking</th></tr>
<tr>
<td valign="top">1.2.4</td>
<td>Bug Fixes
<td valign="top">2.0.1</td>
<td>First Final Release
<br>Implementing DSMRloggerWS actual api (for bacwards compatibility)
<br>More robust way to write hourly data to the RING-files
<br>Bugfix PRE40 gasmeter reading
<br>Remove validity check on meterstanden editor
<br>Better FieldName transaltion
<br>Bugfix mindergas processing
</td>
</tr>
<td valign="top">1.2.1</td>
Expand Down
2 changes: 1 addition & 1 deletion SPIFFSstuff.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : SPIFFSstuff, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion convertPRD2RING.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : convertPRD2RING, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
5 changes: 3 additions & 2 deletions data/DSMRindex.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : DSMRindex.js, part of DSMRfirmwareAPI
** Version : v1.2.2
** Version : v1.3.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down Expand Up @@ -94,8 +94,8 @@
timeTimer = setInterval(refreshDevTime, 10 * 1000); // repeat every 10s

openPage("mainPage");
openTab("ActualTab");
initActualGraph();
openTab("ActualTab");
setPresentationType('TAB');
readGitHubVersion();

Expand Down Expand Up @@ -1106,6 +1106,7 @@ http://DSMR-API.local/api/v1/dev/settings</pre>", false);

addAPIdoc("v1/sm/info", "Smart Meter info in JSON format", true);
addAPIdoc("v1/sm/actual", "Smart Meter Actual data in JSON format", true);
addAPIdoc("v0/sm/actual", "Smart Meter Actual data in JSON format (backwards compatibility)", true);
addAPIdoc("v1/sm/fields", "Smart Meter all fields data in JSON format\
<br>JSON format: {\"fields\":[{\"name\":\"&lt;fieldName&gt;\",\"value\":&lt;value&gt;,\"unit\":\"&lt;unit&gt;\"}]} ", true);
addAPIdoc("v1/sm/fields/{fieldName}", "Smart Meter one field data in JSON format", false);
Expand Down
2 changes: 1 addition & 1 deletion data/DSMRversion.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.2.1 - Third Official Release
v2.0.1 - First Final Release
2 changes: 1 addition & 1 deletion edge/DSMRgraphics.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : DSMRgraphics.js, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v0.3.5
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion edge/DSMRindex.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : DSMRindex.css, part of DSMRfirmwareAPI
** Version : v1.1.0
** Version : v1.2.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion handleSlimmeMeter.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : handleSlimmeMeter - part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion helperStuff.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : helperStuff, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
57 changes: 56 additions & 1 deletion jsonStuff.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : jsonStuff, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down Expand Up @@ -218,6 +218,61 @@ void sendNestedJsonObj(const char *cName, float fValue)
} // sendNestedJsonObj(*char, float)


//=======================================================================
//----- v0 api ----------------------------------------------------------
//=======================================================================
void sendNestedJsonV0Obj(const char *cName, uint32_t uValue)
{
char jsonBuff[200] = "";

snprintf(jsonBuff, sizeof(jsonBuff), "%s \"%s\": %u"
, objSprtr, cName, uValue);

httpServer.sendContent(jsonBuff);
sprintf(objSprtr, ",\r\n");

} // sendNestedJsonV0Obj(*char, uint)

//---------------------------------------------------------------
void sendNestedJsonV0Obj(const char *cName, float fValue)
{
char jsonBuff[200] = "";

snprintf(jsonBuff, sizeof(jsonBuff), "%s \"%s\": %.3f"
, objSprtr, cName, fValue);

httpServer.sendContent(jsonBuff);
sprintf(objSprtr, ",\r\n");

} // sendNestedJsonV0Obj(*char, float)

//---------------------------------------------------------------
void sendNestedJsonV0Obj(const char *cName, int32_t iValue)
{
char jsonBuff[200] = "";

snprintf(jsonBuff, sizeof(jsonBuff), "%s \"%s\": %u"
, objSprtr, cName, iValue);

httpServer.sendContent(jsonBuff);
sprintf(objSprtr, ",\r\n");

} // sendNestedV0Obj(*char, int)

//---------------------------------------------------------------
void sendNestedJsonV0Obj(const char *cName, String sValue)
{
char jsonBuff[200] = "";

snprintf(jsonBuff, sizeof(jsonBuff), "%s \"%s\": \"%s\""
, objSprtr, cName
, sValue.substring(0,(150 - (strlen(cName)))).c_str());

httpServer.sendContent(jsonBuff);
sprintf(objSprtr, ",\r\n");

} // sendNestedJsonV0Obj(*char, String)


//=======================================================================
// ************ function to build Json Settings string ******************
Expand Down
2 changes: 1 addition & 1 deletion menuStuff.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : menuStuff, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion networkStuff.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : networkStuff.h, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion ntpStuff.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : ntpStuff, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
2 changes: 1 addition & 1 deletion oledStuff.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : oledStuff.h, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand Down
39 changes: 30 additions & 9 deletions processTelegram.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
***************************************************************************
** Program : processTelegram, part of DSMRloggerAPI
** Version : v1.2.1
** Version : v2.0.1
**
** Copyright (c) 2020 Willem Aandewiel
**
Expand All @@ -28,33 +28,54 @@ void processTelegram()
}

strcpy(newTimestamp, DSMRdata.timestamp.c_str());

newT = epoch(newTimestamp, strlen(newTimestamp), false); // do NOT update system time
//--- newTimestamp is the timestamp from the last telegram
newT = epoch(newTimestamp, strlen(newTimestamp), true); // update system time
//--- actTimestamp is the timestamp from the previous telegram
actT = epoch(actTimestamp, strlen(actTimestamp), false);

// Skip first 3 telegrams .. just to settle down a bit ;-)

//--- Skip first 3 telegrams .. just to settle down a bit ;-)
if ((int32_t)(telegramCount - telegramErrors) < 3)
{
strCopy(actTimestamp, sizeof(actTimestamp), newTimestamp);
actT = epoch(actTimestamp, strlen(actTimestamp), true); // update system time
actT = epoch(actTimestamp, strlen(actTimestamp), false); // update system time
return;
}

DebugTf("actHour[%02d] -- newHour[%02d]\r\n", hour(actT), hour(newT));
//--- if we have a new hour() update the previous hour
if (hour(actT) != hour(newT)) {
writeToSysLog("actHour[%02d] -- newHour[%02d]", hour(actT), hour(newT));
}
// has the hour changed (or the day or month)
// in production testing on hour only would
// suffice, but in testing I need all three
//--- has the hour changed (or the day or month)
//--- in production testing on hour only would
//--- suffice, but in testing I need all three
//--- if we have a new hour() update the previous hour(actT)
if ( (hour(actT) != hour(newT) )
|| (day(actT) != day(newT) )
|| (month(actT) != month(newT) ) )
{
writeToSysLog("Update RING-files");
writeDataToFiles();
writeLastStatus();
//--- now see if the day() has changed also
if ( day(actT) != day(newT) )
{
//--- YES! actTimestamp := newTimestamp
//--- and update the files with the actTimestamp
strCopy(actTimestamp, sizeof(actTimestamp), newTimestamp);
writeDataToFiles();
}
else //--- NO, only the hour has changed
{
char record[DATA_RECLEN + 1] = "";
//--- actTimestamp := newTimestamp
strCopy(actTimestamp, sizeof(actTimestamp), newTimestamp);
buildDataRecordFromSM(record);
uint16_t recSlot = timestampToHourSlot(actTimestamp, strlen(actTimestamp));
//--- and update the files with the actTimestamp
writeDataToFile(HOURS_FILE, record, recSlot, HOURS);
DebugTf(">%s\r\n", record); // record ends in a \n
}
}

if ( DUE(publishMQTTtimer) )
Expand Down
Loading

0 comments on commit 2393d67

Please sign in to comment.