From 33952d803fcef50683a7e12a163060e05d13f0eb Mon Sep 17 00:00:00 2001 From: weetmuts Date: Sun, 23 Feb 2020 18:41:21 +0100 Subject: [PATCH] Added divide by 3 to apator08. --- README.md | 1 + simulations/simulation_t1.txt | 6 ++++++ src/meter_apator08.cc | 3 +++ tests/test_listen_to_all.sh | 29 +++++++++++++---------------- tests/test_t1_meters.sh | 3 ++- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 3bccfb9..183075c 100644 --- a/README.md +++ b/README.md @@ -192,6 +192,7 @@ Kamstrup Multical 21 (multical21) Kamstrup flowIQ 3100 (flowiq3100) Sontex Supercom 587 (supercom587) Sensus iPERL (iperl) +Apator at-wmbus-08 (apator08) (non-standard protocol) 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) (non-standard protocol) diff --git a/simulations/simulation_t1.txt b/simulations/simulation_t1.txt index 02d4fa4..3c7bf39 100644 --- a/simulations/simulation_t1.txt +++ b/simulations/simulation_t1.txt @@ -109,3 +109,9 @@ telegram=|7B4479169977997730378C20F0900F002C2549EE0A0077C19D3D1A08ABCD7299779977 telegram=|5344A8159955995502028C201D900F002C250C390000ED176BBBB1591ADB7A1D003007102F2F|0700583B74020000000007803CBCD70200000000000728B070200000000000042092A406002F2F2F2F2F2F2F2F2F| {"media":"electricity","meter":"ehzp","name":"Elen3","id":"55995599","total_energy_consumption_kwh":41.1718,"current_power_consumption_kw":2.126,"total_energy_production_kwh":0.1863,"on_time_h":120.929444,"timestamp":"1111-11-11T11:11:11Z"} |Elen3;55995599;41.171800;2.126000;0.186300;1111-11-11 11:11.11 + +# Test water meter apator08 + +telegram=|73441486DD4444000303A0|B9E527004C4034B31CED0106FF01D093270065F022009661230054D02300EC49240018B424005F012500936D2500FFD525000E3D26001EAC26000B2027000300000000371D0B2000000000000024000000000000280000000000002C0033150C010D2F000000000000| +{"media":"water","meter":"apator08","name":"Vatten","id":"004444dd","total_m3":871.571,"timestamp":"1111-11-11T11:11:11Z"} +|Vatten;004444dd;871.571000;1111-11-11 11:11.11 diff --git a/src/meter_apator08.cc b/src/meter_apator08.cc index 685c04a..89add3b 100644 --- a/src/meter_apator08.cc +++ b/src/meter_apator08.cc @@ -93,6 +93,9 @@ void MeterApator08::processContent(Telegram *t) if(findKey(MeasurementType::Unknown, ValueInformation::Volume, 0, 0, &key, &vendor_values)) { extractDVdouble(&vendor_values, key, &offset, &total_water_consumption_m3_); + // Now divide with 3! Is this the same for all apator08 meters? Time will tell. + total_water_consumption_m3_ /= 3.0; + //Adding explanation have to wait since it assumes that the dvparser could do something, but it could not here. //t->addMoreExplanation(offset, " total consumption (%f m3)", total_water_consumption_m3_); } diff --git a/tests/test_listen_to_all.sh b/tests/test_listen_to_all.sh index a1f568b..89c45bb 100755 --- a/tests/test_listen_to_all.sh +++ b/tests/test_listen_to_all.sh @@ -81,10 +81,11 @@ Received telegram from: 77997799 Received telegram from: 55995599 manufacturer: (EMH) EMH metering formerly EMH Elektrizitatszahler device type: Electricity meter +Received telegram from: 004444dd + manufacturer: (APT) Unknown + device type: Gas meter EOF -EXPECTED=$(cat $LOGFILE_EXPECTED) - RES=$($PROG --logfile=$LOGFILE --t1 simulations/simulation_t1.txt 2>&1) if [ ! "$RES" = "" ] @@ -97,35 +98,31 @@ then exit 1 fi -GOT=$(cat $LOGFILE) +RES=$(diff $LOGFILE $LOGFILE_EXPECTED) - -if [ ! "$GOT" = "$EXPECTED" ] +if [ ! -z "$RES" ] then echo ERROR: $TESTNAME - echo GOT-------------- - echo $GOT - echo EXPECTED--------- - echo $EXPECTED + echo ----------------- + diff $LOGFILE $LOGFILE_EXPECTED echo ----------------- exit 1 else echo OK: $TESTNAME fi - TESTNAME="Test listen and print any meter heard on stdout" TESTRESULT="ERROR" -GOT=$($PROG --t1 simulations/simulation_t1.txt 2>&1) +$PROG --t1 simulations/simulation_t1.txt 2>&1 > $LOGFILE -if [ ! "$GOT" = "$EXPECTED" ] +RES=$(diff $LOGFILE $LOGFILE_EXPECTED) + +if [ ! -z "$RES" ] then echo ERROR: $TESTNAME - echo GOT-------------- - echo $GOT - echo EXPECTED--------- - echo $EXPECTED + echo ----------------- + diff $LOGFILE $LOGFILE_EXPECTED echo ----------------- exit 1 else diff --git a/tests/test_t1_meters.sh b/tests/test_t1_meters.sh index f08f505..1d491bc 100755 --- a/tests/test_t1_meters.sh +++ b/tests/test_t1_meters.sh @@ -26,7 +26,8 @@ METERS="MyWarmWater supercom587 12345678 NOKEY Q400Water q400 72727272 AAA896100FED12DD614DD5D46369ACDD Elen1 ebzwmbe 22992299 NOKEY Elen2 esyswm 77997799 NOKEY - Elen3 ehzp 55995599 NOKEY" + Elen3 ehzp 55995599 NOKEY + Vatten apator08 004444dd NOKEY" cat simulations/simulation_t1.txt | grep '^{' > $TEST/test_expected.txt $PROG --format=json simulations/simulation_t1.txt $METERS > $TEST/test_output.txt