Porównaj commity

...

27 Commity

Autor SHA1 Wiadomość Data
Andi252 5879a2d432
Merge 25108bd290 into d90dbb196e 2024-04-15 19:21:42 +02:00
Fredrik Öhrström d90dbb196e Add another m,v,t combo for the lse_07_17 driver. 2024-04-15 08:44:14 +02:00
Fredrik Öhrström 14d021426a
Merge pull request #1245 from majonezz/patch-1
Avoid SIGSEGV in WMBusCUL::checkCULFrame
2024-04-14 16:13:26 +02:00
Michał Morański f32179a939
Avoid SIGSEGV in WMBusCUL::checkCULFrame
(cul) checkCULFrame "b2F4468506586269295620A17A2069F2"
(cul) no eol found yet, partial frame
(serial) received ascii "TMODE<0D><0A>b2F44685086625092957245C6A2069F2F6A06E0080000000000000000B9BF00000D0F0D11130512100F0F0F100F0F8E1F0F0E0D121310B241<0D><0A>b4E44B61065960200023732117A0E004005E4B5FD2A1E3DCCC84F38BDF21FD05D506BF685D50CB3AD9644F9FF7C893BF9DD0D2B64C85F703707B1965C69261E8CDF85046CDDC38F1336D67750E933854BA0C9A91240A18556E6064B<0D><0A>"
(cul) checkCULFrame "b2F4468506586269295620A17A2069F2TMODE<0D><0A>b2F44685086625092957245C6A2069F2F6A06E0080000000000000000B9BF00000D0F0D11130512100F0F0F100F0F8E1F0F0E0D121310B241<0D><0A>b4E44B61065960200023732117A0E004005E4B5FD2A1E3DCCC84F38BDF21FD05D506BF685D50CB3AD9644F9FF7C893BF9DD0D2B64C85F703707B1965C69261E8CDF85046CDDC38F1336D67750E933854BA0C9A91240A18556E6064B<0D><0A>"
(cul) bad hex for LQI and RSSI "MODE"
(cul) warning: the LQI and RSSI hex string is not properly formatted!

Thread 2 "wmbusmeters" received signal SIGSEGV, Segmentation fault.
0x571c718f in WMBusCUL::checkCULFrame (this=0xf0a03480, data=std::vector of length 339, capacity 339 = {...}, hex_frame_length=0xf07fe680,
    payload=std::vector of length 0, capacity 0, rssi_dbm=0xf07fe6c0) at src/wmbus_cul.cc:336
