From 93a966b5ee47c0cb6576b1726a55f35f0ed8d5e5 Mon Sep 17 00:00:00 2001 From: BIBOLV <49994376+BIBOLV@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:08:18 +0200 Subject: [PATCH 1/2] Create driver_aerius.cc Add support for DIEHL AERIUS Gas Meter - https://github.com/wmbusmeters/wmbusmeters/issues/917 --- src/driver_aerius.cc | 106 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 src/driver_aerius.cc diff --git a/src/driver_aerius.cc b/src/driver_aerius.cc new file mode 100644 index 0000000..84f75d5 --- /dev/null +++ b/src/driver_aerius.cc @@ -0,0 +1,106 @@ +/* + Copyright (C) 2017-2023 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 . +*/ + +#include"meters_common_implementation.h" + +namespace +{ + struct Driver : public virtual MeterCommonImplementation + { + Driver(MeterInfo &mi, DriverInfo &di); + }; + + static bool ok = registerDriver([](DriverInfo&di) + { + di.setName("aerius"); + di.setDefaultFields("name,id,total_m3,current_flow_m3h,target_date_time,target_m3,timestamp"); + di.setMeterType(MeterType::GasMeter); + di.addLinkMode(LinkMode::T1); + di.addDetection(MANUFACTURER_DME, 0x03, 0x30); + di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new Driver(mi, di)); }); + }); + + Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) + { + addNumericFieldWithExtractor( + "total", + "The total gas consumption recorded by this meter.", + DEFAULT_PRINT_PROPERTIES, + Quantity::Volume, + VifScaling::Auto, + FieldMatcher::build() + .set(MeasurementType::Instantaneous) + .set(VIFRange::Volume) + .add(VIFCombinable::ValueAtBaseCondC) + ); + + addNumericFieldWithExtractor( + "current_flow", + "The current gas flow.", + DEFAULT_PRINT_PROPERTIES, + Quantity::Flow, + VifScaling::Auto, + FieldMatcher::build() + .set(MeasurementType::Instantaneous) + .set(VIFRange::VolumeFlow) + ); + + addNumericFieldWithExtractor( + "current_temp", + "The current temperature.", + DEFAULT_PRINT_PROPERTIES, + Quantity::Temperature, + VifScaling::Auto, + FieldMatcher::build() + .set(MeasurementType::Instantaneous) + .set(VIFRange::FlowTemperature) + ); + + addStringFieldWithExtractor( + "target_date_time", + "Timestamp for gas consumption recorded at the beginning of this period.", + DEFAULT_PRINT_PROPERTIES, + FieldMatcher::build() + .set(MeasurementType::Instantaneous) + .set(VIFRange::DateTime) + .set(StorageNr(1)) + .set(SubUnitNr(0)) + .set(StorageNr(3)) + ); + + addNumericFieldWithExtractor( + "target", + "The total gas consumption recorded by this meter at the beginning of this period.", + DEFAULT_PRINT_PROPERTIES, + Quantity::Volume, + VifScaling::Auto, + FieldMatcher::build() + .set(MeasurementType::Instantaneous) + .set(VIFRange::Volume) + .set(StorageNr(1)) + .set(SubUnitNr(0)) + .set(StorageNr(3)) + .add(VIFCombinable::ValueAtBaseCondC) + ); + + } +} + +// Test: aerius_gas aerius 99657098 NOKEY +// telegram=|2E44A5119870659930037A060020052F2F_0C933E842784060A3B00000A5A5901C4016D3B37DF2CCC01933E24032606| +// {"media":"gas","meter":"aerius","name":"aerius_gas","id":"99657098","total_m3":6842.784,"current_flow_m3h":0,"current_temp_c":15.9,"target_date_time":"2022-12-31 23:59","target_m3":6260.324,"timestamp":"1111-11-11T11:11:11Z"} +// |aerius_gas;99657098;6842.784;0;2022-12-31 23:59;6260.324;1111-11-11 11:11.11 \ No newline at end of file From 14b242c48cc134a612a84b97ac1f36f9c1f57583 Mon Sep 17 00:00:00 2001 From: BIBOLV <49994376+BIBOLV@users.noreply.github.com> Date: Thu, 16 Mar 2023 19:04:56 +0200 Subject: [PATCH 2/2] Update driver_aerius.cc --- src/driver_aerius.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/driver_aerius.cc b/src/driver_aerius.cc index 84f75d5..100f358 100644 --- a/src/driver_aerius.cc +++ b/src/driver_aerius.cc @@ -27,7 +27,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("aerius"); - di.setDefaultFields("name,id,total_m3,current_flow_m3h,target_date_time,target_m3,timestamp"); + di.setDefaultFields("name,id,total_m3,flow_m3h,target_datetime,target_m3,timestamp"); di.setMeterType(MeterType::GasMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_DME, 0x03, 0x30); @@ -49,7 +49,7 @@ namespace ); addNumericFieldWithExtractor( - "current_flow", + "flow", "The current gas flow.", DEFAULT_PRINT_PROPERTIES, Quantity::Flow, @@ -60,7 +60,7 @@ namespace ); addNumericFieldWithExtractor( - "current_temp", + "temperature", "The current temperature.", DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, @@ -70,15 +70,15 @@ namespace .set(VIFRange::FlowTemperature) ); - addStringFieldWithExtractor( - "target_date_time", - "Timestamp for gas consumption recorded at the beginning of this period.", + addNumericFieldWithExtractor( + "target", + "Date time when previous billing period ended.", DEFAULT_PRINT_PROPERTIES, + Quantity::PointInTime, + VifScaling::Auto, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) - .set(StorageNr(1)) - .set(SubUnitNr(0)) .set(StorageNr(3)) ); @@ -91,8 +91,6 @@ namespace FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Volume) - .set(StorageNr(1)) - .set(SubUnitNr(0)) .set(StorageNr(3)) .add(VIFCombinable::ValueAtBaseCondC) ); @@ -102,5 +100,5 @@ namespace // Test: aerius_gas aerius 99657098 NOKEY // telegram=|2E44A5119870659930037A060020052F2F_0C933E842784060A3B00000A5A5901C4016D3B37DF2CCC01933E24032606| -// {"media":"gas","meter":"aerius","name":"aerius_gas","id":"99657098","total_m3":6842.784,"current_flow_m3h":0,"current_temp_c":15.9,"target_date_time":"2022-12-31 23:59","target_m3":6260.324,"timestamp":"1111-11-11T11:11:11Z"} +// {"media":"gas","meter":"aerius","name":"aerius_gas","id":"99657098","total_m3":6842.784,"flow_m3h":0,"temperature_c":15.9,"target_datetime":"2022-12-31 23:59","target_m3":6260.324,"timestamp":"1111-11-11T11:11:11Z"} // |aerius_gas;99657098;6842.784;0;2022-12-31 23:59;6260.324;1111-11-11 11:11.11 \ No newline at end of file