mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-13 23:45:25 +00:00
More timezone adjustments after testing
This commit is contained in:
parent
6e8233e4af
commit
a5f872a86c
@ -96,7 +96,7 @@ RemoteDebug Debug;
|
||||
|
||||
EntsoeApi* eapi = NULL;
|
||||
|
||||
Timezone* tz;
|
||||
Timezone* tz = NULL;
|
||||
|
||||
AmsWebServer ws(commonBuffer, &Debug, &hw);
|
||||
|
||||
@ -1093,7 +1093,7 @@ bool readHanPort() {
|
||||
data = new IEC6205675(payload, meterState.getMeterType(), &meterConfig, ctx);
|
||||
}
|
||||
} else if(ctx.type == DATA_TAG_DSMR) {
|
||||
data = new IEC6205621(payload);
|
||||
data = new IEC6205621(payload, tz);
|
||||
}
|
||||
len = 0;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "IEC6205621.h"
|
||||
|
||||
IEC6205621::IEC6205621(const char* p) {
|
||||
IEC6205621::IEC6205621(const char* p, Timezone* tz) {
|
||||
if(strlen(p) < 16)
|
||||
return;
|
||||
|
||||
@ -58,7 +58,8 @@ IEC6205621::IEC6205621(const char* p) {
|
||||
tm.Hour = timestamp.substring(6,8).toInt();
|
||||
tm.Minute = timestamp.substring(8,10).toInt();
|
||||
tm.Second = timestamp.substring(10,12).toInt();
|
||||
meterTimestamp = makeTime(tm); // TODO: Adjust for time zone
|
||||
meterTimestamp = makeTime(tm);
|
||||
if(tz != NULL) meterTimestamp = tz->toUTC(meterTimestamp);
|
||||
}
|
||||
|
||||
activeImportPower = (uint16_t) (extractDouble(payload, F("1.7.0")));
|
||||
|
||||
@ -3,10 +3,11 @@
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "AmsData.h"
|
||||
#include "Timezone.h"
|
||||
|
||||
class IEC6205621 : public AmsData {
|
||||
public:
|
||||
IEC6205621(const char* payload);
|
||||
IEC6205621(const char* payload, Timezone* tz);
|
||||
|
||||
private:
|
||||
String extract(String payload, String obis);
|
||||
|
||||
@ -169,9 +169,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
|
||||
}
|
||||
|
||||
if(this->packageTimestamp > 0) {
|
||||
if(meterType == AmsTypeAidon) {
|
||||
this->packageTimestamp = tz.toUTC(this->packageTimestamp);
|
||||
} else if(meterType == AmsTypeKamstrup) {
|
||||
if(meterType == AmsTypeAidon || meterType == AmsTypeKamstrup) {
|
||||
this->packageTimestamp = this->packageTimestamp - 3600;
|
||||
}
|
||||
}
|
||||
@ -274,9 +272,7 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
|
||||
if(meterTs != NULL) {
|
||||
AmsOctetTimestamp* amst = (AmsOctetTimestamp*) meterTs;
|
||||
time_t ts = decodeCosemDateTime(amst->dt);
|
||||
if(meterType == AmsTypeAidon) {
|
||||
meterTimestamp = tz.toUTC(ts);
|
||||
} else if(meterType == AmsTypeKamstrup) {
|
||||
if(meterType == AmsTypeAidon || meterType == AmsTypeKamstrup) {
|
||||
meterTimestamp = ts - 3600;
|
||||
} else {
|
||||
meterTimestamp = ts;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user