kopia lustrzana https://github.com/weetmuts/wmbusmeters
Add driver for electricity meter Nemo
rodzic
231826ac22
commit
24153e2641
|
@ -534,9 +534,9 @@ As meter quadruples you specify:
|
|||
Supported wmbus dongles:
|
||||
IMST 871a (im871a)
|
||||
Amber 8465-M/8665-M/8626-M/Metis-II (amb8465) 868MHz
|
||||
Amber 3665-M (amb3665) 169MHz
|
||||
Amber 3665-M (amb3665) 169MHz
|
||||
CUL family (cul)
|
||||
Radiocraft (RC1180)
|
||||
Radiocraft (rc1180)
|
||||
rtl_wmbus (rtlwmbus)
|
||||
rtl_433 (rtl433)
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace
|
|||
"alarm",
|
||||
"Number of times the smoke alarm has triggered.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
@ -144,7 +144,7 @@ namespace
|
|||
"removed",
|
||||
"Number of times the smoke alarm has been removed.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
@ -168,7 +168,7 @@ namespace
|
|||
"test_button",
|
||||
"Number of times the test button has been pressed.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace
|
|||
"alfa",
|
||||
"We do not know what this is.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(DifVifKey("05FF09"))
|
||||
|
@ -108,7 +108,7 @@ namespace
|
|||
"beta",
|
||||
"We do not know what this is.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(DifVifKey("05FF0A"))
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace
|
|||
"a",
|
||||
"How many times the door/window has been opened or closed.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
@ -78,7 +78,7 @@ namespace
|
|||
"b",
|
||||
"The current number of counted pulses from counter b.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace
|
|||
"a",
|
||||
"The current number of counted pulses from counter a.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(DifVifKey("0EFD3A"))
|
||||
|
@ -69,7 +69,7 @@ namespace
|
|||
"b",
|
||||
"The current number of counted pulses from counter b.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(DifVifKey("8E40FD3A"))
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace
|
|||
"async_msg_id",
|
||||
"Unique asynchronous message number.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
@ -79,7 +79,7 @@ namespace
|
|||
"minutes_since_last_manual_test",
|
||||
"Minutes since last manual test.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
|
|
@ -0,0 +1,459 @@
|
|||
/*
|
||||
Copyright (C) 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 <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("nemo");
|
||||
di.setDefaultFields(
|
||||
"name,id,status,"
|
||||
"total_active_positive_3phase_kwh,"
|
||||
"active_positive_3phase_kw,"
|
||||
"timestamp");
|
||||
di.setMeterType(MeterType::ElectricityMeter);
|
||||
di.addLinkMode(LinkMode::MBUS);
|
||||
di.addDetection(MANUFACTURER_IME, 0x02, 0x1d);
|
||||
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new Driver(mi, di)); });
|
||||
});
|
||||
|
||||
// Telegram 1 /////////////////////////////////////////////////////////////////////
|
||||
|
||||
Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||
{
|
||||
addNumericFieldWithExtractor(
|
||||
"total_active_positive_3phase",
|
||||
"Et+ the total 3-phase active positive energy.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Energy,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyEnergyVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(1))
|
||||
.set(SubUnitNr(1))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"active_positive_3phase",
|
||||
"P+ the 3-phase active positive power.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(1))
|
||||
.set(SubUnitNr(1))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"total_reactive_positive_3phase",
|
||||
"Er+ the total 3-phase reactive positive energy.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Energy,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyEnergyVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(1))
|
||||
.set(SubUnitNr(2))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"reactive_positive_3phase",
|
||||
"Q+ the 3-phase reactive positive power.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(1))
|
||||
.set(SubUnitNr(2))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"total_active_partial_3phase",
|
||||
"Part Et+ the total 3-phase active partial energy.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Energy,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyEnergyVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(2))
|
||||
.set(SubUnitNr(1))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"active_negative_3phase",
|
||||
"P- the 3-phase active negative power.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(2))
|
||||
.set(SubUnitNr(1))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"total_reactive_partial_3phase",
|
||||
"Part Er+ the total 3-phase reactive partial energy.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Energy,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyEnergyVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(2))
|
||||
.set(SubUnitNr(2))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"reactive_negative_3phase",
|
||||
"Q- the 3-phase reactive negative power.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(StorageNr(0))
|
||||
.set(TariffNr(2))
|
||||
.set(SubUnitNr(2))
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"power",
|
||||
"PF the power factor.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Dimensionless),
|
||||
Unit::FACTOR
|
||||
);
|
||||
|
||||
addStringFieldWithExtractorAndLookup(
|
||||
"status",
|
||||
"Status. OK if no error flags are set.",
|
||||
PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::ErrorFlags),
|
||||
Translate::Lookup()
|
||||
.add(Translate::Rule("ERROR_FLAGS", Translate::Type::BitToString)
|
||||
.set(MaskBits(0xff))
|
||||
.set(DefaultMessage("OK"))
|
||||
));
|
||||
|
||||
// Telegram 2 /////////////////////////////////////////////////////////////
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"current_at_phase_1",
|
||||
"I1 Amperage for L1 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Amperage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Amperage)
|
||||
.add(VIFCombinable::Mfct01)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"current_at_phase_2",
|
||||
"I2 Amperage for L2 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Amperage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Amperage)
|
||||
.add(VIFCombinable::Mfct02)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"current_at_phase_3",
|
||||
"I3 Amperage for L3 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Amperage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Amperage)
|
||||
.add(VIFCombinable::Mfct03)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"voltage_at_phase_1",
|
||||
"L1-N Voltage for L1 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Voltage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Voltage)
|
||||
.add(VIFCombinable::Mfct01)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"voltage_at_phase_2",
|
||||
"L2-N Voltagefor L2 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Voltage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Voltage)
|
||||
.add(VIFCombinable::Mfct02)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"voltage_at_phase_3",
|
||||
"L3-N Voltage for L3 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Voltage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Voltage)
|
||||
.add(VIFCombinable::Mfct03)
|
||||
);
|
||||
|
||||
// Telegram 3 /////////////////////////////////////////////////////////////
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"active_power_at_phase_1",
|
||||
"P1 Power for L1 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(SubUnitNr(1))
|
||||
.add(VIFCombinable::Mfct01)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"active_power_at_phase_2",
|
||||
"P2 Power for L2 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(SubUnitNr(1))
|
||||
.add(VIFCombinable::Mfct02)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"active_power_at_phase_3",
|
||||
"P3 Power for L3 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(SubUnitNr(1))
|
||||
.add(VIFCombinable::Mfct03)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"reactive_power_at_phase_1",
|
||||
"Q1 Power for L1 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(SubUnitNr(2))
|
||||
.add(VIFCombinable::Mfct01)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"reactive_power_at_phase_2",
|
||||
"Q2 Power for L2 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(SubUnitNr(2))
|
||||
.add(VIFCombinable::Mfct02)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"reactive_power_at_phase_3",
|
||||
"Q3 Power for L3 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Power,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::AnyPowerVIF)
|
||||
.set(SubUnitNr(2))
|
||||
.add(VIFCombinable::Mfct03)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"at_phase_1_power",
|
||||
"PF1 the power factor for L1 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Dimensionless)
|
||||
.add(VIFCombinable::Mfct01),
|
||||
Unit::FACTOR
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"at_phase_2_power",
|
||||
"PF2 the power factor for L2 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Dimensionless)
|
||||
.add(VIFCombinable::Mfct02),
|
||||
Unit::FACTOR
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"at_phase_3_power",
|
||||
"PF3 the power factor for L3 phase.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Dimensionless)
|
||||
.add(VIFCombinable::Mfct03),
|
||||
Unit::FACTOR
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"voltage_l1_l2",
|
||||
"L1-L2 Voltage between phases.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Voltage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Voltage)
|
||||
.add(VIFCombinable::Mfct04)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"voltage_l2_l3",
|
||||
"L2-L3 Voltage between phases.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Voltage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Voltage)
|
||||
.add(VIFCombinable::Mfct05)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"voltage_l3_l1",
|
||||
"L3-L1 Voltage between phases.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Voltage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Voltage)
|
||||
.add(VIFCombinable::Mfct06)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"current_in_neutral",
|
||||
"I Neutral amperage.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Amperage,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Amperage)
|
||||
.add(VIFCombinable::Mfct04)
|
||||
);
|
||||
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"raw_frequency",
|
||||
"Frequency in 0.1 Hz",
|
||||
DEFAULT_PRINT_PROPERTIES | PrintProperty::HIDE,
|
||||
Quantity::Frequency,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(DifVifKey("05FF5A"))
|
||||
);
|
||||
|
||||
addNumericFieldWithCalculator(
|
||||
"frequency",
|
||||
"Frequency of AC.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Frequency,
|
||||
"raw_frequency_hz / 10 counter");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Test: Elen nemo 00067609 NOKEY
|
||||
// comment: Telegram 1
|
||||
// telegram=|6864646808657209760600A5251D02000000008E500400355873060085502B0013BF478E9040040029452501008590402B00F800468E600400000000000085602B000000008EA0400400890000000085A0402B0000000005FD3ADCF97E3F01FD17001F00000000009116|
|
||||
// {"media":"electricity", "meter":"nemo", "name":"Elen", "id":"00067609", "total_active_positive_3phase_kwh":6735835, "active_positive_3phase_kw":97.83, "total_reactive_positive_3phase_kwh":1254529, "reactive_positive_3phase_kw":8.254, "total_active_partial_3phase_kwh":0, "active_negative_3phase_kw":0, "total_reactive_partial_3phase_kwh":89, "reactive_negative_3phase_kw":0, "power_factor":-0.996, "status":"OK", "frequency_hz":null, "timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Elen;00067609;OK;6735835;97.83;1111-11-11 11:11.11
|
||||
|
||||
// comment: Telegram 2
|
||||
// telegram=|684B4B6808657209760600A5251D020100000005FDD9FF0100F4174805FDD9FF0200B8084805FDD9FF0300B0014805FDC8FF0100C0104505FDC8FF020040114505FDC8FF03005011451F00000000000716|
|
||||
// {"media":"electricity", "meter":"nemo", "name":"Elen", "id":"00067609", "total_active_positive_3phase_kwh":6735835, "active_positive_3phase_kw":97.83, "total_reactive_positive_3phase_kwh":1254529, "reactive_positive_3phase_kw":8.254, "total_active_partial_3phase_kwh":0, "active_negative_3phase_kw":0, "total_reactive_partial_3phase_kwh":89, "reactive_negative_3phase_kw":0, "power_factor":-0.996, "status":"OK", "current_at_phase_1_a":155.6, "current_at_phase_2_a":140, "current_at_phase_3_a":132.8, "voltage_at_phase_1_v":231.6, "voltage_at_phase_2_v":232.4, "voltage_at_phase_3_v":232.5, "frequency_hz":null, "timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Elen;00067609;OK;6735835;97.83;1111-11-11 11:11.11
|
||||
|
||||
// comment: Telegram 3
|
||||
// telegram=|689E9E6808657209760600A5251D02020000008540ABFF0100360B478540ABFF02002CFA468540ABFF030074ED46858040ABFF0100C0E244858040ABFF0200405A45858040ABFF030060364505FDBAFF0178BE7F3F05FDBAFF0240357E3F05FDBAFF0353B87E3F05FDC8FF0400907A4505FDC8FF0500707B4505FDC8FF0600807B4505FDD9FF0400502A4705FF5A0000FA4302FD3AC80002FD3A0A000F00000000008B16|
|
||||
// {"media":"electricity", "meter":"nemo", "name":"Elen", "id":"00067609", "total_active_positive_3phase_kwh":6735835, "active_positive_3phase_kw":97.83, "total_reactive_positive_3phase_kwh":1254529, "reactive_positive_3phase_kw":8.254, "total_active_partial_3phase_kwh":0, "active_negative_3phase_kw":0, "total_reactive_partial_3phase_kwh":89, "reactive_negative_3phase_kw":0, "power_factor":-200, "status":"OK", "current_at_phase_1_a":155.6, "current_at_phase_2_a":140, "current_at_phase_3_a":132.8, "voltage_at_phase_1_v":231.6, "voltage_at_phase_2_v":232.4, "voltage_at_phase_3_v":232.5, "active_power_at_phase_1_kw":35.638, "active_power_at_phase_2_kw":32.022, "active_power_at_phase_3_kw":30.394, "reactive_power_at_phase_1_kw":1.814, "reactive_power_at_phase_2_kw":3.492, "reactive_power_at_phase_3_kw":2.918, "at_phase_1_power_factor":-0.999, "at_phase_2_power_factor":-0.993, "at_phase_3_power_factor":-0.995, "voltage_l1_l2_v":400.9, "voltage_l2_l3_v":402.3, "voltage_l3_l1_v":402.4, "current_in_neutral_a":43.6, "frequency_hz":50, "timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Elen;00067609;OK;6735835;97.83;1111-11-11 11:11.11
|
|
@ -72,7 +72,7 @@ namespace
|
|||
"alarm",
|
||||
"Number of times the smoke alarm has triggered.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(DifVifKey("81037C034C4123"))
|
||||
|
@ -101,7 +101,7 @@ namespace
|
|||
"test_button",
|
||||
"Number of times the test button has been pressed.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(DifVifKey("81027C03495523"))
|
||||
|
@ -111,7 +111,7 @@ namespace
|
|||
"transmission",
|
||||
"Transmission counter?",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
|
|
@ -316,6 +316,8 @@ bool parseDV(Telegram *t,
|
|||
uchar vif = **format;
|
||||
int full_vif = vif & 0x7f;
|
||||
bool extension_vif = false;
|
||||
int combinable_full_vif = 0;
|
||||
bool combinable_extension_vif = false;
|
||||
set<VIFCombinable> found_combinable_vifs;
|
||||
|
||||
DEBUG_PARSER("(dvparser debug) vif=%04x \"%s\"\n", vif, vifType(vif).c_str());
|
||||
|
@ -398,13 +400,44 @@ bool parseDV(Telegram *t,
|
|||
}
|
||||
else
|
||||
{
|
||||
// If the full vif is now handled, then the rest are combinable vifs.
|
||||
VIFCombinable vc = toVIFCombinable(vife & 0x7f);
|
||||
found_combinable_vifs.insert(vc);
|
||||
if (data_has_difvifs)
|
||||
if (combinable_extension_vif)
|
||||
{
|
||||
t->addExplanationAndIncrementPos(*format, 1, KindOfData::PROTOCOL, Understanding::FULL,
|
||||
"%02X combinable vif (%s)", vife, toString(vc));
|
||||
// First vife after the combinable extension marker is the real vif.
|
||||
combinable_full_vif |= (vife & 0x7f);
|
||||
combinable_extension_vif = false;
|
||||
VIFCombinable vc = toVIFCombinable(combinable_full_vif);
|
||||
found_combinable_vifs.insert(vc);
|
||||
if (data_has_difvifs)
|
||||
{
|
||||
t->addExplanationAndIncrementPos(*format, 1, KindOfData::PROTOCOL, Understanding::FULL,
|
||||
"%02X combinable extension vife", vife);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
combinable_full_vif = vife & 0x7f;
|
||||
// Check if this is marker for one of the extended combinable vifs
|
||||
if (combinable_full_vif == 0x7c || combinable_full_vif == 0x7f)
|
||||
{
|
||||
combinable_full_vif <<= 8;
|
||||
combinable_extension_vif = true;
|
||||
VIFCombinable vc = toVIFCombinable(vife & 0x7f);
|
||||
if (data_has_difvifs)
|
||||
{
|
||||
t->addExplanationAndIncrementPos(*format, 1, KindOfData::PROTOCOL, Understanding::FULL,
|
||||
"%02X combinable vif (%s)", vife, toString(vc));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VIFCombinable vc = toVIFCombinable(combinable_full_vif);
|
||||
found_combinable_vifs.insert(vc);
|
||||
if (data_has_difvifs)
|
||||
{
|
||||
t->addExplanationAndIncrementPos(*format, 1, KindOfData::PROTOCOL, Understanding::FULL,
|
||||
"%02X combinable vif (%s)", vife, toString(vc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,7 +174,14 @@ bool isInsideVIFRange(int i, VIFRange range);
|
|||
X(AccumulationOfAbsoluteValue,0x7c10,0x7c10) \
|
||||
X(DataPresentedWithTypeC,0x7c11,0x7c11) \
|
||||
X(DataPresentedWithTypeD,0x7c12,0x7c12) \
|
||||
|
||||
X(Mfct00,0x7f00,0x7f00) \
|
||||
X(Mfct01,0x7f01,0x7f01) \
|
||||
X(Mfct02,0x7f02,0x7f02) \
|
||||
X(Mfct03,0x7f03,0x7f03) \
|
||||
X(Mfct04,0x7f04,0x7f04) \
|
||||
X(Mfct05,0x7f05,0x7f05) \
|
||||
X(Mfct06,0x7f06,0x7f06) \
|
||||
X(Mfct07,0x7f07,0x7f07) \
|
||||
|
||||
enum class VIFCombinable
|
||||
{
|
||||
|
|
|
@ -2825,7 +2825,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names)
|
|||
"access",
|
||||
"Meter access counter.",
|
||||
DEFAULT_PRINT_PROPERTIES,
|
||||
Quantity::Counter,
|
||||
Quantity::Dimensionless,
|
||||
VifScaling::None,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
|
|
|
@ -2018,13 +2018,14 @@ LIST_OF_QUANTITIES
|
|||
// Test counter: counter
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
q_set.erase(Quantity::Counter);
|
||||
fill_with_units_from(Quantity::Counter, &from_set);
|
||||
fill_with_units_from(Quantity::Counter, &to_set);
|
||||
q_set.erase(Quantity::Dimensionless);
|
||||
fill_with_units_from(Quantity::Dimensionless, &from_set);
|
||||
fill_with_units_from(Quantity::Dimensionless, &to_set);
|
||||
|
||||
test_si_convert(2211717, 2211717, Unit::COUNTER, "counter", Unit::COUNTER, "counter", Quantity::Counter, &from_set, &to_set);
|
||||
test_si_convert(2211717, 2211717, Unit::COUNTER, "counter", Unit::FACTOR, "counter", Quantity::Dimensionless, &from_set, &to_set);
|
||||
test_si_convert(2211717, 2211717, Unit::FACTOR, "counter", Unit::COUNTER, "counter", Quantity::Dimensionless, &from_set, &to_set);
|
||||
|
||||
check_units_tested(from_set, to_set, Quantity::Counter);
|
||||
check_units_tested(from_set, to_set, Quantity::Dimensionless);
|
||||
|
||||
// Test point in time units: ut utc lt
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -57,6 +57,8 @@ using namespace std;
|
|||
X(F, C, {vto=(vfrom-32)*5.0/9.0;}) \
|
||||
X(PA, BAR,{vto=vfrom/100000.0;}) \
|
||||
X(BAR, PA, {vto=vfrom*100000.0;}) \
|
||||
X(COUNTER, FACTOR,{vto=vfrom;}) \
|
||||
X(FACTOR, COUNTER, {vto=vfrom;}) \
|
||||
X(UnixTimestamp,DateTimeLT, {vto=vfrom; }) \
|
||||
X(DateTimeLT,UnixTimestamp, {vto=vfrom; }) \
|
||||
X(DateLT,UnixTimestamp, {vto=vfrom; }) \
|
||||
|
@ -110,6 +112,7 @@ using namespace std;
|
|||
X(RH, 1.0, SIExp()) \
|
||||
X(HCA, 1.0, SIExp()) \
|
||||
X(COUNTER, 1.0, SIExp()) \
|
||||
X(FACTOR, 1.0, SIExp()) \
|
||||
X(TXT, 1.0, SIExp()) \
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
X(RelativeHumidity,RH) \
|
||||
X(HCA,HCA) \
|
||||
X(Text,TXT) \
|
||||
X(Counter,COUNTER) \
|
||||
X(Dimensionless,COUNTER) \
|
||||
|
||||
enum class Quantity
|
||||
{
|
||||
|
@ -114,7 +114,8 @@ LIST_OF_QUANTITIES
|
|||
X(RH,rh,"RH",RelativeHumidity,"relative humidity") \
|
||||
X(HCA,hca,"hca",HCA,"heat cost allocation") \
|
||||
X(TXT,txt,"txt",Text,"text") \
|
||||
X(COUNTER,counter,"counter",Counter,"counter") \
|
||||
X(COUNTER,counter,"counter",Dimensionless,"counter") \
|
||||
X(FACTOR,factor,"factor",Dimensionless,"factor") \
|
||||
|
||||
enum class Unit
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Usage: $0 [password] [kem_file]"
|
||||
echo "Usage: $0 [password] [kem(2)_file]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -14,6 +14,7 @@ then
|
|||
mkdir temp_extracting_kem
|
||||
unzip -d temp_extracting_kem "$file"
|
||||
file=$(echo temp_extracting_kem/*.kem)
|
||||
if [ ! -f "$file" ]; then file=$(echo temp_extracting_kem/*.kem2) ; fi
|
||||
echo "Extracting from $file"
|
||||
echo
|
||||
fi
|
||||
|
@ -23,11 +24,13 @@ fi
|
|||
key=$(echo -n "$password" | xxd -p)
|
||||
key=$(printf "%-32s" "$key" | tr ' ' '0')
|
||||
|
||||
echo "KEY=>$key<"
|
||||
xml=$(cat "$file")
|
||||
|
||||
# Extract the Base64-encoded ciphertext from the XML
|
||||
b64=$(echo "$xml" | sed -n 's/.*<CipherValue>\(.*\)<\/CipherValue>.*/\1/p')
|
||||
b64=$(echo "$xml" | sed -n 's/.*<CipherValue>\(.*\)<\/CipherValue>.*/\1/p' > gurka)
|
||||
|
||||
echo BASE64="$b64"
|
||||
# Decrypt the ciphertext using the key and IV
|
||||
plain=$(echo "$b64" | base64 -d | openssl enc -aes-128-cbc -d -K "$key" -iv "$key" -nopad)
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue