Format change in xmq drivers. Fields must be inside a fields block and use must be inside a library block. Backwards incompatible change!

pull/1387/head
Fredrik Öhrström 2024-09-29 09:52:26 +02:00
rodzic 1571e2b52f
commit 6537d1b1e6
22 zmienionych plików z 2090 dodań i 2015 usunięć

Wyświetl plik

@ -55,14 +55,6 @@ Then, `docker-compose pull` can be used to pull the latest wmbusmeters/wmbusmete
If security is of concern - it is also possible to run docker container without privileged mode with non-RTLSDR dongles. For RTLSDR symlink passing to docker image is not working due to the fact that rtl_ binaries are looking for a full usb bus path in the system to identify device.
Before running the command that creates the wmbusmeters docker container, udev rules must be added to create usb device symlink in order to have persistent link to device across host restarts and reconnects of usb device:
```
cat <<EOF > /etc/udev/rules.d/99-wmbus-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="im871a", MODE="0660", GROUP="docker"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="amb8465", MODE="0660", GROUP="docker"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2047", ATTRS{idProduct}=="0863", SYMLINK+="rfmrx2", MODE="0660", GROUP="docker"
EOF
```
### Command line for container download and run
@ -72,7 +64,7 @@ docker run -d \
--restart=always \
-v /etc/localtime:/etc/localtime:ro \
-v /opt/wmbusmeters:/wmbusmeters_data \
--device=/dev/im871a \
--device=/dev/ttyUSB0 \
wmbusmeters/wmbusmeters
```

Wyświetl plik

@ -14,7 +14,7 @@ web:
tests:
@echo -n "// Generated " > build/generated_tests.xmq
@date +%Y-%m-%d_%H:%M >> build/generated_tests.xmq
@for i in $(wildcard src/*) ; do xmq $$i select /driver/test to-xmq >> build/generated_tests.xmq; done
@for i in $(wildcard src/*) ; do xmq $$i select /driver/tests/test to-xmq >> build/generated_tests.xmq; done
install: database tests
@grep -v "// Generated " < build/generated_database.cc > build/a
@ -26,6 +26,9 @@ install: database tests
@if ! diff build/a build/b ; then \
cp build/generated_tests.xmq ../tests/generated_tests.xmq ; echo "Installed tests." ; else echo "No changes test." ; fi
pretty:
@for i in $(wildcard src/*.xmq) ; do xmq $$i > tmp ; mv tmp $$i ; done
test:
@for i in $(wildcard src/*) ; do ./test.sh $(PROG) $$i ; done

Wyświetl plik

@ -33,7 +33,7 @@ for i in src/*.xmq
do
NAME=$(basename $i)
NAME="${NAME%.*}"
CONTENT="$(xmq $i delete /driver/test delete "//comment()" to-xmq --compact | sed 's/"/\\"/g')"
CONTENT="$(xmq $i delete /driver/tests/test delete "//comment()" to-xmq --compact | sed 's/"/\\"/g')"
cat >>$OUT <<EOF
{ "$NAME", "$CONTENT", false },
EOF

Wyświetl plik

@ -6,7 +6,10 @@ driver {
detect {
mvt = IMT,01,07
}
library {
use = total_m3,meter_datetime,target_m3,target_date
}
fields {
field {
name = status
quantity = Text
@ -35,13 +38,13 @@ driver {
}
map {
name = LEAKAGE
info = 'Leakage'
info = Leakage
value = 0x20
test = Set
}
map {
name = BURST
info = 'Burst'
info = Burst
value = 0x30
test = Set
}
@ -67,10 +70,13 @@ driver {
difvifkey = 02FD74
}
}
}
tests {
test {
args = 'AqWater aquastream 05933237 NOKEY'
telegram = 4644B42557920410050E7237329305B42501075B0030252F2F_04130342000084101300000000046D0D30F62B441349180000426CFF2A02FD17000002FD74DB152F2F2F2F2F2F2F
json = '{"id": "05933237","media": "water","meter": "aquastream","meter_datetime": "2023-11-22 16:13","name": "AqWater","status": "OK","target_date": "2023-10-31","target_m3": 6.217,"timestamp": "1111-11-11T11:11:11Z","total_m3": 16.899,"total_tariff1_m3": 0,"battery_y": 15.328767}'
fields = 'AqWater;05933237;16.899;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -6,9 +6,12 @@ driver {
detect {
mvt = APA,42,04
}
library {
use = fabrication_no
use = on_time_h
use = on_time_at_error_h
}
fields {
field {
name = meter
quantity = PointInTime
@ -190,10 +193,13 @@ driver {
}
}
}
}
tests {
test {
args = 'Heato elf2 23170428 NOKEY'
telegram = 684E4E68080172280417230106420455000000_0C7828041723026C103902FD1700000E0A6342693401000C13634630000A3B00000A2D00000A5A49020A5E44020C22762101003C2215000000047E17090000_4116
json = '{"current_power_kw": 0,"current_volume_flow_m3h": 0,"fabrication_no": "23170428","id": "23170428","media": "heat","meter": "elf2","meter_date": "2024-09-16","name": "Heato","on_time_at_error_h": 15,"on_time_h": 12176,"status": "OK","t1_temperature_c": 24.9,"t2_temperature_c": 24.4,"timestamp": "1111-11-11T11:11:11Z","total_energy_kwh": 3741.507306,"total_volume_m3": 304.663}'
fields = 'Heato;23170428;OK;3741.507306;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -6,7 +6,10 @@ driver {
detect {
mvt = ELS,81,03
}
library {
use = actuality_duration_s
}
fields {
field {
name = total
quantity = Volume
@ -16,10 +19,13 @@ driver {
vif_range = Volume
}
}
}
tests {
test {
args = 'Gas elster 05105025 NOKEY'
telegram = 3644A511640010253837722550100593158103E70020052F2F_0374E602000C137034220302FD74EE0F2F2F2F2F2F2F2F2F2F2F2F2F2F2F
json = '{"media":"gas","meter":"elster","name":"Gas","id":"05105025","actuality_duration_s":742,"total_m3":3223.47,"timestamp":"1111-11-11T11:11:11Z"}'
fields = 'Gas;05105025;3223.47;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -6,6 +6,7 @@ driver {
detect {
mvt = ELT,01,02
}
fields {
field {
name = status
quantity = Text
@ -52,7 +53,7 @@ driver {
}
}
field {
name = 'total_tariff_1'
name = total_tariff_1
quantity = Energy
info = 'Total cumulative active energy per tariff.'
match {
@ -63,7 +64,7 @@ driver {
}
}
field {
name = 'total_tariff_2'
name = total_tariff_2
quantity = Energy
info = 'Total cumulative active energy per tariff.'
match {
@ -262,15 +263,18 @@ driver {
}
}
field {
name = 'total'
name = total
quantity = Energy
info = 'Total active energy over all tariffs.'
calculate = total_tariff_1_kwh+total_tariff_2_kwh
}
}
tests {
test {
args = 'Eltako eltako 23451236 NOKEY'
telegram = 689292680800723612452394150102cd0000008c1004688902008c1104688902008c2004000000008c21040000000002fdc9ff01ee0002fddBff01100002acff0120008240acff010a0002fdc9ff02ef0002fddBff02110002acff0224008240acff02070002fdc9ff03ee0002fddBff030e0002acff031c008240acff03060002ff68010002acff0062008240acff00190001ff1300f416
json = '{"active_power_overall_kw": 0.98,"active_tariff_counter": 0,"ct_numerator_counter": 1,"current_l1_a": 1.6,"current_l2_a": 1.7,"current_l3_a": 1.4,"id": "23451236","media": "electricity","meter": "eltako","name": "Eltako","power_l1_kw": 0.32,"power_l2_kw": 0.36,"power_l3_kw": 0.28,"reactive_power_l1_kw": 0.1,"reactive_power_l2_kw": 0.07,"reactive_power_l3_kw": 0.06,"reactive_power_overall_kw": 0.25,"timestamp": "1111-11-11T11:11:11Z","total_kwh": 289.68,"total_reactive_tariff_1_kwh": 289.68,"total_reactive_tariff_2_kwh": 0,"total_tariff_1_kwh": 289.68,"total_tariff_2_kwh": 0,"voltage_l1_n_v": 238,"voltage_l2_n_v": 239,"voltage_l3_n_v": 238}'
fields = 'Eltako;23451236;289.68;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -4,8 +4,7 @@
Do not use or buy it! The meter implements its own scaling system for
all Note 1 values (like positive_total_active_energy)
If you are lucky you will get zeroes when the scale factor is unknown.
If you are unlucky you will get brokenly scaled values.
*/
If you are unlucky you will get brokenly scaled values. */
driver {
name = ime
info = 'This meter uses a seriously bonkers violation of the wmbus protocol. Avoid at all cost!'
@ -14,17 +13,16 @@ driver {
detect {
mvt = IME,66,02
}
fields {
field {
name = status
quantity = Text
info = 'Meter status from tpl field.'
attributes = INCLUDE_TPL_STATUS
}
// Telegram 1 fields
field {
name = 'positive_total_active_energy'
name = positive_total_active_energy
quantity = Energy
info = 'Positive Three-phase Active Energy (Total).'
vif_scaling = None
@ -36,7 +34,7 @@ driver {
}
}
field {
name = 'negative_total_active_energy'
name = negative_total_active_energy
quantity = Energy
info = 'Negative Three-phase Active Energy (Total).'
vif_scaling = None
@ -48,7 +46,7 @@ driver {
}
}
field {
name = 'positive_total_reactive_energy'
name = positive_total_reactive_energy
quantity = Energy
info = 'Positive Three-phase Reactive Energy (Total).'
vif_scaling = None
@ -60,7 +58,7 @@ driver {
}
}
field {
name = 'negative_total_reactive_energy'
name = negative_total_reactive_energy
quantity = Energy
info = 'Negative Three-phase Reactive Energy (Total).'
vif_scaling = None
@ -72,7 +70,7 @@ driver {
}
}
field {
name = 'positive_tariff1_active_energy'
name = positive_tariff1_active_energy
quantity = Energy
info = 'Positive Three-phase Active Energy (Tariff 1).'
vif_scaling = None
@ -84,7 +82,7 @@ driver {
}
}
field {
name = 'positive_tariff2_active_energy'
name = positive_tariff2_active_energy
quantity = Energy
info = 'Positive Three-phase Active Energy (Tariff 2).'
vif_scaling = None
@ -96,7 +94,7 @@ driver {
}
}
field {
name = 'negative_tariff1_active_energy'
name = negative_tariff1_active_energy
quantity = Energy
info = 'Negative Three-phase Active Energy (Tariff 1).'
vif_scaling = None
@ -108,7 +106,7 @@ driver {
}
}
field {
name = 'negative_tariff2_active_energy'
name = negative_tariff2_active_energy
quantity = Energy
info = 'Negative Three-phase Active Energy (Tariff 2).'
vif_scaling = None
@ -120,7 +118,7 @@ driver {
}
}
field {
name = 'positive_tariff1_reactive_energy'
name = positive_tariff1_reactive_energy
quantity = Energy
info = 'Positive Three-phase Reactive Energy (Tariff 1).'
vif_scaling = None
@ -132,7 +130,7 @@ driver {
}
}
field {
name = 'positive_tariff2_reactive_energy'
name = positive_tariff2_reactive_energy
quantity = Energy
info = 'Positive Three-phase Reactive Energy (Tariff 2).'
vif_scaling = None
@ -144,7 +142,7 @@ driver {
}
}
field {
name = 'negative_tariff1_reactive_energy'
name = negative_tariff1_reactive_energy
quantity = Energy
info = 'Negative Three-phase Reactive Energy (Tariff 1).'
vif_scaling = None
@ -156,7 +154,7 @@ driver {
}
}
field {
name = 'negative_tariff2_reactive_energy'
name = negative_tariff2_reactive_energy
quantity = Energy
info = 'Negative Three-phase Reactive Energy (Tariff 2).'
vif_scaling = None
@ -168,7 +166,7 @@ driver {
}
}
field {
name = 'partial_positive_active_energy'
name = partial_positive_active_energy
quantity = Energy
info = 'Partial Positive Three-phase Active Energy.'
vif_scaling = None
@ -180,7 +178,7 @@ driver {
}
}
field {
name = 'partial_negative_active_energy'
name = partial_negative_active_energy
quantity = Energy
info = 'Partial Negative Three-phase Active Energy.'
vif_scaling = None
@ -192,7 +190,7 @@ driver {
}
}
field {
name = 'partial_positive_reactive_energy'
name = partial_positive_reactive_energy
quantity = Energy
info = 'Partial Positive Three-phase Reactive Energy.'
vif_scaling = None
@ -204,7 +202,7 @@ driver {
}
}
field {
name = 'partial_negative_reactive_energy'
name = partial_negative_reactive_energy
quantity = Energy
info = 'Partial Negative Three-phase Reactive Energy.'
vif_scaling = None
@ -216,7 +214,7 @@ driver {
}
}
field {
name = 'pulse_input'
name = pulse_input
quantity = Dimensionless
info = 'Pulse Input.'
vif_scaling = None
@ -228,7 +226,7 @@ driver {
}
}
field {
name = 'pulse_unit'
name = pulse_unit
quantity = Text
info = 'Pulse Unit.'
match {
@ -240,67 +238,67 @@ driver {
mask_bits = 0xffff
map {
name = WH
info = 'Wh'
info = Wh
value = 0
test = Set
}
map {
name = KWH
info = 'kWh'
info = kWh
value = 1
test = Set
}
map {
name = MWH
info = 'MWh'
info = MWh
value = 2
test = Set
}
map {
name = VARH
info = 'varh'
info = varh
value = 3
test = Set
}
map {
name = KVARH
info = 'kvarh'
info = kvarh
value = 4
test = Set
}
map {
name = MVARH
info = 'mvarh'
info = mvarh
value = 5
test = Set
}
map {
name = VAH
info = 'VAh'
info = VAh
value = 6
test = Set
}
map {
name = KVAH
info = 'kVAh'
info = kVAh
value = 7
test = Set
}
map {
name = MVAH
info = 'mVAh'
info = mVAh
value = 8
test = Set
}
map {
name = M3
info = ''
info = m³
value = 9
test = Set
}
map {
name = KM3
info = 'km³'
info = km³
value = 10
test = Set
}
@ -312,74 +310,74 @@ driver {
}
map {
name = NM3
info = 'Nm³'
info = Nm³
value = 12
test = Set
}
map {
name = KNM3
info = 'kNm³'
info = kNm³
value = 13
test = Set
}
map {
name = MNM3
info = 'MNm³'
info = MNm³
value = 14
test = Set
}
map {
name = J
info = 'J'
info = J
value = 15
test = Set
}
map {
name = KJ
info = 'kJ'
info = kJ
value = 16
test = Set
}
map {
name = MJ
info = 'MJ'
info = MJ
value = 17
test = Set
}
map {
name = cal
info = 'cal'
info = cal
value = 18
test = Set
}
map {
name = KCAL
info = 'kcal'
info = kcal
value = 19
test = Set
}
map {
name = G
info = 'g'
info = g
value = 20
test = Set
}
map {
name = KG
info = 'kg'
info = kg
value = 21
test = Set
}
map {
name = T
info = 'T'
info = T
value = 21
test = Set
}
}
}
field {
name = 'kta'
name = kta
quantity = Text
info = 'Current Transformer Ratio (KTA).'
vif_scaling = None
@ -390,7 +388,7 @@ driver {
}
}
field {
name = 'ktv'
name = ktv
quantity = Text
info = 'Voltage Transformer Ratio (KTV).'
vif_scaling = None
@ -400,10 +398,9 @@ driver {
difvifkey = 02FF9329
}
}
// Telegram 2 fields
field {
name = 'three_phase_total_active_power'
name = three_phase_total_active_power
quantity = Power
info = 'Three-phase Total Active Power.'
vif_scaling = None
@ -415,7 +412,7 @@ driver {
}
}
field {
name = 'active_power_l1'
name = active_power_l1
quantity = Power
info = 'Active Power L1.'
vif_scaling = None
@ -427,7 +424,7 @@ driver {
}
}
field {
name = 'active_power_l2'
name = active_power_l2
quantity = Power
info = 'Active Power L2.'
vif_scaling = None
@ -439,7 +436,7 @@ driver {
}
}
field {
name = 'active_power_l3'
name = active_power_l3
quantity = Power
info = 'Active Power L3.'
vif_scaling = None
@ -451,7 +448,7 @@ driver {
}
}
field {
name = 'three_phase_total_reactive_power'
name = three_phase_total_reactive_power
quantity = Power
info = 'Three-phase Total Reactive Power.'
vif_scaling = None
@ -463,7 +460,7 @@ driver {
}
}
field {
name = 'reactive_power_l1'
name = reactive_power_l1
quantity = Power
info = 'Reactive Power L1.'
vif_scaling = None
@ -475,7 +472,7 @@ driver {
}
}
field {
name = 'reactive_power_l2'
name = reactive_power_l2
quantity = Power
info = 'Reactive Power L2.'
vif_scaling = None
@ -487,7 +484,7 @@ driver {
}
}
field {
name = 'reactive_power_l3'
name = reactive_power_l3
quantity = Power
info = 'Reactive Power L3.'
vif_scaling = None
@ -499,7 +496,7 @@ driver {
}
}
field {
name = 'three_phase_total_apparent_power'
name = three_phase_total_apparent_power
quantity = Power
info = 'Three-phase Total Apparent Power.'
vif_scaling = None
@ -511,7 +508,7 @@ driver {
}
}
field {
name = 'apparent_power_l1'
name = apparent_power_l1
quantity = Power
info = 'Apparent Power L1.'
vif_scaling = None
@ -523,7 +520,7 @@ driver {
}
}
field {
name = 'apparent_power_l2'
name = apparent_power_l2
quantity = Power
info = 'Apparent Power L2.'
vif_scaling = None
@ -535,7 +532,7 @@ driver {
}
}
field {
name = 'apparent_power_l3'
name = apparent_power_l3
quantity = Power
info = 'Apparent Power L3.'
vif_scaling = None
@ -546,10 +543,9 @@ driver {
difvifkey = 84A020FF862B
}
}
// Telegram 3 fields
field {
name = 'voltage_1_n'
name = voltage_1_n
quantity = Voltage
info = '1-N Voltage.'
vif_scaling = None
@ -561,7 +557,7 @@ driver {
}
}
field {
name = 'voltage_2_n'
name = voltage_2_n
quantity = Voltage
info = '2-N Voltage.'
vif_scaling = None
@ -573,7 +569,7 @@ driver {
}
}
field {
name = 'voltage_3_n'
name = voltage_3_n
quantity = Voltage
info = '3-N Voltage.'
vif_scaling = None
@ -585,7 +581,7 @@ driver {
}
}
field {
name = 'voltage_1_2'
name = voltage_1_2
quantity = Voltage
info = '1-2 Voltage.'
vif_scaling = None
@ -597,7 +593,7 @@ driver {
}
}
field {
name = 'voltage_2_3'
name = voltage_2_3
quantity = Voltage
info = '2-3 Voltage.'
vif_scaling = None
@ -609,7 +605,7 @@ driver {
}
}
field {
name = 'voltage_3_1'
name = voltage_3_1
quantity = Voltage
info = '3-1 Voltage.'
vif_scaling = None
@ -621,7 +617,7 @@ driver {
}
}
field {
name = 'current_l1'
name = current_l1
quantity = Amperage
info = 'Phase 1 Current Value.'
vif_scaling = None
@ -633,7 +629,7 @@ driver {
}
}
field {
name = 'current_l2'
name = current_l2
quantity = Amperage
info = 'Phase 2 Current Value.'
vif_scaling = None
@ -645,7 +641,7 @@ driver {
}
}
field {
name = 'current_l3'
name = current_l3
quantity = Amperage
info = 'Phase 3 Current Value.'
vif_scaling = None
@ -657,9 +653,9 @@ driver {
}
}
field {
name = 'frequency'
name = frequency
quantity = Frequency
info = 'Frequency.'
info = Frequency.
vif_scaling = None
dif_signedness = Signed
force_scale = 0.1
@ -668,10 +664,9 @@ driver {
difvifkey = 02FF8A48
}
}
// Telegram 4 fields
field {
name = 'three_phase_power'
name = three_phase_power
quantity = Dimensionless
info = 'Three-phase Power Factor (PF).'
vif_scaling = None
@ -683,7 +678,7 @@ driver {
}
}
field {
name = 'power_factor_sector'
name = power_factor_sector
quantity = Text
info = 'Power Factor (PF) sector.'
match {
@ -695,26 +690,26 @@ driver {
mask_bits = 0xffff
map {
name = RESISTIVE
info = 'Resistive'
info = Resistive
value = 0
test = Set
}
map {
name = INDUCTIVE
info = 'Inductive'
info = Inductive
value = 1
test = Set
}
map {
name = CAPACITIVE
info = 'Capacitive'
info = Capacitive
value = 2
test = Set
}
}
}
field {
name = 'total_active_power_requirement'
name = total_active_power_requirement
quantity = Power
info = 'Total Active Power Requirement (MD).'
vif_scaling = None
@ -726,7 +721,7 @@ driver {
}
}
field {
name = 'max_total_active_power_tariff1'
name = max_total_active_power_tariff1
quantity = Power
info = 'Maximum Total Active Power Requirement Tariff 1 (PMD T1).'
vif_scaling = None
@ -738,7 +733,7 @@ driver {
}
}
field {
name = 'max_total_active_power_tariff2'
name = max_total_active_power_tariff2
quantity = Power
info = 'Maximum Total Active Power Requirement Tariff 2 (PMD T2).'
vif_scaling = None
@ -750,7 +745,7 @@ driver {
}
}
field {
name = 'run_meter_total'
name = run_meter_total
quantity = Time
info = 'Run hour meter (TOT).'
vif_scaling = None
@ -762,7 +757,7 @@ driver {
}
}
field {
name = 'run_meter_tariff1'
name = run_meter_tariff1
quantity = Time
info = 'Run hour meter (Tariff 1).'
vif_scaling = None
@ -774,7 +769,7 @@ driver {
}
}
field {
name = 'run_meter_tariff2'
name = run_meter_tariff2
quantity = Time
info = 'Run hour meter (Tariff 2).'
vif_scaling = None
@ -785,7 +780,8 @@ driver {
difvifkey = 8420FF8F21
}
}
}
tests {
test {
args = 'MyMeter ime 12345678 NOKEY'
comment = 'Telegram 1'
@ -793,7 +789,6 @@ driver {
json = '{"id": "12345678","media": "electricity","meter": "ime","name": "MyMeter","negative_tariff1_active_energy_kwh": 0,"negative_tariff1_reactive_energy_kvarh": 0.06,"negative_tariff2_active_energy_kwh": 0,"negative_tariff2_reactive_energy_kvarh": 0,"negative_total_active_energy_kwh": 0,"negative_total_reactive_energy_kvarh": 0.06,"partial_negative_active_energy_kwh": 0,"partial_negative_reactive_energy_kvarh": 0.06,"partial_positive_active_energy_kwh": 7972.38,"partial_positive_reactive_energy_kvarh": 4776.49,"positive_tariff1_active_energy_kwh": 7928.3,"positive_tariff1_reactive_energy_kvarh": 4744.25,"positive_tariff2_active_energy_kwh": 44.08,"positive_tariff2_reactive_energy_kvarh": 32.24,"positive_total_active_energy_kwh": 7972.38,"positive_total_reactive_energy_kvarh": 4776.49,"pulse_input_counter": 0,"pulse_unit": "WH","status":"OK","timestamp": "1111-11-11T11:11:11Z"}'
fields = 'MyMeter;12345678;7972.38;1111-11-11 11:11.11'
}
test {
args = 'MyMeter ime 12345678 NOKEY'
comment = 'Telegram 2'
@ -801,7 +796,6 @@ driver {
json = '{"active_power_l1_kw": 0,"active_power_l2_kw": 0.006,"active_power_l3_kw": 0,"apparent_power_l1_kva": 0,"apparent_power_l2_kva": 0.008,"apparent_power_l3_kva": 0,"id": "12345678","media": "electricity","meter": "ime","name": "MyMeter","reactive_power_l1_kvar": 0,"reactive_power_l2_kvar": 0,"reactive_power_l3_kvar": 0,"three_phase_total_active_power_kw": 0.006,"three_phase_total_apparent_power_kva": 0.008,"three_phase_total_reactive_power_kvar": 0,"status":"OK","timestamp": "1111-11-11T11:11:11Z"}'
fields = 'MyMeter;12345678;null;1111-11-11 11:11.11'
}
test {
args = 'MyMeter ime 12345678 NOKEY'
comment = 'Telegram 3'
@ -816,4 +810,5 @@ driver {
json = '{"id": "12345678","max_total_active_power_tariff1_kw": 7.529,"max_total_active_power_tariff2_kw": 3.525,"media": "electricity","meter": "ime","name": "MyMeter","power_factor_sector": "INDUCTIVE","run_meter_tariff1_h": 13228.166667,"run_meter_tariff2_h": 44.283333,"run_meter_total_h": 13272.45,"three_phase_power_factor": 0.747,"status":"OK","timestamp": "1111-11-11T11:11:11Z","total_active_power_requirement_kw": 0.007}'
fields = 'MyMeter;12345678;null;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -8,6 +8,7 @@ driver {
mvt = SEN,68,07
mvt = SEN,7c,07
}
fields {
field {
name = total
quantity = Volume
@ -26,6 +27,8 @@ driver {
vif_range = VolumeFlow
}
}
}
tests {
test {
args = 'MoreWater iperl 12345699 NOKEY'
comment = 'Test iPerl T1 telegram, that after decryption, has 2f2f markers.'
@ -40,4 +43,5 @@ driver {
json = '{"media":"water","meter":"iperl","name":"WaterWater","id":"33225544","total_m3":123.529,"max_flow_m3h":0,"timestamp":"1111-11-11T11:11:11Z"}'
fields = 'WaterWater;33225544;123.529;0;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -18,6 +18,7 @@ driver {
detect {
mvt = IST,a9,04
}
fields {
field {
name = status
quantity = Text
@ -85,6 +86,8 @@ driver {
storage_nr = 1
}
}
}
tests {
test {
args = 'HeatItUp istaheat 33503169 NOKEY'
telegram = 5344742669315033A9048C2070900F002C25961200009D6949E80EB1E2707A96003007102F2F_0C0500000000426C00004C050000000082016CFE298C0105000000008C0115000000002F2F2F2F2F2F2F2F2F2F2F
@ -97,4 +100,5 @@ driver {
json = '{"status":"OK","media":"heat","meter":"istaheat","name":"FeelTheHeat","id":"44503169","last_year_kwh":2612,"last_year_date":"2023-12-31","target_kwh":4165.8,"target_date":"2024-01-31","target_m3":281.4,"total_kwh":4981.4,"timestamp":"1111-11-11T11:11:11Z"}'
fields = 'FeelTheHeat;44503169;OK;4981.4;4165.8;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -7,7 +7,10 @@ driver {
detect {
mvt = ITW,00,04
}
library {
use = meter_datetime
}
fields {
field {
name = status
quantity = Text
@ -53,6 +56,8 @@ driver {
storage_nr = 1
}
}
}
tests {
test {
args = 'Heat itronheat 23340485 NOKEY'
comment = 'Allmess UltraMaXX with ITRON EquaScan hMIU RF Module'
@ -67,4 +72,5 @@ driver {
json = '{"id": "11755757","last_year_date": "2022-12-31","last_year_kwh": 13978,"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_kwh": 19529,"total_m3": 8401.224}'
fields = 'Heat_lower_case;11755757;OK;19529;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -6,6 +6,7 @@ driver {
detect {
mvt = KAM,01,18
}
fields {
field {
name = status
quantity = Text
@ -93,7 +94,6 @@ driver {
difvifkey = 05FF09
}
}
field {
name = beta
info = 'We do not know what this is.'
@ -103,14 +103,14 @@ driver {
difvifkey = 05FF0A
}
}
}
tests {
test {
args = 'Pressing kampress 77000317 NOKEY'
telegram = 32442D2C1703007701188D280080E39322DB8F78_22696600126967000269660005FF091954A33A05FF0A99BD823A02FD170800
json = '{"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","status":"LOW","pressure_bar":1.02,"max_pressure_bar":1.03,"min_pressure_bar":1.02,"alfa_counter":0.001246,"beta_counter":0.000997,"timestamp":"1111-11-11T11:11:11Z"}'
fields = 'Pressing;77000317;LOW;1.02;1.03;1.02;1111-11-11 11:11.11'
}
test {
args = 'Pressing kampress 77000317 NOKEY'
telegram = '32442D2C1703007701188D280080E39322DB8F78_22696600126967000269660005FF091954A33A05FF0A99BD823A02FD170800
@ -118,7 +118,6 @@ driver {
json = '{"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","status":"LOW","pressure_bar":1.02,"max_pressure_bar":1.03,"min_pressure_bar":1.02,"alfa_counter":0.001108,"beta_counter":0.000743,"timestamp":"1111-11-11T11:11:11Z"}'
fields = 'Pressing;77000317;LOW;1.02;1.03;1.02;1111-11-11 11:11.11'
}
test {
args = 'Pressing kampress 77000317 NOKEY'
telegram = '32442D2C1703007701188D280080E39322DB8F78_22696600126967000269660005FF091954A33A05FF0A99BD823A02FD170800
@ -126,4 +125,5 @@ driver {
json = '{"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","status":"LOW","pressure_bar":1.02,"max_pressure_bar":1.02,"min_pressure_bar":1.01,"alfa_counter":0.001252,"beta_counter":-0.001248,"timestamp":"1111-11-11T11:11:11Z"}'
fields = 'Pressing;77000317;LOW;1.02;1.02;1.01;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -6,10 +6,13 @@ driver {
detect {
mvt = REL,41,00
}
library {
use = consumption_hca
use = target_hca
use = meter_datetime
use = target_date
}
fields {
field {
name = next_target
quantity = PointInTime
@ -21,6 +24,8 @@ driver {
storage_nr = 1
}
}
}
tests {
test {
args = 'MyRelHCA relhca 00000104 NOKEY'
comment = 'Telegram 1'
@ -28,5 +33,5 @@ driver {
json = '{"consumption_hca": 1846441,"id": "00000104","media": "other","meter": "relhca","meter_datetime": "2024-02-23 02:28","target_hca": 1846441,"name": "MyRelHCA","next_target_date": "2024-12-31","target_date": "2023-12-31","timestamp": "1111-11-11T11:11:11Z"}'
fields = 'MyRelHCA;00000104;1846441;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -7,7 +7,10 @@ driver {
detect {
mvt = EFE,00,04
}
library {
use = meter_datetime,fabrication_no,model_version,on_time_h,parameter_set
}
fields {
field {
name = status
quantity = Text
@ -237,6 +240,8 @@ driver {
storage_nr = 2,32
}
}
}
tests {
test {
args = 'Heat sensostar 20480057 NOKEY'
telegram = 68B3B36808007257004820c51400046c100000047839803801040600000000041300000000042B00000000142B00000000043B00000000143B00000000025B1400025f15000261daff02235c00046d2c2ddc24440600000000441300000000426c000001fd171003fd0c05000084200600000000c420060000000084300600000000c430060000000084401300000000c44013000000008480401300000000c48040130000000084c0401300000000c4c0401300000000a216
@ -256,4 +261,5 @@ driver {
json = '{"difference_c": 8.15,"flow_water_m3h": -0.009,"forward_c": 62,"id": "21750444","media": "heat","meter": "sensostar","meter_datetime": "2024-04-07 13:20","model_version": "000105","name": "XYZ","parameter_set": "1120","power_kw": 0,"return_c": 54,"status": "OK","timestamp": "1111-11-11T11:11:11Z","total_kwh": 18312,"total_water_m3": 4229.774}'
fields = 'XYZ;21750444;OK;18312;4229.774;null;null;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -6,7 +6,10 @@ driver {
detect {
mvt = SON,1b,04
}
library {
use = meter_datetime,flow_temperature_c,return_temperature_c,volume_flow_m3h
}
fields {
field {
name = total
quantity = Energy
@ -59,6 +62,8 @@ driver {
vif_range = AnyPowerVIF
}
}
}
tests {
test {
args = 'sonsupercal supercal 89508019 NOKEY'
comment = 'Sontex Supercal 739 test case'
@ -66,4 +71,5 @@ driver {
json = '{"flow_temperature_c": 40.67,"id": "89508019","media": "heat","meter": "supercal","meter_datetime": "2023-03-04 18:54","name": "sonsupercal","power_kw": 3.14,"return_temperature_c": 31.14,"target_date": "2127-01-01","target_kwh": 0,"target_m3": 0,"timestamp": "1111-11-11T11:11:11Z","total_kwh": 296,"total_m3": 44.26,"volume_flow_m3h": 0.285}'
fields = 'sonsupercal;89508019;296;1111-11-11 11:11.11'
}
}
}

Wyświetl plik

@ -6,11 +6,14 @@ driver {
detect {
mvt = WZG,03,16
}
library {
use = meter_datetime
use = target_date
use = target_m3
use = total_m3
use = fabrication_no
}
fields {
field {
name = next_target
quantity = PointInTime
@ -22,4 +25,5 @@ driver {
storage_nr = 1
}
}
}
}

Wyświetl plik

@ -131,8 +131,8 @@ DriverDynamic::DriverDynamic(MeterInfo &mi, DriverInfo &di) :
di.name().str().c_str(),
fileName().c_str());
xmqForeach(doc, "/driver/use", (XMQNodeCallback)add_use, this);
xmqForeach(doc, "/driver/field", (XMQNodeCallback)add_field, this);
xmqForeach(doc, "/driver/library/use", (XMQNodeCallback)add_use, this);
xmqForeach(doc, "/driver/fields/field", (XMQNodeCallback)add_field, this);
}
catch(...)
{
@ -572,7 +572,7 @@ string check_field_name(const char *name, DriverDynamic *dd)
{
if (!name)
{
warning("(driver) error in %s, cannot find: driver/field/name\n"
warning("(driver) error in %s, cannot find: driver/fields/field/name\n"
"%s\n"
"Remember to add for example: field { name = total ... }\n"
"%s\n",
@ -612,7 +612,7 @@ Quantity check_field_quantity(const char *quantity_s, DriverDynamic *dd)
{
if (!quantity_s)
{
warning("(driver) error in %s, cannot find: driver/field/quantity\n"
warning("(driver) error in %s, cannot find: driver/fields/field/quantity\n"
"%s\n"
"Remember to add for example: field { quantity = Volume ... }\n"
"Available quantities:\n%s\n"
@ -859,7 +859,7 @@ void checked_set_measurement_type(const char *measurement_type_s, FieldMatcher *
{
if (!measurement_type_s)
{
warning("(driver) error in %s, cannot find: driver/field/match/measurement_type\n"
warning("(driver) error in %s, cannot find: driver/fields/field/match/measurement_type\n"
"%s\n"
"Remember to add for example: match { measurement_type = Instantaneous ... }\n"
"Available measurement types:\n"
@ -902,7 +902,7 @@ void checked_set_vif_range(const char *vif_range_s, FieldMatcher *fm, DriverDyna
{
if (!vif_range_s)
{
warning("(driver) error in %s, cannot find: driver/field/match/vif_range\n"
warning("(driver) error in %s, cannot find: driver/fields/field/match/vif_range\n"
"%s\n"
"Remember to add for example: match { ... vif_range = ReturnTemperature ... }\n"
"Available vif ranges:\n"
@ -1057,7 +1057,7 @@ Translate::MapType checked_map_type(const char *map_type_s, DriverDynamic *dd)
{
if (!map_type_s)
{
warning("(driver) error in %s, cannot find: driver/field/lookup/map_type\n"
warning("(driver) error in %s, cannot find: driver/fields/field/lookup/map_type\n"
"%s\n"
"Remember to add for example: lookup { map_type = BitToString ... }\n"
"Available map types:\n"
@ -1097,7 +1097,7 @@ uint64_t checked_mask_bits(const char *mask_bits_s, DriverDynamic *dd)
{
if (!mask_bits_s)
{
warning("(driver) error in %s, cannot find: driver/field/lookup/mask_bitse\n"
warning("(driver) error in %s, cannot find: driver/fields/field/lookup/mask_bitse\n"
"%s\n"
"Remember to add for example: lookup { mask_bits = 0x00ff ... }\n"
"%s\n",
@ -1116,7 +1116,7 @@ uint64_t checked_value(const char *value_s, DriverDynamic *dd)
{
if (!value_s)
{
warning("(driver) error in %s, cannot find: driver/field/lookup/map/value\n"
warning("(driver) error in %s, cannot find: driver/fields/field/lookup/map/value\n"
"%s\n"
"Remember to add for example: lookup { map { ... value = 0x01 ... }}\n"
"%s\n",
@ -1135,7 +1135,7 @@ TestBit checked_test_type(const char *test_s, DriverDynamic *dd)
{
if (!test_s)
{
warning("(driver) error in %s, cannot find: driver/field/lookup/map/test\n"
warning("(driver) error in %s, cannot find: driver/fields/field/lookup/map/test\n"
"%s\n"
"Remember to add for example: lookup { map { test = Set } }\n"
"Available test types:\n"

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -201,12 +201,14 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { namee = total }
}
}
EOF
cat > $TEST/test_expected.txt <<EOF
(driver) error in testoutput/driver.xmq, cannot find: driver/field/name
(driver) error in testoutput/driver.xmq, cannot find: driver/fields/field/name
-------------------------------------------------------------------------------
Remember to add for example: field { name = total ... }
-------------------------------------------------------------------------------
@ -222,7 +224,9 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total_m3 }
}
}
EOF
@ -244,12 +248,14 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total }
}
}
EOF
cat > $TEST/test_expected.txt <<EOF
(driver) error in testoutput/driver.xmq, cannot find: driver/field/quantity
(driver) error in testoutput/driver.xmq, cannot find: driver/fields/field/quantity
-------------------------------------------------------------------------------
Remember to add for example: field { quantity = Volume ... }
Available quantities:
@ -290,7 +296,9 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total quantity = gurka }
}
}
EOF
@ -335,7 +343,9 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total quantity = Volume }
}
}
EOF
@ -353,7 +363,9 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total quantity = Volume calculate = '4711.23m3 + 0.9m3' }
}
}
EOF
@ -370,12 +382,14 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total quantity = Volume match { } }
}
}
EOF
cat > $TEST/test_expected.txt <<EOF
(driver) error in testoutput/driver.xmq, cannot find: driver/field/match/measurement_type
(driver) error in testoutput/driver.xmq, cannot find: driver/fields/field/match/measurement_type
-------------------------------------------------------------------------------
Remember to add for example: match { measurement_type = Instantaneous ... }
Available measurement types:
@ -397,7 +411,9 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total quantity = Volume match { measurement_type = sdfInstantaneous } }
}
}
EOF
@ -423,12 +439,14 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total quantity = Volume match { measurement_type = Instantaneous } }
}
}
EOF
cat > $TEST/test_expected.txt <<EOF
(driver) error in testoutput/driver.xmq, cannot find: driver/field/match/vif_range
(driver) error in testoutput/driver.xmq, cannot find: driver/fields/field/match/vif_range
-------------------------------------------------------------------------------
Remember to add for example: match { ... vif_range = ReturnTemperature ... }
Available vif ranges:
@ -491,7 +509,9 @@ TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver { name = iffo meter_type = WaterMeter default_fields = name,id,total_m3,timestamp
detect { mvt = SEN,99,07 }
fields {
field { name = total quantity = Volume match { measurement_type = Instantaneous vif_range = Volume } }
}
}
EOF
@ -507,10 +527,12 @@ TESTNAME="Test lookup of bits"
TESTRESULT="ERROR"
cat > $TEST/driver.xmq <<EOF
driver{name=kampress meter_type=PressureSensor detect{mvt=KAM,01,18} default_fields=name,pressure,status
fields {
field{name=status quantity=Text match{measurement_type=Instantaneous vif_range=ErrorFlags}
lookup{name=ERROR_FLAGS map_type=BitToString mask_bits=0xffff default_message=OK
map{name=DROP value=0x01 test=Set}map{name=LOW value=0x08 test=Set}}}
field{name=pressure quantity=Pressure match{measurement_type=Instantaneous vif_range=Pressure}}
}
}
EOF

Wyświetl plik

@ -49,6 +49,7 @@ driver {
detect {
mvt = EFE,00,04
}
fields {
field {
name = total
quantity = Energy
@ -98,8 +99,8 @@ driver {
storage_nr = 2,32
}
}
}
}
EOF
cat > $TEST/test_expected.txt <<EOF

Wyświetl plik

@ -17,6 +17,7 @@ driver {
detect {
mvt = IME,55,08
}
fields {
field {
name = alfa
quantity = Energy
@ -61,7 +62,9 @@ driver {
difvifkey = 849010FF80843B
}
}
}
}
EOF
$PROG --format=fields \

Wyświetl plik

@ -40,6 +40,7 @@ driver {
detect {
mvt = SEN,99,07
}
fields {
field {
name = totalitator
quantity = Volume
@ -62,6 +63,7 @@ driver {
en = 'The maximum flow recorded during previous period.'
}
}
}
}
EOF