336         uint lqi = lqi_rssi[0]>>1;
(gdb)
2024-04-14 15:16:56 +02:00
Andreas Horrer 25108bd290 Adapted to interface changes 2024-04-13 16:43:35 +02:00
Andreas Horrer ac70a7808b Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-04-13 16:11:23 +02:00
Fredrik Öhrström a32fcfdf9a When generating IV for AES-CTR zero out H and R bit. 2024-04-13 13:42:25 +02:00
Fredrik Öhrström efcc41d107 Add support for GJ VIF. 2024-04-09 20:47:42 +02:00
Andreas Horrer b556cc1b02 Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-03-30 20:57:15 +01:00
Andreas Horrer c5ab867acd Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-03-14 21:01:05 +01:00
Andreas Horrer ac0f0d8243 Corrected method name 2024-03-02 21:07:02 +01:00
Andreas Horrer 879127ac8f Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-03-02 20:16:32 +01:00
Andreas Horrer ad3c9df8b3 Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-02-28 18:07:54 +01:00
Andreas Horrer 07b78b205e Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-02-03 19:37:01 +01:00
Andreas Horrer 086532373c corrected mfct of apator. Old version had 0x8614 als mfct because 'aPT' will result in 0x8614.
Changes in meters.cc will compensate for wrong mfct definition.
2024-01-18 21:00:11 +01:00
Andreas Horrer 0cd75bec8e restricted incoming mfct to correct range. Specifiation allows 3*5 bit => any mfct must be smaller than 32767. 2024-01-18 20:58:55 +01:00
Andreas Horrer f9c3fa4d64 Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-01-18 20:12:59 +01:00
Andreas Horrer a009f672db corrected indent 2024-01-14 20:07:31 +01:00
Andreas Horrer 7d4eda9623 Added test for heat-meter from itron where MFCT is iTW instead of ITW 2024-01-12 22:09:10 +01:00
Andreas Horrer 97715d7501 improved matching of mfct where first character is lower case 2024-01-12 22:08:14 +01:00
Andreas Horrer 86ba3bb304 Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2024-01-12 20:08:06 +01:00
Andreas Horrer 29b04f3365 added new field for last_year_date and last_year_energy_consumption 2024-01-01 19:47:22 +01:00
Andreas Horrer 176a8b0c4a Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2023-12-04 20:59:14 +01:00
Andreas Horrer ba19a1c6ea Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2023-11-19 20:22:38 +01:00
Andreas Horrer 00039bbdb8 Merge remote-tracking branch 'origin/master' into fb_add_itron_ultramaxx 2023-11-12 20:45:50 +01:00
Andreas Horrer 752fd2f1c6 replaced tab with space 2023-11-11 13:26:25 +01:00
Andreas Horrer 8fd98c2562 Added new driver for itron heatmeter ultramaxx 2023-11-11 13:20:20 +01:00
12 zmienionych plików z 159 dodań i 11 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
# Copyright (C) 2017-2023 Fredrik Öhrström (gpl-3.0-or-later)
# Copyright (C) 2017-2024 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

Wyświetl plik

@ -34,7 +34,7 @@ namespace
di.setDefaultFields("name,id,total_m3,timestamp");
di.setMeterType(MeterType::WaterMeter);
di.addLinkMode(LinkMode::T1);
di.addDetection(0x8614/*APT?*/, 0x03, 0x03);
di.addDetection(MANUFACTURER_APT, 0x03, 0x03);
di.usesProcessContent();
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new Driver(mi, di)); });
});

Wyświetl plik

