kopia lustrzana https://github.com/weetmuts/wmbusmeters
Add driver lse_08 for HCA meters from Qundis Siemens.
rodzic
766814982c
commit
61cd47db49
4
Makefile
4
Makefile
|
@ -187,11 +187,13 @@ METER_OBJS:=\
|
|||
$(BUILD)/meter_ultrimis.o \
|
||||
$(BUILD)/meter_vario451.o \
|
||||
$(BUILD)/meter_waterstarm.o \
|
||||
$(BUILD)/meter_weh_07.o \
|
||||
$(BUILD)/meter_whe46x.o \
|
||||
$(BUILD)/meter_whe5x.o \
|
||||
$(BUILD)/meter_sensostar.o \
|
||||
$(BUILD)/meter_gransystems_ccx01.o \
|
||||
$(BUILD)/meter_lse_08.o \
|
||||
$(BUILD)/meter_weh_07.o \
|
||||
|
||||
|
||||
all: $(BUILD)/wmbusmeters $(BUILD)/wmbusmeters-admin $(BUILD)/testinternals
|
||||
@$(STRIP_BINARY)
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
|
||||
# Test a HCA WHE465 Qundis
|
||||
|
||||
telegram=|244465323251839134087a4f0000000b6e0403004b6e660300426c9e29326cffff046d1416b921dd2f|
|
||||
{"media":"heat cost allocation","meter":"whe5x","name":"HCA","id":"91835132","current_consumption_hca":304,"set_date":"2020-09-30","consumption_at_set_date_hca":366,"set_date_1":"2020-09-30","consumption_at_set_date_1_hca":366,"error_date":"2127-15-31","device_date_time":"2021-01-25 22:20","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|HCA;91835132;304.000000;2020-09-30;366.000000;1111-11-11 11:11.11
|
||||
|
||||
# Test another HCA from Qundis
|
||||
|
||||
telegram=|294465324185990401087a0080000082046c7f018b046e210300046d1a0e6f0202fdac7e012301fd0c01|
|
||||
{"media":"heat cost allocation","meter":"lse_08","name":"HCA2","id":"04998541","set_date":"2003-01-31","consumption_at_set_date_hca":321,"device_date_time":"2003-02-15 14:26","duration_since_readout_h":2.489167,"software_version":"1","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|HCA2;04998541;2003-01-31;321.000000;1111-11-11 11:11.11
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
Copyright (C) 2019-2021 Fredrik Öhrström
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include"dvparser.h"
|
||||
#include"meters.h"
|
||||
#include"meters_common_implementation.h"
|
||||
#include"wmbus.h"
|
||||
#include"wmbus_utils.h"
|
||||
|
||||
struct MeterLSE_08 : public virtual HeatCostAllocationMeter, public virtual MeterCommonImplementation {
|
||||
MeterLSE_08(MeterInfo &mi);
|
||||
|
||||
string setDate();
|
||||
double consumptionAtSetDate(Unit u);
|
||||
|
||||
private:
|
||||
|
||||
void processContent(Telegram *t);
|
||||
|
||||
double consumption_at_set_date_hca_ {};
|
||||
string set_date_;
|
||||
string device_date_time_;
|
||||
int duration_since_readout_s_ {};
|
||||
string software_version_;
|
||||
};
|
||||
|
||||
MeterLSE_08::MeterLSE_08(MeterInfo &mi) :
|
||||
MeterCommonImplementation(mi, MeterType::LSE_08)
|
||||
{
|
||||
setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV);
|
||||
|
||||
addLinkMode(LinkMode::C1);
|
||||
addLinkMode(LinkMode::S1);
|
||||
|
||||
addPrint("set_date", Quantity::Text,
|
||||
[&](){ return setDate(); },
|
||||
"The most recent billing period date.",
|
||||
true, true);
|
||||
|
||||
addPrint("consumption_at_set_date", Quantity::HCA,
|
||||
[&](Unit u){ return consumptionAtSetDate(u); },
|
||||
"Heat cost allocation at the most recent billing period date.",
|
||||
true, true);
|
||||
|
||||
addPrint("device_date_time", Quantity::Text,
|
||||
[&](){ return device_date_time_; },
|
||||
"Device date time.",
|
||||
false, true);
|
||||
|
||||
addPrint("duration_since_readout", Quantity::Time,
|
||||
[&](Unit u) {
|
||||
assertQuantity(u, Quantity::Time);
|
||||
return convert(duration_since_readout_s_, Unit::Second, u);
|
||||
},
|
||||
"Device date time.",
|
||||
false, true);
|
||||
|
||||
addPrint("software_version", Quantity::Text,
|
||||
[&](){ return software_version_; },
|
||||
"Software version.",
|
||||
false, true);
|
||||
}
|
||||
|
||||
shared_ptr<HeatCostAllocationMeter> createLSE_08(MeterInfo &mi)
|
||||
{
|
||||
return shared_ptr<HeatCostAllocationMeter>(new MeterLSE_08(mi));
|
||||
}
|
||||
|
||||
string MeterLSE_08::setDate()
|
||||
{
|
||||
return set_date_;
|
||||
}
|
||||
|
||||
double MeterLSE_08::consumptionAtSetDate(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::HCA);
|
||||
return convert(consumption_at_set_date_hca_, Unit::HCA, u);
|
||||
}
|
||||
|
||||
void MeterLSE_08::processContent(Telegram *t)
|
||||
{
|
||||
int offset;
|
||||
string key;
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::HeatCostAllocation, 8, 0, &key, &t->values)) {
|
||||
extractDVdouble(&t->values, key, &offset, &consumption_at_set_date_hca_);
|
||||
t->addMoreExplanation(offset, " consumption at set date (%f hca)", consumption_at_set_date_hca_);
|
||||
}
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::Date, 8, 0, &key, &t->values)) {
|
||||
struct tm date;
|
||||
extractDVdate(&t->values, key, &offset, &date);
|
||||
set_date_ = strdate(&date);
|
||||
t->addMoreExplanation(offset, " set date (%s)", set_date_.c_str());
|
||||
}
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::DateTime, 0, 0, &key, &t->values)) {
|
||||
struct tm datetime;
|
||||
extractDVdate(&t->values, key, &offset, &datetime);
|
||||
device_date_time_ = strdatetime(&datetime);
|
||||
t->addMoreExplanation(offset, " device datetime (%s)", device_date_time_.c_str());
|
||||
}
|
||||
|
||||
uint64_t seconds;
|
||||
if (extractDVlong(&t->values, "02FDAC7E", &offset, &seconds))
|
||||
{
|
||||
duration_since_readout_s_ = (int)seconds;
|
||||
t->addMoreExplanation(offset, " duration (%d s)", duration_since_readout_s_);
|
||||
}
|
||||
|
||||
uint64_t serial;
|
||||
if (extractDVlong(&t->values, "01FD0C", &offset, &serial))
|
||||
{
|
||||
// 01 --> 01
|
||||
software_version_ = to_string(serial);
|
||||
t->addMoreExplanation(offset, " software version (%s)", software_version_.c_str());
|
||||
}
|
||||
|
||||
}
|
|
@ -82,6 +82,7 @@
|
|||
X(waterstarm, C1_bit|T1_bit, WaterMeter,WATERSTARM, WaterstarM) \
|
||||
X(whe46x, S1_bit, HeatCostAllocationMeter, WHE46X, Whe46x) \
|
||||
X(whe5x, S1_bit, HeatCostAllocationMeter, WHE5X, Whe5x) \
|
||||
X(lse_08, S1_bit|C1_bit, HeatCostAllocationMeter, LSE_08, LSE_08) \
|
||||
X(weh_07, C1_bit, WaterMeter, WEH_07, WEH_07) \
|
||||
|
||||
|
||||
|
@ -170,11 +171,12 @@
|
|||
X(WATERSTARM, MANUFACTURER_DWZ, 0x06, 0x02) \
|
||||
X(WATERSTARM, MANUFACTURER_DWZ, 0x07, 0x02) \
|
||||
X(WATERSTARM, MANUFACTURER_EFE, 0x07, 0x03) \
|
||||
X(WEH_07, MANUFACTURER_WEH, 0x07, 0xfe) \
|
||||
X(WHE46X, MANUFACTURER_LSE, 0x08, 0x18) \
|
||||
X(WHE5X, MANUFACTURER_LSE, 0x08, 0x34) \
|
||||
X(SENSOSTAR, MANUFACTURER_EFE, 0x04, 0x00) \
|
||||
X(CCx01, MANUFACTURER_GSS, 0x02, 0x01)
|
||||
X(CCx01, MANUFACTURER_GSS, 0x02, 0x01) \
|
||||
X(LSE_08, MANUFACTURER_LSE, 0x08, 0x01) \
|
||||
X(WEH_07, MANUFACTURER_WEH, 0x07, 0xfe) \
|
||||
|
||||
enum class MeterType {
|
||||
#define X(mname,linkmode,info,type,cname) type,
|
||||
|
|
|
@ -8,7 +8,8 @@ TEST=testoutput
|
|||
TESTNAME="Test S1 meters"
|
||||
TESTRESULT="ERROR"
|
||||
|
||||
METERS="HCA whe5x 91835132 NOKEY"
|
||||
METERS="HCA whe5x 91835132 NOKEY \
|
||||
HCA2 lse_08 04998541 NOKEY"
|
||||
|
||||
cat simulations/simulation_s1.txt | grep '^{' > $TEST/test_expected.txt
|
||||
$PROG --format=json simulations/simulation_s1.txt $METERS > $TEST/test_output.txt 2> $TEST/test_stderr.txt
|
||||
|
|
Ładowanie…
Reference in New Issue