Fixed timestamp from meter

This commit is contained in:
Gunnar Skjold 2023-04-24 15:46:56 +02:00
parent d85d68b4a6
commit 6e8233e4af

View File

@ -168,8 +168,12 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
}
}
if(meterType == AmsTypeKamstrup || meterType == AmsTypeAidon) {
this->packageTimestamp = this->packageTimestamp > 0 ? tz.toUTC(this->packageTimestamp) : 0;
if(this->packageTimestamp > 0) {
if(meterType == AmsTypeAidon) {
this->packageTimestamp = tz.toUTC(this->packageTimestamp);
} else if(meterType == AmsTypeKamstrup) {
this->packageTimestamp = this->packageTimestamp - 3600;
}
}
uint8_t str_len = 0;
@ -271,9 +275,9 @@ IEC6205675::IEC6205675(const char* d, uint8_t useMeterType, MeterConfig* meterCo
AmsOctetTimestamp* amst = (AmsOctetTimestamp*) meterTs;
time_t ts = decodeCosemDateTime(amst->dt);
if(meterType == AmsTypeAidon) {
meterTimestamp = ts - 3600;
} else if(meterType == AmsTypeKamstrup) {
meterTimestamp = tz.toUTC(ts);
} else if(meterType == AmsTypeKamstrup) {
meterTimestamp = ts - 3600;
} else {
meterTimestamp = ts;
}