@ -0,0 +1,122 @@
/*
Copyright (C) 2022 Fredrik Öhrström (gpl-3.0-or-later)
2023 Andreas Horrer (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("itronheat");
di.addNameAlias("ultramaxx");
di.setDefaultFields("name,id,status,total_energy_consumption_kwh,total_volume_m3,timestamp");
di.setMeterType(MeterType::HeatMeter);
di.addLinkMode(LinkMode::C1);
di.addDetection(MANUFACTURER_ITW, 0x04, 0x00);
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new Driver(mi, di)); });
});
Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
{
addOptionalLibraryFields("meter_datetime");
addStringFieldWithExtractorAndLookup(
"status",
"Meter status from error flags and tpl status field.",
DEFAULT_PRINT_PROPERTIES |
PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS,
FieldMatcher::build()
.set(MeasurementType::Instantaneous)
.set(VIFRange::ErrorFlags),
Translate::Lookup(
{
{
{
"ERROR_FLAGS",
Translate::MapType::BitToString,
AlwaysTrigger, MaskBits(0xffff),
"OK",
{
}
},
},
}));
addNumericFieldWithExtractor(
"total_energy_consumption",
"The total heat energy consumption recorded by this meter.",
DEFAULT_PRINT_PROPERTIES,
Quantity::Energy,
VifScaling::Auto, DifSignedness::Signed,
FieldMatcher::build()
.set(MeasurementType::Instantaneous)
.set(VIFRange::AnyEnergyVIF)
);
addNumericFieldWithExtractor(
"total_volume",
"The total heating media volume recorded by this meter.",
DEFAULT_PRINT_PROPERTIES,
Quantity::Volume,
VifScaling::Auto, DifSignedness::Signed,
FieldMatcher::build()
.set(MeasurementType::Instantaneous)
.set(VIFRange::Volume)
);
addStringFieldWithExtractor(
"last_year_date",
"Last day previous year when total energy consumption was recorded.",
DEFAULT_PRINT_PROPERTIES,
FieldMatcher::build()
.set(MeasurementType::Instantaneous)
.set(StorageNr(1))
.set(VIFRange::Date)
);
addNumericFieldWithExtractor(
"last_year_energy_consumption",
"The total energy consumption recorded at the last day of the previous year.",
DEFAULT_PRINT_PROPERTIES,
Quantity::Energy,
VifScaling::Auto, DifSignedness::Signed,
FieldMatcher::build()
.set(MeasurementType::Instantaneous)
.set(StorageNr(1))
.set(VIFRange::AnyEnergyVIF)
);
}
}
// Test: Heat itronheat 23340485 NOKEY
// Comment: Allmess UltraMaXX with ITRON EquaScan hMIU RF Module
// telegram=|444497268504342300047AD00030A52F2F_04062C0100000C1429270000066D2D130AE12B007406FEFEFEFE426C1F010D7FEB0E00000006040C995500372F2F0C7951622223|
// {"id":"23340485","media":"heat","meter":"itronheat","meter_datetime":"2023-11-01 10:19:45","name":"Heat","status":"OK","timestamp":"1111-11-11T11:11:11Z","total_energy_consumption_kwh":300,"total_volume_m3":27.29,"last_year_date":"2000-01-31"}
// |Heat;23340485;OK;300;27.29;1111-11-11 11:11.11
// Test: Heat_lower_case itronheat 11755757 NOKEY
// Comment: Itron Heatmeter with strange MFCT iTW instead of ITW
// telegram=|_404497A65757751100047A040000A00406494C0000041348318000066D2B0ED7EE2A0044069A360000426CDF2C0D7FEB0700000006040C5C7E034E0C7942502321|
// {"id":"11755757","media":"heat","meter":"itronheat","meter_datetime":"2023-10-14 23:14:43","name":"Heat_lower_case","status":"OK","timestamp":"1111-11-11T11:11:11Z","total_energy_consumption_kwh":19529,"total_volume_m3":8401.224,"last_year_date":"2022-12-31","last_year_energy_consumption_kwh": 13978}
// |Heat_lower_case;11755757;OK;19529;8401.224;1111-11-11 11:11.11

Wyświetl plik

@ -1,5 +1,5 @@
/*
Copyright (C) 2018-2022 Fredrik Öhrström (gpl-3.0-or-later)
Copyright (C) 2018-2024 Fredrik Öhrström (gpl-3.0-or-later)
Copyright (C) 2020 Eric Bus (gpl-3.0-or-later)
Copyright (C) 2022 thecem (gpl-3.0-or-later)
@ -354,3 +354,8 @@ namespace
// telegram=|68c9c96808e672323232322d2c35041900000004fB006083000004ff074006010004ff08299400000416984e010084401400000000848040140000000004225043000034221c0000000259c91f025d4f1102617a0e042e30020000142e65030000043c24050000143ce308000004ff2200000000046d2e2B0f3144fB00007d000044ff07Bdf9000044ff08308d00004416B73f0100c4401400000000c480401400000000542ed9020000543ce8090000426c013102ff1a011B0c783032858404ff16e5841e0004ff17c1d5B400a516|
// {"fabrication_no": "84853230", "flow_return_temperature_difference_c": 37.06, "forward_energy_m3c": 67136, "id": "32323232", "max_flow_m3h": 22.75, "max_power_kw": 869, "media": "heat", "meter": "kamheat", "meter_datetime": "2024-01-15 11:46", "name": "Kamstrup_MC603_mbus", "on_time_at_error_h": 28, "on_time_h": 17232, "power_kw": 560, "return_energy_m3c": 37929, "status": "OK", "t1_temperature_c": 81.37, "t2_temperature_c": 44.31, "target_date": "2024-01-01", "target_energy_kwh": 3200000, "target_volume_m3": 81847, "timestamp": "1111-11-11T11:11:11Z", "total_energy_consumption_kwh": 3363200, "total_volume_m3": 85656, "volume_flow_m3h": 13.16}
// |Kamstrup_MC603_mbus;32323232;3363200;85656;OK;1111-11-11 11:11.11
// Test: KMHEAT kamheat 85412440 NOKEY
// telegram=|5e442d2c4024418535047ae10050252f2f04fB091300000004167500000004ff2200000000043ca301000002599c1d025dB00e844014000000008480401400000000042eB9000000026c0534426c013444fB0900000000543c000000002f2f|
// {"id": "85412440","media": "heat","meter": "kamheat","meter_date": "2024-04-05","name": "KMHEAT","power_kw": 185,"status": "OK","t1_temperature_c": 75.8,"t2_temperature_c": 37.6,"target_date": "2024-04-01","target_energy_kwh": 0,"timestamp": "1111-11-11T11:11:11Z","total_energy_consumption_kwh": 5277.777778,"total_volume_m3": 117,"volume_flow_m3h": 4.19}
// |KMHEAT;85412440;5277.777778;117;OK;1111-11-11 11:11.11

Wyświetl plik

@ -1,5 +1,5 @@
/*
Copyright (C) 2021-2022 Fredrik Öhrström (gpl-3.0-or-later)
Copyright (C) 2021-2024 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
@ -34,6 +34,7 @@ namespace
di.addDetection(MANUFACTURER_LSE, 0x07, 0x18);
di.addDetection(MANUFACTURER_LSE, 0x07, 0x16);
di.addDetection(MANUFACTURER_LSE, 0x07, 0x17);
di.addDetection(MANUFACTURER_LSE, 0x07, 0xd8);
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new Driver(mi, di)); });
});
@ -207,3 +208,8 @@ namespace
// telegram=|2D4465329933961318067ADA000000_0C13567100004C1300000000426CFFFF02BB560000326CFFFF046D2307A12C|
// {"media":"warm water","meter":"lse_07_17","name":"Water","id":"13963399","total_m3":7.156,"due_date_m3":0,"due_date":"2127-15-31","what_date_m3":7,"what_date":"2021-11-30","error_code":"OK","error_date":"2127-15-31","device_date_time":"2021-12-01 07:35","meter_version":"11","timestamp":"1111-11-11T11:11:11Z"}
// |Water;13963399;7.156;0;2127-15-31;OK;2127-15-31;2021-12-01 07:35;1111-11-11 11:11.11
// Test: Water2 lse_07_17 09993623 NOKEY
// telegram=|2d44653223369909d8077a80000000046d130aed2B0c13233332004c1351762700426cdf2c326cffff02BB560000|
// {"device_date_time": "2023-11-13 10:19","due_date": "2022-12-31","due_date_m3": 277.651,"error_code": "OK","error_date": "2127-15-31","id": "09993623","media": "water","meter": "lse_07_17","name": "Water2","timestamp": "1111-11-11T11:11:11Z","total_m3": 323.323}
// |Water2;09993623;323.323;277.651;2022-12-31;OK;2127-15-31;2023-11-13 10:19;1111-11-11 11:11.11

Wyświetl plik

@ -1,5 +1,5 @@
/*
Copyright (C) 2018-2022 Fredrik Öhrström (gpl-3.0-or-later)
Copyright (C) 2018-2024 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
@ -135,7 +135,8 @@ bool isInsideVIFRange(Vif vif, VIFRange vif_range)
return
isInsideVIFRange(vif, VIFRange::EnergyWh) ||
isInsideVIFRange(vif, VIFRange::EnergyMJ) ||
isInsideVIFRange(vif, VIFRange::EnergyMWh);
isInsideVIFRange(vif, VIFRange::EnergyMWh) ||
isInsideVIFRange(vif, VIFRange::EnergyGJ);
}
if (vif_range == VIFRange::AnyPowerVIF)
{

Wyświetl plik

@ -1,5 +1,5 @@
/*
Copyright (C) 2018-2022 Fredrik Öhrström (gpl-3.0-or-later)
Copyright (C) 2018-2024 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
@ -48,6 +48,7 @@
X(FabricationNo,0x78,0x78, Quantity::Text, Unit::TXT) \
X(EnhancedIdentification,0x79,0x79, Quantity::Text, Unit::TXT) \
X(EnergyMWh,0x7B00,0x7B01, Quantity::Energy, Unit::KWH) \
X(EnergyGJ,0x7B09,0x7B0A, Quantity::Energy, Unit::MJ) \
X(RelativeHumidity,0x7B1A,0x7B1B, Quantity::RH, Unit::RH) \
X(AccessNumber,0x7D08,0x7D08, Quantity::Counter, Unit::COUNTER) \
X(Medium,0x7D09,0x7D09, Quantity::Text, Unit::TXT) \

Wyświetl plik

@ -112,7 +112,9 @@ bool DriverInfo::detect(uint16_t mfct, uchar type, uchar version)
for (auto &dd : detect_)
{
if (dd.mfct == 0 && dd.type == 0 && dd.version == 0) continue; // Ignore drivers with no detection.
if (dd.mfct == mfct && dd.type == type && dd.version == version) return true;
//some meters send mfct where the first character ist lower case, which results in mfct which are bigger
//than 32767, therefore restrict mfct to correct range
if (dd.mfct == (mfct & 0x7fff) && dd.type == type && dd.version == version) return true;
}
return false;
}

Wyświetl plik

@ -1,5 +1,5 @@
/*
Copyright (C) 2017-2023 Fredrik Öhrström (gpl-3.0-or-later)
Copyright (C) 2017-2024 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
@ -2818,6 +2818,12 @@ double vifScale(int vif)
case 0x7b00:
case 0x7b01: { double exp = (vif & 0x1)+2; return pow(10.0, -exp); }
// Active energy 0.1 or 1 GJ normalize to 100 MJ or 1000 MJ
// 7b09 19 -> 1.9 G -> 1 900 KWh
// 7b0A 19 -> 19 GJ -> 19 000 MJ
case 0x7b09:
case 0x7b0A: { double exp = (vif & 0x1)+2; return pow(10.0, -exp); }
// relative humidity is a dimensionless value.
case 0x7b1a: return 10.0; // Relative humidity 0.1 %
case 0x7b1b: return 1.0; // Relative humidity 1 %

Wyświetl plik

@ -331,6 +331,7 @@ FrameStatus WMBusCUL::checkCULFrame(vector<uchar> &data,
string s = safeString(hex_buffer);
debug("(cul) bad hex for LQI and RSSI \"%s\"\n", s.c_str());
warning("(cul) warning: the LQI and RSSI hex string is not properly formatted!\n");
return ErrorInFrame;
}
// LQI is 7 bits unsigned number and relative - range 0-127 lower is better
uint lqi = lqi_rssi[0]>>1;

Wyświetl plik

@ -1,5 +1,5 @@
/*
Copyright (C) 2018-2020 Fredrik Öhrström (gpl-3.0-or-later)
Copyright (C) 2018-2024 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
@ -39,7 +39,10 @@ bool decrypt_ELL_AES_CTR(Telegram *t, vector<uchar> &frame, vector<uchar>::itera
// A-field
for (int j=0; j<6; ++j) { iv[i++] = t->dll_a[j]; }
// CC-field
iv[i++] = t->ell_cc;
// Two bits should be zeroed out:
// 0x10 H-field Hop-count set when telegram is repeated
// 0x02 R-field Repeated access field
iv[i++] = t->ell_cc & ~(0x10) & ~(0x02);
// SN-field
for (int j=0; j<4; ++j) { iv[i++] = t->ell_sn_b[j]; }
// FN

Wyświetl plik

@ -447,6 +447,7 @@ ActualityDuration
FabricationNo
EnhancedIdentification
EnergyMWh
EnergyGJ
RelativeHumidity
AccessNumber
Medium