kopia lustrzana https://github.com/weetmuts/wmbusmeters
Added support for Hydrodigit water meter.
rodzic
b0caefa115
commit
bf233da26c
1
Makefile
1
Makefile
|
@ -106,6 +106,7 @@ METER_OBJS:=\
|
|||
$(BUILD)/meter_rfmamb.o \
|
||||
$(BUILD)/meter_izar.o \
|
||||
$(BUILD)/meter_hydrus.o \
|
||||
$(BUILD)/meter_hydrodigit.o \
|
||||
$(BUILD)/printer.o \
|
||||
$(BUILD)/serial.o \
|
||||
$(BUILD)/shell.o \
|
||||
|
|
|
@ -178,6 +178,7 @@ Apator at-wmbus-16-2 (apator162) (non-standard protocol)
|
|||
Techem MK Radio 3 (mkradio3) (non-standard protocol)
|
||||
Diehl/Sappel IZAR RC 868 I R4 PL (izar)
|
||||
Diehl HYDRUS (hydrus)
|
||||
Bmeters Hydrodigit (hydrodigit) (partly non-standard protocol)
|
||||
|
||||
Supported heat cost allocators:
|
||||
Qundis Q caloric (qcaloric)
|
||||
|
|
|
@ -66,3 +66,7 @@ telegram=|1944304C72242421D401A2|013D4013DD8B46A4999C1293E582CC|
|
|||
# Test Hydrus water meter telegram
|
||||
telegram=|4E44A5116464646470077AED004005|2F2F01FD08300C13741100007C1300000000FC101300000000FC201300000000726C00000B3B00000002FD748713025A6800C4016D3B177F2ACC011300020000|
|
||||
{"media":"water","meter":"hydrus","name":"HydrusWater","id":"64646464","total_m3":1.174,"max_flow_m3h":0,"flow_temperature_c":10.4,"total_at_date_m3":0.2,"at_date":"2019-10-31 23:59","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|
||||
# Test BMeters HydroDigit water telegram
|
||||
telegram=|4E44B4098686868613077AF0004005|2F2F0C1366380000046D27287E2A0F150E00000000C10000D10000E60000FD00000C01002F0100410100540100680100890000A00000B30000002F2F2F2F2F2F|
|
||||
{"media":"water","meter":"hydrodigit","name":"HydrodigitWater","id":"86868686","total_m3":3.866,"meter_datetime":"2019-10-30 08:39","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
Copyright (C) 2019 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"
|
||||
#include"util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct MeterHydrodigit : public virtual WaterMeter, public virtual MeterCommonImplementation {
|
||||
MeterHydrodigit(WMBus *bus, MeterInfo &mi);
|
||||
|
||||
// Total water counted through the meter
|
||||
double totalWaterConsumption(Unit u);
|
||||
bool hasTotalWaterConsumption();
|
||||
|
||||
private:
|
||||
void processContent(Telegram *t);
|
||||
|
||||
double total_water_consumption_m3_ {};
|
||||
string meter_datetime_;
|
||||
};
|
||||
|
||||
unique_ptr<WaterMeter> createHydrodigit(WMBus *bus, MeterInfo &mi)
|
||||
{
|
||||
return unique_ptr<WaterMeter>(new MeterHydrodigit(bus, mi));
|
||||
}
|
||||
|
||||
MeterHydrodigit::MeterHydrodigit(WMBus *bus, MeterInfo &mi) :
|
||||
MeterCommonImplementation(bus, mi, MeterType::HYDRODIGIT, MANUFACTURER_BMT)
|
||||
{
|
||||
setEncryptionMode(EncryptionMode::AES_CBC);
|
||||
|
||||
addMedia(0x07);
|
||||
|
||||
addLinkMode(LinkMode::T1);
|
||||
|
||||
addPrint("total", Quantity::Volume,
|
||||
[&](Unit u){ return totalWaterConsumption(u); },
|
||||
"The total water consumption recorded by this meter.",
|
||||
true, true);
|
||||
|
||||
addPrint("meter_datetime", Quantity::Text,
|
||||
[&](){ return meter_datetime_; },
|
||||
"A date.....",
|
||||
true, true);
|
||||
|
||||
MeterCommonImplementation::bus()->onTelegram(calll(this,handleTelegram,Telegram*));
|
||||
}
|
||||
|
||||
void MeterHydrodigit::processContent(Telegram *t)
|
||||
{
|
||||
map<string,pair<int,DVEntry>> values;
|
||||
parseDV(t, t->content, t->content.begin(), t->content.size(), &values);
|
||||
|
||||
int offset;
|
||||
string key;
|
||||
|
||||
if(findKey(MeasurementType::Unknown, ValueInformation::Volume, 0, &key, &values)) {
|
||||
extractDVdouble(&values, key, &offset, &total_water_consumption_m3_);
|
||||
t->addMoreExplanation(offset, " total consumption (%f m3)", total_water_consumption_m3_);
|
||||
}
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::DateTime, 0, &key, &values)) {
|
||||
struct tm datetime;
|
||||
extractDVdate(&values, key, &offset, &datetime);
|
||||
meter_datetime_ = strdatetime(&datetime);
|
||||
t->addMoreExplanation(offset, " meter_datetime (%s)", meter_datetime_.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
double MeterHydrodigit::totalWaterConsumption(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Volume);
|
||||
return convert(total_water_consumption_m3_, Unit::M3, u);
|
||||
}
|
||||
|
||||
bool MeterHydrodigit::hasTotalWaterConsumption()
|
||||
{
|
||||
return true;
|
||||
}
|
|
@ -28,11 +28,12 @@
|
|||
#define LIST_OF_METERS \
|
||||
X(amiplus, T1_bit, Electricity, AMIPLUS, Amiplus) \
|
||||
X(apator162, C1_bit|T1_bit, Water, APATOR162, Apator162) \
|
||||
X(eurisii, T1_bit, HeatCostAllocation, EURISII, EurisII) \
|
||||
X(eurisii, T1_bit, HeatCostAllocation, EURISII, EurisII) \
|
||||
X(flowiq3100, C1_bit, Water, FLOWIQ3100, Multical21) \
|
||||
X(hydrus, T1_bit, Water, HYDRUS, Hydrus) \
|
||||
X(hydrus, T1_bit, Water, HYDRUS, Hydrus) \
|
||||
X(hydrodigit, T1_bit, Water, HYDRODIGIT, Hydrodigit) \
|
||||
X(iperl, T1_bit, Water, IPERL, Iperl) \
|
||||
X(izar, T1_bit, Water, IZAR, Izar) \
|
||||
X(izar, T1_bit, Water, IZAR, Izar) \
|
||||
X(lansenth, T1_bit, TempHygro, LANSENTH, LansenTH) \
|
||||
X(mkradio3, T1_bit, Water, MKRADIO3, MKRadio3) \
|
||||
X(multical21, C1_bit, Water, MULTICAL21, Multical21) \
|
||||
|
@ -190,6 +191,7 @@ unique_ptr<WaterMeter> createMKRadio3(WMBus *bus, MeterInfo &m);
|
|||
unique_ptr<WaterMeter> createApator162(WMBus *bus, MeterInfo &m);
|
||||
unique_ptr<WaterMeter> createIperl(WMBus *bus, MeterInfo &m);
|
||||
unique_ptr<WaterMeter> createHydrus(WMBus *bus, MeterInfo &m);
|
||||
unique_ptr<WaterMeter> createHydrodigit(WMBus *bus, MeterInfo &m);
|
||||
unique_ptr<WaterMeter> createIzar(WMBus *bus, MeterInfo &m);
|
||||
unique_ptr<HeatCostMeter> createQCaloric(WMBus *bus, MeterInfo &m);
|
||||
unique_ptr<HeatCostMeter> createEurisII(WMBus *bus, MeterInfo &m);
|
||||
|
|
|
@ -66,6 +66,9 @@ Received telegram from: 21242472
|
|||
Received telegram from: 64646464
|
||||
manufacturer: (DME) DIEHL Metering, Germany
|
||||
device type: Water meter
|
||||
Received telegram from: 86868686
|
||||
manufacturer: (BMT) BMETERS, Italy
|
||||
device type: Water meter
|
||||
EOF
|
||||
|
||||
EXPECTED=$(cat $LOGFILE_EXPECTED)
|
||||
|
|
|
@ -25,6 +25,7 @@ $PROG --format=json simulations/simulation_t1.txt \
|
|||
Rummet rfmamb 11772288 "" \
|
||||
IzarWater izar 21242472 "" \
|
||||
HydrusWater hydrus 64646464 "" \
|
||||
HydrodigitWater hydrodigit 86868686 "" \
|
||||
> $TEST/test_output.txt
|
||||
if [ "$?" == "0" ]
|
||||
then
|
||||
|
|
Ładowanie…
Reference in New Issue