kopia lustrzana https://github.com/weetmuts/wmbusmeters
Refactor sensostar and engelmann-fw to new driver format.
rodzic
a87bc94a3a
commit
7667b0b858
2
CHANGES
2
CHANGES
|
@ -1,4 +1,6 @@
|
|||
|
||||
ATTENTION! Bug in historical data for sensostar driver. Only the most recent month was correct.
|
||||
|
||||
ATTENTION! The topaseskr driver has been refactored to the new driver format.
|
||||
The field "battery_life_days_remaining_remaining" has been changed to "battery_life_y".
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Test sensostar heat meter sent over mbus.
|
||||
|
||||
telegram=|6893936808007275404810C514000431270000#04786BF99F00046D040F632B0415E02000004415E0200000840115E02000000406A02100004406A0210000840106A021000084100600000000C410060000000084110600000000426C5F2C026C7F2C043B00000000143B08010000042B00000000142B39240000025B1800025F17000461380000000223810C01FD17000490280B0000005616|
|
||||
{"media":"heat","meter":"sensostar","name":"MySenso","id":"10484075","meter_timestamp":"2019-11-03 15:04","total_kwh":8608,"power_kw":0,"power_max_kw":9.273,"flow_water_m3h":0,"flow_water_max_m3h":0.264,"forward_c":24,"return_c":23,"difference_c":0.56,"total_water_m3":841.6,"current_status":"OK","reporting_date":"2018-12-31","energy_consumption_at_reporting_date_kwh":8608,"consumption_1_months_ago_kwh":8608,"consumption_2_months_ago_kwh":0,"consumption_3_months_ago_kwh":0,"consumption_4_months_ago_kwh":0,"consumption_5_months_ago_kwh":0,"consumption_6_months_ago_kwh":0,"consumption_7_months_ago_kwh":0,"consumption_8_months_ago_kwh":0,"consumption_9_months_ago_kwh":0,"consumption_10_months_ago_kwh":0,"consumption_11_months_ago_kwh":0,"consumption_12_months_ago_kwh":0,"consumption_13_months_ago_kwh":0,"consumption_14_months_ago_kwh":0,"consumption_15_months_ago_kwh":0,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
{"media":"heat","meter":"sensostar","name":"MySenso","id":"10484075","meter_timestamp":"2019-11-03 15:04","total_kwh":8608,"power_kw":0,"power_max_kw":9.273,"flow_water_m3h":0,"flow_water_max_m3h":0.264,"forward_c":24,"return_c":23,"difference_c":0.56,"total_water_m3":841.6,"current_status":"OK","reporting_date":"2018-12-31","energy_consumption_at_reporting_date_kwh":8608,"consumption_1_months_ago_kwh":8608,"consumption_2_months_ago_kwh":8608,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
|
||||
|
||||
# Test ultraheat heat meter sent over mbus.
|
||||
|
|
|
@ -209,7 +209,7 @@ telegram=|2E4401069897969501167A4B0320052F2F_0413320C000003FD1700000044132109000
|
|||
|
||||
# Test Sensostar 2 heat meter
|
||||
telegram=|9E44C5147956341200047A7B0090052F2F_046D25248A2B04063D1F000001FD17000415265F00004406131F0000840106901E0000C40106841E0000840206841E0000C402067A1E0000840306541E0000C40306021E00008404069E1D0000C40406D71C0000840506F21B0000C40506681A00008406061E190000C40606EB1700008407061C170000C40706EE1600002F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F|
|
||||
{"media":"heat","meter":"sensostar","name":"Heater","id":"12345679","meter_timestamp":"2020-11-10 04:37","total_kwh":7997,"total_water_m3":2435.8,"current_status":"OK","reporting_date":null,"energy_consumption_at_reporting_date_kwh":7955,"consumption_1_months_ago_kwh":7824,"consumption_2_months_ago_kwh":7812,"consumption_3_months_ago_kwh":7764,"consumption_4_months_ago_kwh":7582,"consumption_5_months_ago_kwh":7154,"consumption_6_months_ago_kwh":6430,"consumption_7_months_ago_kwh":5916,"consumption_8_months_ago_kwh":0,"consumption_9_months_ago_kwh":0,"consumption_10_months_ago_kwh":0,"consumption_11_months_ago_kwh":0,"consumption_12_months_ago_kwh":0,"consumption_13_months_ago_kwh":0,"consumption_14_months_ago_kwh":0,"consumption_15_months_ago_kwh":0,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
{"media":"heat","meter":"sensostar","name":"Heater","id":"12345679","meter_timestamp":"2020-11-10 04:37","total_kwh":7997,"total_water_m3":2435.8,"current_status":"OK","reporting_date":null,"energy_consumption_at_reporting_date_kwh":7955,"consumption_1_months_ago_kwh":7955,"consumption_2_months_ago_kwh":7824,"consumption_3_months_ago_kwh":7812,"consumption_4_months_ago_kwh":7812,"consumption_5_months_ago_kwh":7802,"consumption_6_months_ago_kwh":7764,"consumption_7_months_ago_kwh":7682,"consumption_8_months_ago_kwh":7582,"consumption_9_months_ago_kwh":7383,"consumption_10_months_ago_kwh":7154,"consumption_11_months_ago_kwh":6760,"consumption_12_months_ago_kwh":6430,"consumption_13_months_ago_kwh":6123,"consumption_14_months_ago_kwh":5916,"consumption_15_months_ago_kwh":5870,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
|Heater;12345679;7997.000000;2435.800000;OK;null;7955.000000;1111-11-11 11:11.11
|
||||
|
||||
# Test Elster V200H water meter
|
||||
|
|
|
@ -17,109 +17,95 @@
|
|||
|
||||
#include"meters_common_implementation.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct MeterEngelmannFAW : public virtual MeterCommonImplementation
|
||||
namespace
|
||||
{
|
||||
MeterEngelmannFAW(MeterInfo &mi, DriverInfo &di);
|
||||
struct Driver : public virtual MeterCommonImplementation
|
||||
{
|
||||
Driver(MeterInfo &mi, DriverInfo &di);
|
||||
};
|
||||
|
||||
private:
|
||||
static bool ok = registerDriver([](DriverInfo&di)
|
||||
{
|
||||
di.setName("engelmann-faw");
|
||||
di.setMeterType(MeterType::WaterMeter);
|
||||
di.addLinkMode(LinkMode::T1);
|
||||
di.addDetection(MANUFACTURER_EFE, 0x07, 0x00);
|
||||
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new Driver(mi, di)); });
|
||||
});
|
||||
|
||||
double total_water_consumption_m3_ {};
|
||||
double consumption_at_set_date_m3_[16];
|
||||
};
|
||||
|
||||
static bool ok = registerDriver([](DriverInfo&di)
|
||||
{
|
||||
di.setName("engelmann-faw");
|
||||
di.setMeterType(MeterType::WaterMeter);
|
||||
di.addLinkMode(LinkMode::T1);
|
||||
di.addDetection(MANUFACTURER_EFE, 0x07, 0x00);
|
||||
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new MeterEngelmannFAW(mi, di)); });
|
||||
});
|
||||
|
||||
MeterEngelmannFAW::MeterEngelmannFAW(MeterInfo &mi, DriverInfo &di) :
|
||||
MeterCommonImplementation(mi, di)
|
||||
{
|
||||
addStringFieldWithExtractor(
|
||||
"reporting_date",
|
||||
"The reporting date of the last billing period.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Date)
|
||||
.set(StorageNr(1))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"consumption_at_reporting_date",
|
||||
Quantity::Volume,
|
||||
NoDifVifKey,
|
||||
VifScaling::Auto,
|
||||
MeasurementType::Instantaneous,
|
||||
VIFRange::Volume,
|
||||
StorageNr(1),
|
||||
TariffNr(0),
|
||||
IndexNr(1),
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||
"The water consumption at the last billing period date.",
|
||||
SET_FUNC(total_water_consumption_m3_, Unit::M3),
|
||||
GET_FUNC(total_water_consumption_m3_, Unit::M3));
|
||||
|
||||
addStringFieldWithExtractorAndLookup(
|
||||
"current_status",
|
||||
"Status and error flags.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | JOIN_TPL_STATUS,
|
||||
FieldMatcher::build()
|
||||
.set(VIFRange::ErrorFlags),
|
||||
{
|
||||
Driver::Driver(MeterInfo &mi, DriverInfo &di) :
|
||||
MeterCommonImplementation(mi, di)
|
||||
{
|
||||
addStringFieldWithExtractorAndLookup(
|
||||
"status",
|
||||
"Status and error flags.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS,
|
||||
FieldMatcher::build()
|
||||
.set(VIFRange::ErrorFlags),
|
||||
{
|
||||
{
|
||||
"ERROR_FLAGS",
|
||||
Translate::Type::BitToString,
|
||||
0xff,
|
||||
"OK",
|
||||
{
|
||||
{ 0x01, "VOLUME_DETECTION_COIL(S)_DEFECT" },
|
||||
{ 0x02, "RESET" },
|
||||
{ 0x04, "CRC_ERROR" },
|
||||
{ 0x08, "REMOVAL_DETECTED" },
|
||||
{ 0x10, "MAGNETIC_MANIPULATION" },
|
||||
{ 0x20, "LEAKAGE" },
|
||||
{ 0x40, "BLOCKED" },
|
||||
{ 0x80, "REVERSE_FLOW" },
|
||||
}
|
||||
"ERROR_FLAGS",
|
||||
Translate::Type::BitToString,
|
||||
0xff,
|
||||
"OK",
|
||||
{
|
||||
{ 0x01, "VOLUME_DETECTION_COILS_DEFECT" },
|
||||
{ 0x02, "RESET" },
|
||||
{ 0x04, "CRC_ERROR" },
|
||||
{ 0x08, "REMOVAL_DETECTED" },
|
||||
{ 0x10, "MAGNETIC_MANIPULATION" },
|
||||
{ 0x20, "LEAKAGE" },
|
||||
{ 0x40, "BLOCKED" },
|
||||
{ 0x80, "REVERSE_FLOW" },
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
for (int i=2; i<=16; ++i)
|
||||
{
|
||||
string msg, info;
|
||||
strprintf(msg, "consumption_%d_months_ago", i-1);
|
||||
strprintf(info, "Water consumption %d month(s) ago.", i-1);
|
||||
});
|
||||
|
||||
addStringFieldWithExtractor(
|
||||
"reporting_date",
|
||||
"The reporting date of the last billing period.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Date)
|
||||
.set(StorageNr(1))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
msg,
|
||||
"consumption_at_reporting_date",
|
||||
"The water consumption at the last billing period date.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||
Quantity::Volume,
|
||||
NoDifVifKey,
|
||||
VifScaling::Auto,
|
||||
MeasurementType::Instantaneous,
|
||||
VIFRange::Volume,
|
||||
StorageNr(i),
|
||||
TariffNr(0),
|
||||
IndexNr(1),
|
||||
PrintProperty::JSON | PrintProperty::OPTIONAL,
|
||||
info,
|
||||
SET_FUNC(consumption_at_set_date_m3_[i-1], Unit::M3),
|
||||
GET_FUNC(consumption_at_set_date_m3_[i-1], Unit::M3));
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Volume)
|
||||
.set(StorageNr(1)));
|
||||
|
||||
for (int i=2; i<=16; ++i)
|
||||
{
|
||||
string name, info;
|
||||
strprintf(&name, "consumption_%d_months_ago", i-1);
|
||||
strprintf(&info, "Water consumption %d month(s) ago.", i-1);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
name,
|
||||
info,
|
||||
PrintProperty::JSON | PrintProperty::OPTIONAL,
|
||||
Quantity::Volume,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Volume)
|
||||
.set(StorageNr(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Test: Wasserzaehler engelmann-faw 43000255 NOKEY
|
||||
// telegram=8f44c5145502004301077260402520c51400076b0000002f2f426cbf2c441322e9000001fd17008401133c340100c40113ae2d010084021303290100c402137e21010084031313180100c403138a0e010084041337060100c40413b2fc00008405139af30000c4051322e90000840613c1df0000c40613cdd5000084071365ce0000c407136dc500008408138dbf0000
|
||||
// {"media":"water","meter":"engelmann-faw","name":"Wasserzaehler","id":"20254060","reporting_date":"2021-12-31","consumption_at_reporting_date_m3":59.682,"current_status":"OK","consumption_1_months_ago_m3":78.908,"consumption_2_months_ago_m3":77.23,"consumption_3_months_ago_m3":76.035,"consumption_4_months_ago_m3":74.11,"consumption_5_months_ago_m3":71.699,"consumption_6_months_ago_m3":69.258,"consumption_7_months_ago_m3":67.127,"consumption_8_months_ago_m3":64.69,"consumption_9_months_ago_m3":62.362,"consumption_10_months_ago_m3":59.682,"consumption_11_months_ago_m3":57.281,"consumption_12_months_ago_m3":54.733,"consumption_13_months_ago_m3":52.837,"consumption_14_months_ago_m3":50.541,"consumption_15_months_ago_m3":49.037,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Wasserzaehler;20254060;2021-12-31;59.682000;OK;1111-11-11 11:11.11
|
||||
|
||||
// telegram=|8f44c5145502004301077260402520c51400076b0000002f2f426cbf2c441322e9000001fd17008401133c340100c40113ae2d010084021303290100c402137e21010084031313180100c403138a0e010084041337060100c40413b2fc00008405139af30000c4051322e90000840613c1df0000c40613cdd5000084071365ce0000c407136dc500008408138dbf0000|
|
||||
// {"media":"water","meter":"engelmann-faw","name":"Wasserzaehler","id":"20254060","status":"OK","reporting_date":"2021-12-31","consumption_at_reporting_date_m3":59.682,"consumption_1_months_ago_m3":78.908,"consumption_2_months_ago_m3":77.23,"consumption_3_months_ago_m3":76.035,"consumption_4_months_ago_m3":74.11,"consumption_5_months_ago_m3":71.699,"consumption_6_months_ago_m3":69.258,"consumption_7_months_ago_m3":67.127,"consumption_8_months_ago_m3":64.69,"consumption_9_months_ago_m3":62.362,"consumption_10_months_ago_m3":59.682,"consumption_11_months_ago_m3":57.281,"consumption_12_months_ago_m3":54.733,"consumption_13_months_ago_m3":52.837,"consumption_14_months_ago_m3":50.541,"consumption_15_months_ago_m3":49.037,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Wasserzaehler;20254060;OK;2021-12-31;59.682000;1111-11-11 11:11.11
|
||||
|
|
|
@ -22,8 +22,6 @@ namespace
|
|||
{
|
||||
struct Driver : public virtual MeterCommonImplementation {
|
||||
Driver(MeterInfo &mi, DriverInfo &di);
|
||||
private:
|
||||
double consumption_at_set_date_kWh_[16];
|
||||
};
|
||||
|
||||
static bool ok = registerDriver([](DriverInfo&di)
|
||||
|
@ -151,7 +149,7 @@ namespace
|
|||
"Status and error flags.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD,
|
||||
FieldMatcher::build()
|
||||
.set(VIFRange::ErrorFlags),
|
||||
.set(VIFRange::ErrorFlags),
|
||||
{
|
||||
{
|
||||
{
|
||||
|
@ -183,7 +181,7 @@ namespace
|
|||
.set(VIFRange::Date)
|
||||
.set(StorageNr(1))
|
||||
);
|
||||
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"energy_consumption_at_reporting_date",
|
||||
"The energy consumption at the last billing period date.",
|
||||
|
@ -198,23 +196,19 @@ namespace
|
|||
|
||||
for (int i=1; i<=15; ++i)
|
||||
{
|
||||
string msg, info;
|
||||
strprintf(msg, "consumption_%d_months_ago", i);
|
||||
strprintf(info, "Energy consumption %d month(s) ago.", i);
|
||||
string name, info;
|
||||
strprintf(&name, "consumption_%d_months_ago", i);
|
||||
strprintf(&info, "Energy consumption %d month(s) ago.", i);
|
||||
addNumericFieldWithExtractor(
|
||||
msg,
|
||||
Quantity::Energy,
|
||||
NoDifVifKey,
|
||||
VifScaling::Auto,
|
||||
MeasurementType::Instantaneous,
|
||||
VIFRange::AnyEnergyVIF,
|
||||
StorageNr(i*2),
|
||||
TariffNr(0),
|
||||
IndexNr(1),
|
||||
PrintProperty::JSON| PrintProperty::OPTIONAL,
|
||||
name,
|
||||
info,
|
||||
SET_FUNC(consumption_at_set_date_kWh_[i], Unit::KWH),
|
||||
GET_FUNC(consumption_at_set_date_kWh_[i], Unit::KWH));
|
||||
PrintProperty::JSON| PrintProperty::OPTIONAL,
|
||||
Quantity::Energy,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyEnergyVIF)
|
||||
.set(StorageNr(i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,11 +216,11 @@ namespace
|
|||
// Test: Heat sensostar 20480057 NOKEY
|
||||
// Comment:
|
||||
// telegram=|68B3B36808007257004820c51400046c100000047839803801040600000000041300000000042B00000000142B00000000043B00000000143B00000000025B1400025f15000261daff02235c00046d2c2ddc24440600000000441300000000426c000001fd171003fd0c05000084200600000000c420060000000084300600000000c430060000000084401300000000c44013000000008480401300000000c48040130000000084c0401300000000c4c0401300000000a216|
|
||||
// {"media":"heat","meter":"sensostar","name":"Heat","id":"20480057","meter_timestamp":"2022-04-28 13:44","total_kwh":0,"power_kw":0,"power_max_kw":0,"flow_water_m3h":0,"flow_water_max_m3h":0,"forward_c":20,"return_c":21,"difference_c":-0.38,"total_water_m3":0,"current_status":"FLOW_METER_FAILURE","reporting_date":"2000-00-00","energy_consumption_at_reporting_date_kwh":0,"consumption_1_months_ago_kwh":0,"consumption_2_months_ago_kwh":0,"consumption_3_months_ago_kwh":0,"consumption_4_months_ago_kwh":0,"consumption_5_months_ago_kwh":0,"consumption_6_months_ago_kwh":0,"consumption_7_months_ago_kwh":0,"consumption_8_months_ago_kwh":0,"consumption_9_months_ago_kwh":0,"consumption_10_months_ago_kwh":0,"consumption_11_months_ago_kwh":0,"consumption_12_months_ago_kwh":0,"consumption_13_months_ago_kwh":0,"consumption_14_months_ago_kwh":0,"consumption_15_months_ago_kwh":0,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
// {"media":"heat","meter":"sensostar","name":"Heat","id":"20480057","meter_timestamp":"2022-04-28 13:44","total_kwh":0,"power_kw":0,"power_max_kw":0,"flow_water_m3h":0,"flow_water_max_m3h":0,"forward_c":20,"return_c":21,"difference_c":-0.38,"total_water_m3":0,"current_status":"ERROR_FLOW_MEASUREMENT_SYSTEM_ERROR","reporting_date":"2000-00-00","energy_consumption_at_reporting_date_kwh":0,"consumption_1_months_ago_kwh":0,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Heat;20480057;0.000000;0.000000;ERROR_FLOW_MEASUREMENT_SYSTEM_ERROR;2000-00-00;0.000000;1111-11-11 11:11.11
|
||||
|
||||
// Test: WMZ sensostar 02752560 NOKEY
|
||||
// Comment: from "Sensostar U"
|
||||
// Comment: from "Sensostar U"
|
||||
//telegram=a444c5146025750200047ac20000202f2f046d2e26c62a040643160000041310f0050001fd1700426cbf2c4406570e00008401061f160000840206f6150000840306f5150000840406f3150000840506ea150000840606bf1500008407065214000084080692120000840906c5100000840a06570e0000840b06ca0b0000840c06da090000840d06ca080000840e06c8080000840f06c608000003fd0c05010002fd0b2111
|
||||
//{"media":"heat","meter":"sensostar","name":"WMZ","id":"02752560","meter_timestamp":"2022-10-06 06:46","total_kwh":5699,"total_water_m3":389.136,"current_status":"OK","reporting_date":"2021-12-31","energy_consumption_at_reporting_date_kwh":3671,"consumption_1_months_ago_kwh":5663,"consumption_2_months_ago_kwh":5622,"consumption_3_months_ago_kwh":5621,"consumption_4_months_ago_kwh":5619,"consumption_5_months_ago_kwh":5610,"consumption_6_months_ago_kwh":5567,"consumption_7_months_ago_kwh":5202,"consumption_8_months_ago_kwh":4754,"consumption_9_months_ago_kwh":4293,"consumption_10_months_ago_kwh":3671,"consumption_11_months_ago_kwh":3018,"consumption_12_months_ago_kwh":2522,"consumption_13_months_ago_kwh":2250,"consumption_14_months_ago_kwh":2248,"consumption_15_months_ago_kwh":2246,"timestamp":"1111-11-11 11:11.11"}
|
||||
//WMZ;02752560;5699.000000;389.136000;OK;1111-11-11 11:11.11
|
||||
|
|
Ładowanie…
Reference in New Issue