kopia lustrzana https://github.com/weetmuts/wmbusmeters
Refactor driver emerlin868.
rodzic
173124c50e
commit
c0ca6793d3
|
@ -219,8 +219,8 @@ telegram=|2E449215303099990D077AB50820452F2F_0C12495849004C12557545000FB10445007
|
|||
|
||||
# Test Elster Merlin 868 radio attachement
|
||||
telegram=|2E4492159293949511377ABE0020252F2F_04135515000004FD971D80800000441300000000426C000002FDFD02B300|
|
||||
{"media":"radio converter (meter side)","meter":"emerlin868","name":"Vodda","id":"95949392","total_m3":5.461,"target_m3":0,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
|Vodda;95949392;5.461000;0.000000;1111-11-11 11:11.11
|
||||
{"media":"radio converter (meter side)","meter":"emerlin868","name":"Vodda","id":"95949392","total_m3":5.461,"target_m3":0,"target_date":"2000-00-00","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|Vodda;95949392;5.461;0;1111-11-11 11:11.11
|
||||
|
||||
# Test Techem TSD2 smoke detector
|
||||
telegram=|294468506935639176F0A0_009F2782290060822900000401D6311AF93E1BF93E008DC3009ED4000FE500|
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
Copyright (C) 2017-2022 Fredrik Öhrström (gpl-3.0-or-later)
|
||||
|
||||
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"meters_common_implementation.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct Driver : public virtual MeterCommonImplementation
|
||||
{
|
||||
Driver(MeterInfo &mi, DriverInfo &di);
|
||||
};
|
||||
|
||||
static bool ok = registerDriver([](DriverInfo&di)
|
||||
{
|
||||
di.setName("ev200");
|
||||
di.setDefaultFields("name,id,total_m3,target_m3,timestamp");
|
||||
di.setMeterType(MeterType::WaterMeter);
|
||||
di.addLinkMode(LinkMode::T1);
|
||||
di.addDetection(MANUFACTURER_ELR, 0x07, 0x0d);
|
||||
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new Driver(mi, di)); });
|
||||
});
|
||||
|
||||
Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||
{
|
||||
addNumericFieldWithExtractor(
|
||||
"total",
|
||||
"The total water consumption recorded by this meter.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||
Quantity::Volume,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Volume)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"target",
|
||||
"The target water consumption recorded at previous period.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||
Quantity::Volume,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Volume)
|
||||
.set(StorageNr(1)));
|
||||
}
|
||||
}
|
||||
|
||||
// Test: Voda ev200 99993030 NOKEY
|
||||
// telegram=|2E449215303099990D077AB50820452F2F_0C12495849004C12557545000FB10445007022C50BFFFFFFFF0000FFF000|
|
||||
// {"media":"water","meter":"ev200","name":"Voda","id":"99993030","total_m3":49.5849,"target_m3":45.7555,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Voda;99993030;49.5849;45.7555;1111-11-11 11:11.11
|
|
@ -42,7 +42,6 @@
|
|||
X(EHZP, MANUFACTURER_EMH, 0x02, 0x02) \
|
||||
X(ESYSWM, MANUFACTURER_ESY, 0x37, 0x30) \
|
||||
X(EM24, MANUFACTURER_KAM, 0x02, 0x33) \
|
||||
X(EMERLIN868,MANUFACTURER_ELR, 0x37, 0x11) \
|
||||
X(EVO868, MANUFACTURER_MAD, 0x07, 0x50) \
|
||||
X(FHKVDATAIII,MANUFACTURER_TCH, 0x80, 0x69) \
|
||||
X(FHKVDATAIII,MANUFACTURER_TCH, 0x80, 0x94) \
|
||||
|
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2017-2020 Fredrik Öhrström (gpl-3.0-or-later)
|
||||
Copyright (C) 2018 David Mallon (gpl-3.0-or-later)
|
||||
|
||||
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"
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct MeterEMerlin868 : public virtual MeterCommonImplementation {
|
||||
MeterEMerlin868(MeterInfo &mi);
|
||||
|
||||
// Total water counted through the meter
|
||||
double totalWaterConsumption(Unit u);
|
||||
bool hasTotalWaterConsumption();
|
||||
double targetWaterConsumption(Unit u);
|
||||
bool hasTargetWaterConsumption();
|
||||
|
||||
private:
|
||||
void processContent(Telegram *t);
|
||||
|
||||
double actual_total_water_consumption_m3_ {};
|
||||
double last_total_water_consumption_m3h_ {};
|
||||
};
|
||||
|
||||
MeterEMerlin868::MeterEMerlin868(MeterInfo &mi) :
|
||||
MeterCommonImplementation(mi, "emerlin868")
|
||||
{
|
||||
setMeterType(MeterType::WaterMeter);
|
||||
|
||||
setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV);
|
||||
|
||||
addLinkMode(LinkMode::T1);
|
||||
|
||||
// version 0x68
|
||||
// version 0x7c Sensus 640
|
||||
|
||||
addPrint("total", Quantity::Volume,
|
||||
[&](Unit u){ return totalWaterConsumption(u); },
|
||||
"The total water consumption recorded by this meter.",
|
||||
PrintProperty::FIELD | PrintProperty::JSON);
|
||||
|
||||
addPrint("target", Quantity::Volume,
|
||||
[&](Unit u){ return targetWaterConsumption(u); },
|
||||
"The target water consumption recorded at previous period.",
|
||||
PrintProperty::FIELD | PrintProperty::JSON);
|
||||
}
|
||||
|
||||
shared_ptr<Meter> createEMerlin868(MeterInfo &mi)
|
||||
{
|
||||
return shared_ptr<Meter>(new MeterEMerlin868(mi));
|
||||
}
|
||||
|
||||
void MeterEMerlin868::processContent(Telegram *t)
|
||||
{
|
||||
int offset;
|
||||
string key;
|
||||
|
||||
if(findKey(MeasurementType::Instantaneous, VIFRange::Volume, 0, 0, &key, &t->dv_entries)) {
|
||||
extractDVdouble(&t->dv_entries, key, &offset, &actual_total_water_consumption_m3_);
|
||||
t->addMoreExplanation(offset, " actual total consumption (%f m3)", actual_total_water_consumption_m3_);
|
||||
}
|
||||
|
||||
if(findKey(MeasurementType::Instantaneous, VIFRange::Volume, 1, 0, &key, &t->dv_entries)) {
|
||||
extractDVdouble(&t->dv_entries, key, &offset, &last_total_water_consumption_m3h_);
|
||||
t->addMoreExplanation(offset, " last total consumption (%f m3)", last_total_water_consumption_m3h_);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
double MeterEMerlin868::totalWaterConsumption(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Volume);
|
||||
return convert(actual_total_water_consumption_m3_, Unit::M3, u);
|
||||
}
|
||||
|
||||
bool MeterEMerlin868::hasTotalWaterConsumption()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
double MeterEMerlin868::targetWaterConsumption(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Volume);
|
||||
return convert(last_total_water_consumption_m3h_, Unit::M3, u);
|
||||
}
|
||||
|
||||
bool MeterEMerlin868::hasTargetWaterConsumption()
|
||||
{
|
||||
return true;
|
||||
}
|
|
@ -69,7 +69,6 @@ LIST_OF_METER_TYPES
|
|||
X(ehzp, T1_bit, ElectricityMeter, EHZP, EHZP) \
|
||||
X(esyswm, T1_bit, ElectricityMeter, ESYSWM, ESYSWM) \
|
||||
X(em24, C1_bit, ElectricityMeter, EM24, EM24) \
|
||||
X(emerlin868, T1_bit, WaterMeter, EMERLIN868, EMerlin868) \
|
||||
X(evo868, T1_bit, WaterMeter, EVO868, EVO868) \
|
||||
X(fhkvdataiii,T1_bit, HeatCostAllocationMeter, FHKVDATAIII, FHKVDataIII) \
|
||||
X(fhkvdataiv, T1_bit, HeatCostAllocationMeter, FHKVDATAIV, FHKVDataIV) \
|
||||
|
|
Ładowanie…
Reference in New Issue