From d7d1cda149cc0e161c3866ea56f0f7c73747eff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20=C3=96hrstr=C3=B6m?= Date: Sun, 1 Jan 2023 20:51:20 +0100 Subject: [PATCH] All fields are by default OPTIONAL. Remove other unnecessary PrintProperty fields. --- CHANGES | 2 + simulations/simulation_c1.txt | 6 +- simulations/simulation_conversionsadded.txt | 4 +- simulations/simulation_s1.txt | 6 +- simulations/simulation_t1.txt | 46 ++-- src/driver_abbb23.cc | 6 +- src/driver_amiplus.cc | 40 ++-- src/driver_apator08.cc | 5 +- src/driver_apator162.cc | 2 +- src/driver_apator172.cc | 7 +- src/driver_apatoreitn.cc | 14 +- src/driver_auto.cc | 1 + src/driver_aventieshca.cc | 11 +- src/driver_aventieswm.cc | 9 +- src/driver_bfw240radio.cc | 8 +- src/driver_c5isf.cc | 59 ++--- src/driver_cma12w.cc | 9 +- src/driver_compact5.cc | 6 +- src/driver_dme_07.cc | 4 +- src/driver_ebzwmbe.cc | 14 +- src/driver_ehzp.cc | 9 +- src/driver_ei6500.cc | 42 ++-- src/driver_elf.cc | 25 +-- src/driver_em24.cc | 16 +- src/driver_emerlin868.cc | 6 +- src/driver_enercal.cc | 40 ++-- src/driver_engelmann-faw.cc | 12 +- src/driver_esyswm.cc | 22 +- src/driver_eurisii.cc | 14 +- src/driver_ev200.cc | 4 +- src/driver_evo868.cc | 24 +- src/driver_fhkvdataiii.cc | 21 +- src/driver_fhkvdataiv.cc | 18 +- src/driver_flowiq2200.cc | 34 +-- src/driver_gransystems.cc | 28 +-- src/driver_hydrocalm3.cc | 22 +- src/driver_hydroclima.cc | 17 +- src/driver_hydrodigit.cc | 4 +- src/driver_hydrus.cc | 37 ++-- src/driver_iperl.cc | 9 +- src/driver_itron.cc | 10 +- src/driver_izar.cc | 39 ++-- src/driver_kamheat.cc | 30 +-- src/driver_kampress.cc | 19 +- src/driver_lansendw.cc | 13 +- src/driver_lansenpu.cc | 8 +- src/driver_lansensm.cc | 8 +- src/driver_lansenth.cc | 16 +- src/driver_lse_07_17.cc | 29 +-- src/driver_lse_08.cc | 16 +- src/driver_microclima.cc | 20 +- src/driver_minomess.cc | 10 +- src/driver_mkradio3.cc | 13 +- src/driver_mkradio4.cc | 7 +- src/driver_mkradio4a.cc | 4 +- src/driver_multical21.cc | 28 +-- src/driver_munia.cc | 8 +- src/driver_omnipower.cc | 8 +- src/driver_piigth.cc | 15 +- src/driver_pollucomf.cc | 33 +-- src/driver_q400.cc | 10 +- src/driver_qcaloric.cc | 34 +-- src/driver_qheat.cc | 16 +- src/driver_qheat_55_us.cc | 16 +- src/driver_qsmoke.cc | 20 +- src/driver_qualcosonic.cc | 20 +- src/driver_qwater.cc | 14 +- src/driver_rfmamb.cc | 34 +-- src/driver_rfmtx1.cc | 4 +- src/driver_sensostar.cc | 33 +-- src/driver_sharky.cc | 23 +- src/driver_sharky774.cc | 26 +-- src/driver_sontex868.cc | 16 +- src/driver_supercom587.cc | 2 +- src/driver_topaseskr.cc | 16 +- src/driver_tsd2.cc | 5 +- src/driver_ultraheat.cc | 13 +- src/driver_ultrimis.cc | 11 +- src/driver_unismart.cc | 20 +- src/driver_unknown.cc | 1 + src/driver_vario411.cc | 4 +- src/driver_vario451.cc | 7 +- src/driver_vario451mid.cc | 10 +- src/driver_waterstarm.cc | 24 +- src/driver_weh_07.cc | 2 +- src/meters.cc | 232 ++++++++------------ src/meters.h | 30 +-- tests/test_analyze.sh | 16 -- 88 files changed, 802 insertions(+), 854 deletions(-) diff --git a/CHANGES b/CHANGES index 31dfbc2..f23cbb3 100644 --- a/CHANGES +++ b/CHANGES @@ -11,6 +11,8 @@ ATTENTION! The sharky774 driver had a bug that triggered when the meter used Jou Also the calculated temperature difference had to be removed. You can re-add the temperature difference by using --calculate_temperature_difference_c=flow_temperature_c-return_temperature_c +ATTENTION! The third hydrus driver field has changed from max_flow_m3h to total_at_date_m3. + Since a field disappeared the default fields were disrupted and a shorter list of fields have now been picked for the default fields. Please use --selectedfields=... to recreate your previous fields. diff --git a/simulations/simulation_c1.txt b/simulations/simulation_c1.txt index 9e557b6..6f098fe 100644 --- a/simulations/simulation_c1.txt +++ b/simulations/simulation_c1.txt @@ -10,9 +10,9 @@ telegram=|23442D2C998734761B168D2087D19EAD217F1779EDA86AB6_710008190000081900007 # Tets Multical21 C1 telegrams with maximum flow configuration telegram=|2D442D2C776655441B168D2083B48D3A20_46887802FF20000004132F4E000092013B3D01A1015B028101E7FF0F03| -{"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"target_m3":null,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} +{"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} telegram=|21442D2C776655441B168D2079CC8C3A20_F4307912C40DFF00002F4E00003D010203| -{"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"target_m3":null,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} +{"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} # Test FlowIQ2200 C1 telegrams @@ -26,7 +26,7 @@ telegram=|314493441234567835087a740000200b6e2701004b6e450100426c5f2ccb086e790000 # Test another pair of QCalric C1 telegrams telegram=|49449344939291903408780DFF5F350082180000800007B06EFFFF970000009F2C70020000BE26970000000000010018002E001F002E0023FF210008000500020000002F046D220FA227| -{"media":"heat cost allocation","meter":"qcaloric","name":"MyElement2","id":"90919293","status":"OK","current_consumption_hca":null,"set_date":null,"consumption_at_set_date_hca":null,"set_date_1":null,"consumption_at_set_date_1_hca":null,"device_date_time":"2021-07-02 15:34","timestamp":"1111-11-11T11:11:11Z"} +{"media":"heat cost allocation","meter":"qcaloric","name":"MyElement2","id":"90919293","status":"OK","device_date_time":"2021-07-02 15:34","timestamp":"1111-11-11T11:11:11Z"} telegram=|314493449392919034087a520000200b6e9700004b6e700200426c9f2ccb086e970000c2086cbe26326cffff046d2d16a227| {"media":"heat cost allocation","meter":"qcaloric","name":"MyElement2","id":"90919293","status":"OK","current_consumption_hca":97,"set_date":"2020-12-31","consumption_at_set_date_hca":270,"set_date_1":"2020-12-31","consumption_at_set_date_1_hca":270,"set_date_17":"2021-06-30","consumption_at_set_date_17_hca":97,"error_date":"2127-15-31","device_date_time":"2021-07-02 22:45","timestamp":"1111-11-11T11:11:11Z"} diff --git a/simulations/simulation_conversionsadded.txt b/simulations/simulation_conversionsadded.txt index 6cbd005..63c652b 100644 --- a/simulations/simulation_conversionsadded.txt +++ b/simulations/simulation_conversionsadded.txt @@ -1,7 +1,7 @@ # Test vario451 T1 telegrams with --calculate_total_gj=total_kwh etc -telegram=|374468506549235827C3A2|129F25383300A8622600008200800A2AF862115175552877A36F26C9AB1CB24400000004000000000004908002| +telegram=|374468506549235827C3A2_129F25383300A8622600008200800A2AF862115175552877A36F26C9AB1CB24400000004000000000004908002| {"media":"heat","meter":"vario451","name":"Hettan","id":"58234965","total_kwh":6371.666667,"total_gj":22.938,"current_kwh":2729.444444,"current_gj":9.826,"previous_kwh":3642.222222,"previous_gj":13.112,"timestamp":"1111-11-11T11:11:11Z"} # Test Multical21 C1 telegrams with --calculate_total_l=total_m3 etc -telegram=|23442D2C998734761B168D2087D19EAD217F1779EDA86AB6|710008190000081900007F13| +telegram=|23442D2C998734761B168D2087D19EAD217F1779EDA86AB6_710008190000081900007F13| {"media":"cold water","meter":"multical21","name":"MyTapWater","id":"76348799","status":"DRY","total_m3":6.408,"total_l":6408,"target_m3":6.408,"target_l":6408,"flow_temperature_c":127,"flow_temperature_f":260.6,"external_temperature_c":19,"external_temperature_f":66.2,"current_status":"DRY","time_dry":"22-31 days","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} diff --git a/simulations/simulation_s1.txt b/simulations/simulation_s1.txt index e245794..3144956 100644 --- a/simulations/simulation_s1.txt +++ b/simulations/simulation_s1.txt @@ -15,16 +15,16 @@ telegram=|294465324185990401087a0080000082046c7f018b046e210300046d1a0e6f0202fdac telegram=|2D4465327663341317077AAA0000000C13044001004C1340620000426C9F2C02BB560000326CFFFF046D180DA924| {"media":"water","meter":"lse_07_17","name":"QW","id":"13346376","total_m3":14.004,"due_date_m3":6.24,"due_date":"2020-12-31","error_code":"OK","error_date":"2127-15-31","device_date_time":"2021-04-09 13:24","timestamp":"1111-11-11T11:11:11Z"} -|QW;13346376;14.004000;6.240000;2020-12-31;OK;2127-15-31;2021-04-09 13:24;1111-11-11 11:11.11 +|QW;13346376;14.004;6.24;2020-12-31;OK;2127-15-31;2021-04-09 13:24;1111-11-11 11:11.11 # Test another Qundis QWater5.5 meter. telegram=|2D4465321413121116077A900000000C13565906004C1336400600426C9F2C02BB560000326CFFFF046D3405BA25| {"media":"water","meter":"lse_07_17","name":"QWW","id":"11121314","total_m3":65.956,"due_date_m3":64.036,"due_date":"2020-12-31","error_code":"OK","error_date":"2127-15-31","device_date_time":"2021-05-26 05:52","timestamp":"1111-11-11T11:11:11Z"} -|QWW;11121314;65.956000;64.036000;2020-12-31;OK;2127-15-31;2021-05-26 05:52;1111-11-11 11:11.11 +|QWW;11121314;65.956;64.036;2020-12-31;OK;2127-15-31;2021-05-26 05:52;1111-11-11 11:11.11 # Test yet another Qundis QWater5.5 meter. telegram=|2D4465320877411218067A8C0000000C13122100004C1300000000426CFFFF02BB560000326CFFFF046D2104BC2B| {"media":"warm water","meter":"lse_07_17","name":"QWWW","id":"12417708","total_m3":2.112,"due_date_m3":0,"due_date":"2127-15-31","error_code":"OK","error_date":"2127-15-31","device_date_time":"2021-11-28 04:33","timestamp":"1111-11-11T11:11:11Z"} -|QWWW;12417708;2.112000;0.000000;2127-15-31;OK;2127-15-31;2021-11-28 04:33;1111-11-11 11:11.11 +|QWWW;12417708;2.112;0;2127-15-31;OK;2127-15-31;2021-11-28 04:33;1111-11-11 11:11.11 diff --git a/simulations/simulation_t1.txt b/simulations/simulation_t1.txt index 54f4b28..cd558a5 100644 --- a/simulations/simulation_t1.txt +++ b/simulations/simulation_t1.txt @@ -18,24 +18,24 @@ telegram=|AF46EE4D2827282716087A80000000_046D040A9F2A036E000000426CE1F7436E00000 telegram=|1E44AE4C9956341268077A36001000_2F2F0413181E0000023B00002F2F2F2F| {"media":"water","meter":"iperl","name":"MoreWater","id":"12345699","total_m3":7.704,"max_flow_m3h":0,"timestamp":"1111-11-11T11:11:11Z"} -|MoreWater;12345699;7.704000;0.000000;1111-11-11 11:11.11 +|MoreWater;12345699;7.704;0;1111-11-11 11:11.11 # Test iPerl T1 telegram not encrypted, no 2f2f markers. telegram=|1844AE4C4455223368077A55000000_041389E20100023B0000| {"media":"water","meter":"iperl","name":"WaterWater","id":"33225544","total_m3":123.529,"max_flow_m3h":0,"timestamp":"1111-11-11T11:11:11Z"} -|WaterWater;33225544;123.529000;0.000000;1111-11-11 11:11.11 +|WaterWater;33225544;123.529;0;1111-11-11 11:11.11 # Test amiplus/apator electricity meter telegram=|4E4401061010101002027A00004005_2F2F0E035040691500000B2B300300066D00790C7423400C78371204860BABC8FC100000000E833C8074000000000BAB3C0000000AFDC9FC0136022F2F2F2F2F| -{"media":"electricity","meter":"amiplus","name":"MyElectricity1","id":"10101010","total_energy_consumption_kwh":15694.05,"current_power_consumption_kw":0.33,"total_energy_production_kwh":7.48,"current_power_production_kw":0,"voltage_at_phase_1_v":236,"voltage_at_phase_2_v":null,"voltage_at_phase_3_v":null,"device_date_time":"2019-03-20 12:57:00","total_energy_consumption_tariff_1_kwh":null,"total_energy_consumption_tariff_2_kwh":null,"total_energy_consumption_tariff_3_kwh":null,"total_energy_production_tariff_1_kwh":null,"total_energy_production_tariff_2_kwh":null,"total_energy_production_tariff_3_kwh":null,"timestamp":"1111-11-11T11:11:11Z"} +{"media":"electricity","meter":"amiplus","name":"MyElectricity1","id":"10101010","total_energy_consumption_kwh":15694.05,"current_power_consumption_kw":0.33,"total_energy_production_kwh":7.48,"current_power_production_kw":0,"voltage_at_phase_1_v":236,"device_date_time":"2019-03-20 12:57:00","timestamp":"1111-11-11T11:11:11Z"} |MyElectricity1;10101010;15694.05;0.33;7.48;0;236;null;null;null;null;null;null;null;null;1111-11-11 11:11.11 # Test amiplus/apator electricity meter with three phase voltages telegram=|5E44B6105843250000027A2A005005_2F2F0C7835221400066D404708AC2A400E032022650900000E833C0000000000001B2B9647000B2B5510000BAB3C0000000AFDC9FC0135020AFDC9FC0245020AFDC9FC0339020BABC8FC100000002F2F| -{"media":"electricity","meter":"amiplus","name":"MyElectricity2","id":"00254358","total_energy_consumption_kwh":9652.22,"current_power_consumption_kw":1.055,"total_energy_production_kwh":0,"current_power_production_kw":0,"voltage_at_phase_1_v":235,"voltage_at_phase_2_v":245,"voltage_at_phase_3_v":239,"device_date_time":"2021-10-12 08:07:00","total_energy_consumption_tariff_1_kwh":null,"total_energy_consumption_tariff_2_kwh":null,"total_energy_consumption_tariff_3_kwh":null,"total_energy_production_tariff_1_kwh":null,"total_energy_production_tariff_2_kwh":null,"total_energy_production_tariff_3_kwh":null,"timestamp":"1111-11-11T11:11:11Z"} +{"media":"electricity","meter":"amiplus","name":"MyElectricity2","id":"00254358","total_energy_consumption_kwh":9652.22,"current_power_consumption_kw":1.055,"total_energy_production_kwh":0,"current_power_production_kw":0,"voltage_at_phase_1_v":235,"voltage_at_phase_2_v":245,"voltage_at_phase_3_v":239,"device_date_time":"2021-10-12 08:07:00","timestamp":"1111-11-11T11:11:11Z"} |MyElectricity2;00254358;9652.22;1.055;0;0;235;245;239;null;null;null;null;null;null;1111-11-11 11:11.11 @@ -43,14 +43,14 @@ telegram=|5E44B6105843250000027A2A005005_2F2F0C7835221400066D404708AC2A400E03202 # There is a problem in the decoding here, the data stored inside the telegram does not seem to properly encode/decode the year.... # We should not report a current_date with a full year, if the year is actually not part of the telegram. telegram=|2F446850313233347462A2_069F255900B029310000000306060906030609070606050509050505050407040605070500| -{"media":"warm water","meter":"mkradio3","name":"Duschen","id":"34333231","total_m3":13.8,"target_m3":8.9,"current_date":"2022-04-27T02:00:00Z","prev_date":"2018-12-31T02:00:00Z","timestamp":"1111-11-11T11:11:11Z"} -|Duschen;34333231;13.800000;8.900000;2022-04-27T02:00:00Z;2018-12-31T02:00:00Z;1111-11-11 11:11.11 +{"media":"warm water","meter":"mkradio3","name":"Duschen","id":"34333231","total_m3":13.8,"target_m3":8.9,"current_date":"2023-04-27T02:00:00Z","prev_date":"2018-12-31T02:00:00Z","timestamp":"1111-11-11T11:11:11Z"} +|Duschen;34333231;13.8;8.9;2023-04-27T02:00:00Z;2018-12-31T02:00:00Z;1111-11-11 11:11.11 # Test MKRadio4 T1 telegrams telegram=|2F446850200141029562A2_06702901006017030004000300000000000000000000000000000000000000000000000000| {"media":"warm water","meter":"mkradio4","name":"Duschagain","id":"02410120","total_m3":0.4,"target_m3":0.1,"timestamp":"1111-11-11T11:11:11Z"} -|Duschagain;02410120;0.400000;0.100000;1111-11-11 11:11.11 +|Duschagain;02410120;0.4;0.1;1111-11-11 11:11.11 # Test vario451 T1 telegrams telegram=|374468506549235827C3A2_129F25383300A8622600008200800A2AF862115175552877A36F26C9AB1CB24400000004000000000004908002| @@ -61,15 +61,15 @@ telegram=|374468506549235827C3A2_129F25383300A8622600008200800A2AF86211517555287 # There is a problem in the decoding here, the data stored inside the telegram does not seem to properly encode/decode the year.... # We should not report a current_date with a full year, if the year is actually not part of the telegram. telegram=|31446850226677116980A0119F27020480048300C408F709143C003D341A2B0B2A0707000000000000062D114457563D71A1850000| -{"media":"heat cost allocator","meter":"fhkvdataiii","name":"Room","id":"11776622","current_hca":131,"current_date":"2022-02-08T02:00:00Z","previous_hca":1026,"previous_date":"2019-12-31T02:00:00Z","temp_room_c":22.44,"temp_radiator_c":25.51,"timestamp":"1111-11-11T11:11:11Z"} -|Room;11776622;131.000000;2022-02-08T02:00:00Z;1026.000000;2019-12-31T02:00:00Z;22.440000;25.510000;1111-11-11 11:11.11 +{"media":"heat cost allocator","meter":"fhkvdataiii","name":"Room","id":"11776622","current_hca":131,"current_date":"2023-02-08T02:00:00Z","previous_hca":1026,"previous_date":"2019-12-31T02:00:00Z","temp_room_c":22.44,"temp_radiator_c":25.51,"timestamp":"1111-11-11T11:11:11Z"} +|Room;11776622;131;2023-02-08T02:00:00Z;1026;2019-12-31T02:00:00Z;22.44;25.51;1111-11-11 11:11.11 # FHKV radio 4 / EHKV vario 4 # There is a problem in the decoding here, the data stored inside the telegram does not seem to properly encode/decode the year.... # We should not report a current_date with a full year, if the year is actually not part of the telegram. telegram=|33446850341211119480A2_0F9F292D005024040011BD08380904000000070000000000000000000000000001000000000003140E| -{"media":"heat cost allocator","meter":"fhkvdataiii","name":"Room","id":"11111234","current_hca":4,"current_date":"2022-02-05T02:00:00Z","previous_hca":45,"previous_date":"2020-12-31T02:00:00Z","temp_room_c":22.37,"temp_radiator_c":23.6,"timestamp":"1111-11-11T11:11:11Z"} -|Room;11111234;4.000000;2022-02-05T02:00:00Z;45.000000;2020-12-31T02:00:00Z;22.370000;23.600000;1111-11-11 11:11.11 +{"media":"heat cost allocator","meter":"fhkvdataiii","name":"Room","id":"11111234","current_hca":4,"current_date":"2023-02-05T02:00:00Z","previous_hca":45,"previous_date":"2020-12-31T02:00:00Z","temp_room_c":22.37,"temp_radiator_c":23.6,"timestamp":"1111-11-11T11:11:11Z"} +|Room;11111234;4;2023-02-05T02:00:00Z;45;2020-12-31T02:00:00Z;22.37;23.6;1111-11-11 11:11.11 # Test FHKV data IV telegram=|4E4468507620541494087AAD004005089D86B62A329B3439873999738F82461ABDE3C7AC78692B363F3B41EB68607F9C9160F550769B065B6EA00A2E44346E29FF5DC5CB86283C69324AD33D137F6F| @@ -123,17 +123,17 @@ telegram=|5744b40988227711101b7ab20800000265a00842658f088201659f08226589081265a0 # Test Hydrus water meter telegram telegram=|4E44A5116464646470077AED004005_2F2F01FD08300C13741100007C1300000000FC101300000000FC201300000000726C00000B3B00000002FD748713025A6800C4016D3B177F2ACC011300020000| {"media":"water","meter":"hydrus","name":"HydrusWater","id":"64646464","total_m3":1.174,"total_tariff1_m3":0,"total_tariff2_m3":0,"max_flow_m3h":0,"flow_temperature_c":10.4,"external_temperature_c":0,"current_date":"","total_at_date_m3":0,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":0,"at_date":"2000-00-00 00:00","actuality_duration_s":0,"operating_time_h":0,"remaining_battery_life_y":13.686516,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -|HydrusWater;64646464;1.174000;0.000000;OK;1111-11-11 11:11.11 +|HydrusWater;64646464;1.174;0;OK;1111-11-11 11:11.11 # Test Hydrus new version water meter telegram telegram=|3E44A5116565656570067AFB0030052F2F_0C13503400000DFD110A383731303134423032410B3B00000002FD74DC15C4016D3B178D29CC0113313400002F2F| {"media":"warm water","meter":"hydrus","name":"HydrusVater","id":"65656565","total_m3":3.45,"total_tariff1_m3":0,"total_tariff2_m3":0,"max_flow_m3h":0,"flow_temperature_c":127,"external_temperature_c":0,"current_date":"","total_at_date_m3":3.431,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":0,"at_date":"2020-09-13 23:59","actuality_duration_s":0,"operating_time_h":0,"remaining_battery_life_y":15.321013,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -|HydrusVater;65656565;3.450000;0.000000;OK;1111-11-11 11:11.11 +|HydrusVater;65656565;3.45;3.431;OK;1111-11-11 11:11.11 # Test Hydrus with default AES encryption telegram=||6644242328001081640E7266567464A51170071F0050052C411A08674048DD6BA82A0DF79FFD401309179A893A1BE3CE8EDC50C2A45CD7AFEC3B4CE765820BE8056C124A17416C3722985FFFF7FCEB7094901AB3A16294B511B9A740C9F9911352B42A72FB3B0C| {"media":"water","meter":"hydrus","name":"HydrusAES","id":"64745666","total_m3":137.291,"total_tariff1_m3":0,"total_tariff2_m3":137.291,"max_flow_m3h":0,"flow_temperature_c":24.5,"external_temperature_c":23.9,"current_date":"2021-01-23 08:27","total_at_date_m3":128.638,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":128.638,"at_date":"2020-12-31 00:00","actuality_duration_s":6673,"operating_time_h":14678,"remaining_battery_life_y":0,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -|HydrusAES;64745666;137.291000;0.000000;OK;1111-11-11 11:11.11 +|HydrusAES;64745666;137.291;128.638;OK;1111-11-11 11:11.11 # Test BMeters HydroDigit water telegram telegram=|4E44B4098686868613077AF0004005_2F2F0C1366380000046D27287E2A0F150E00000000C10000D10000E60000FD00000C01002F0100410100540100680100890000A00000B30000002F2F2F2F2F2F| @@ -164,7 +164,7 @@ telegram=|5B445A149922992202378C20F6900F002C25BC9E0000BF48954821BC508D7299229922 # static telegram telegram=|7B4479169977997730378C208B900F002C25E4EF0A002EA98E7D58B3ADC57299779977991611028B005087102F2F#0DFD090F34302e3030562030303030303030300D790E31323334353637383839595345310DFD100AAAAAAAAAAAAAAAAAAAAA0D780E31323334353637383930594553312F2F2F2F2F2F2F2F2F2F2F| -{"media":"electricity","meter":"esyswm","name":"Elen2","id":"77997799","fabrication_no":"1SEY0987654321","enhanced_id":"1ESY9887654321","location":"AAAAAAAAAAAAAAAAAAAA","location_hex":"AAAAAAAAAAAAAAAAAAAA","total_energy_consumption_kwh":null,"current_power_consumption_kw":null,"total_energy_production_kwh":null,"total_energy_consumption_tariff1_kwh":null,"total_energy_consumption_tariff2_kwh":null,"current_power_consumption_phase1_kw":null,"current_power_consumption_phase2_kw":null,"current_power_consumption_phase3_kw":null,"version":"00000000 V00.04","timestamp":"1111-11-11T11:11:11Z"} +{"media":"electricity","meter":"esyswm","name":"Elen2","id":"77997799","fabrication_no":"1SEY0987654321","enhanced_id":"1ESY9887654321","location":"AAAAAAAAAAAAAAAAAAAA","location_hex":"AAAAAAAAAAAAAAAAAAAA","version":"00000000 V00.04","timestamp":"1111-11-11T11:11:11Z"} |Elen2;77997799;null;null;null;null;null;null;null;null;1ESY9887654321;1111-11-11 11:11.11 # dynamic telegram @@ -182,7 +182,7 @@ telegram=|5344A8159955995502028C201D900F002C250C390000ED176BBBB1591ADB7A1D003007 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 +|Vatten;004444dd;871.571;1111-11-11 11:11.11 # Test older version of water meter rfmtx1 @@ -205,12 +205,12 @@ telegram=|4E44B40512345678F1077A310040052F2F_01FD08040C13991848004C1359423500CC1 # Test Ultrimis water meter telegram=|2E4401069897969501167A4B0320052F2F_0413320C000003FD1700000044132109000004933C000000002F2F2F2F2F|+0 {"media":"cold water","meter":"ultrimis","name":"Uater","id":"95969798","total_m3":3.122,"target_m3":2.337,"current_status":"OK","total_backward_flow_m3":0,"timestamp":"1111-11-11T11:11:11Z"} -|Uater;95969798;3.122000;2.337000;OK;0.000000;1111-11-11 11:11.11 +|Uater;95969798;3.122;2.337;OK;0;1111-11-11 11:11.11 # Test Sensostar 2 heat meter telegram=|9E44C5147956341200047A7B0090052F2F_046D25248A2B04063D1F000001FD17000415265F00004406131F0000840106901E0000C40106841E0000840206841E0000C402067A1E0000840306541E0000C40306021E00008404069E1D0000C40406D71C0000840506F21B0000C40506681A00008406061E190000C40606EB1700008407061C170000C40706EE1600002F2F2F2F2F2F2F2F2F2F2F2F2F2F2F2F| -{"media":"heat","meter":"sensostar","name":"Heater","id":"12345679","meter_timestamp":"2020-11-10 04:37","total_kwh":7997,"total_water_m3":2435.8,"current_status":"OK","reporting_date":null,"energy_consumption_at_reporting_date_kwh":7955,"consumption_1_months_ago_kwh":7955,"consumption_2_months_ago_kwh":7824,"consumption_3_months_ago_kwh":7812,"consumption_4_months_ago_kwh":7812,"consumption_5_months_ago_kwh":7802,"consumption_6_months_ago_kwh":7764,"consumption_7_months_ago_kwh":7682,"consumption_8_months_ago_kwh":7582,"consumption_9_months_ago_kwh":7383,"consumption_10_months_ago_kwh":7154,"consumption_11_months_ago_kwh":6760,"consumption_12_months_ago_kwh":6430,"consumption_13_months_ago_kwh":6123,"consumption_14_months_ago_kwh":5916,"consumption_15_months_ago_kwh":5870,"timestamp":"1111-11-11T11:11:11Z"} -|Heater;12345679;7997.000000;2435.800000;OK;null;7955.000000;1111-11-11 11:11.11 +{"media":"heat","meter":"sensostar","name":"Heater","id":"12345679","meter_timestamp":"2020-11-10 04:37","total_kwh":7997,"total_water_m3":2435.8,"current_status":"OK","energy_consumption_at_reporting_date_kwh":7955,"consumption_1_months_ago_kwh":7955,"consumption_2_months_ago_kwh":7824,"consumption_3_months_ago_kwh":7812,"consumption_4_months_ago_kwh":7812,"consumption_5_months_ago_kwh":7802,"consumption_6_months_ago_kwh":7764,"consumption_7_months_ago_kwh":7682,"consumption_8_months_ago_kwh":7582,"consumption_9_months_ago_kwh":7383,"consumption_10_months_ago_kwh":7154,"consumption_11_months_ago_kwh":6760,"consumption_12_months_ago_kwh":6430,"consumption_13_months_ago_kwh":6123,"consumption_14_months_ago_kwh":5916,"consumption_15_months_ago_kwh":5870,"timestamp":"1111-11-11T11:11:11Z"} +|Heater;12345679;7997;2435.8;OK;null;7955;1111-11-11 11:11.11 # Test Elster V200H water meter telegram=|2E449215303099990D077AB50820452F2F_0C12495849004C12557545000FB10445007022C50BFFFFFFFF0000FFF000| @@ -256,7 +256,7 @@ telegram=|5E44A5112751617241047A8B0050052F2F0C0E000000000C13010000000B3B0000000C # Test Hydrometer/Diehl Metering Sharky 775 heat meter telegram=|534424232004256092687A370045752235854DEEEA5939FAD81C25FEEF5A23C38FB9168493C563F08DB10BAF87F660FBA91296BA2397E8F4220B86D3A192FB51E0BFCF24DCE72118E0C75A9E89F43BDFE370824B| {"media":"heat","meter":"sharky","name":"Sharky775","id":"68926025","total_energy_consumption_kwh":2651,"total_energy_consumption_tariff1_kwh":0,"total_volume_m3":150.347,"total_volume_tariff2_m3":0.018,"volume_flow_m3h":0,"power_kw":0,"flow_temperature_c":42.3,"return_temperature_c":28.1,"temperature_difference_c":14.1,"timestamp":"1111-11-11T11:11:11Z"} -|Sharky775;68926025;2651.000000;0.000000;150.347000;0.018000;0.000000;0.000000;42.300000;28.100000;14.100000;1111-11-11 11:11.11 +|Sharky775;68926025;2651;0;150.347;0.018;0;0;42.3;28.1;14.1;1111-11-11 11:11.11 # Test Apator Elf Heat meter telegram=|51440186010905001837721956880101064004DA000020026CA9220E017799241103000C13641320000A2D00000A5A90060A5E800544050E77000001FD0C010A6564370AFD4731030A274907047F00000002| @@ -271,17 +271,17 @@ telegram=|1E44A511909192937B077A9F0010052F2F_04130347030002FD1700002F2F2F| # Test IZAR RS 868 water meter telegram=|1E4424238B07797389607A8F00107D_041312170100426CBF23441344100100| {"media":"water","meter":"hydrus","name":"HydrusIzarRS","id":"60897379","total_m3":71.442,"total_tariff1_m3":0,"total_tariff2_m3":0,"max_flow_m3h":0,"flow_temperature_c":127,"external_temperature_c":0,"current_date":"","total_at_date_m3":69.7,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":0,"at_date":"2021-03-31 00:00","actuality_duration_s":0,"operating_time_h":0,"remaining_battery_life_y":0,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -|HydrusIzarRS;60897379;71.442000;0.000000;OK;1111-11-11 11:11.11 +|HydrusIzarRS;60897379;71.442;69.7;OK;1111-11-11 11:11.11 # Test IZAR RS 868 water meter warm telegram=|1E4424238B06204790607A2A0010D8_0413DDC00000426CBF23441382BB0000| {"media":"warm water","meter":"hydrus","name":"HydrusIzarRSWarm","id":"60904720","total_m3":49.373,"total_tariff1_m3":0,"total_tariff2_m3":0,"max_flow_m3h":0,"flow_temperature_c":127,"external_temperature_c":0,"current_date":"","total_at_date_m3":48.002,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":0,"at_date":"2021-03-31 00:00","actuality_duration_s":0,"operating_time_h":0,"remaining_battery_life_y":0,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -|HydrusIzarRSWarm;60904720;49.373000;0.000000;OK;1111-11-11 11:11.11 +|HydrusIzarRSWarm;60904720;49.373;48.002;OK;1111-11-11 11:11.11 # Test another Diehl branded meter with the izar protocol telegram=|19442423850798160018A2410100133EBBD44081053F243A82A3| {"media":"water","meter":"izar","name":"IzarWater4","id":"18001698","prefix":"","serial_number":"000000","total_m3":835.689,"last_month_total_m3":820.329,"last_month_measure_date":"2021-09-01","remaining_battery_life_y":0.5,"current_alarms":"no_alarm","previous_alarms":"no_alarm","transmit_period_s":8,"manufacture_year":"0","timestamp":"1111-11-11T11:11:11Z"} -|IzarWater4;18001698;;000000;835.689000;820.329000;2021-09-01;0.500000;no_alarm;no_alarm;8.000000;0;1111-11-11 11:11.11 +|IzarWater4;18001698;;000000;835.689;820.329;2021-09-01;0.5;no_alarm;no_alarm;8;0;1111-11-11 11:11.11 # Test Aventies Water Meter telegram=76442104710007612507727100076121042507B5006005E2E95A3C2A1279A5415E6732679B43369FD5FDDDD783EEEBB48236D34E7C94AF0A18A5FDA5F7D64111EB42D4D891622139F2952F9D12A20088DFA4CF8123871123EE1F6C1DCEA414879DDB4E05E508F1826D7EFBA6964DF804C9261EA23BBF03 diff --git a/src/driver_abbb23.cc b/src/driver_abbb23.cc index 428af70..63d7185 100644 --- a/src/driver_abbb23.cc +++ b/src/driver_abbb23.cc @@ -39,7 +39,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -49,7 +49,7 @@ namespace addStringFieldWithExtractor( "firmware_version", "Firmware version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::FirmwareVersion) @@ -59,7 +59,7 @@ namespace addStringFieldWithExtractor( "product_no", "The meter device product number.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build(). set(DifVifKey("0DFFAA00"))); } diff --git a/src/driver_amiplus.cc b/src/driver_amiplus.cc index 77ba740..9476b00 100644 --- a/src/driver_amiplus.cc +++ b/src/driver_amiplus.cc @@ -41,7 +41,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -52,7 +52,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption", "Current power consumption.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -63,7 +63,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production", "The total energy production recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -73,7 +73,7 @@ namespace addNumericFieldWithExtractor( "current_power_production", "Current power production.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -83,7 +83,7 @@ namespace addNumericFieldWithExtractor( "voltage_at_phase_1", "Voltage at phase L1.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Voltage, VifScaling::None, FieldMatcher::build() @@ -93,7 +93,7 @@ namespace addNumericFieldWithExtractor( "voltage_at_phase_2", "Voltage at phase L2.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Voltage, VifScaling::None, FieldMatcher::build() @@ -103,7 +103,7 @@ namespace addNumericFieldWithExtractor( "voltage_at_phase_3", "Voltage at phase L3.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Voltage, VifScaling::None, FieldMatcher::build() @@ -113,7 +113,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Device date time.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -122,7 +122,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_tariff_1", "The total energy consumption recorded by this meter on tariff 1.", - PrintProperty::JSON | PrintProperty::FIELD, // | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, // , Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -134,7 +134,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_tariff_2", "The total energy consumption recorded by this meter on tariff 2.", - PrintProperty::JSON | PrintProperty::FIELD, // | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, // , Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -146,7 +146,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_tariff_3", "The total energy consumption recorded by this meter on tariff 3.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -158,7 +158,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production_tariff_1", "The total energy production recorded by this meter on tariff 1.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -168,7 +168,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production_tariff_2", "The total energy production recorded by this meter on tariff 2.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -178,7 +178,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production_tariff_3", "The total energy production recorded by this meter on tariff 3.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -189,19 +189,17 @@ namespace // Test: MyElectricity1 amiplus 10101010 NOKEY // telegram=|4E4401061010101002027A00004005_2F2F0E035040691500000B2B300300066D00790C7423400C78371204860BABC8FC100000000E833C8074000000000BAB3C0000000AFDC9FC0136022F2F2F2F2F| -// {"media":"electricity","meter":"amiplus","name":"MyElectricity1","id":"10101010","total_energy_consumption_kwh":15694.05,"current_power_consumption_kw":0.33,"total_energy_production_kwh":7.48,"current_power_production_kw":0,"voltage_at_phase_1_v":236,"voltage_at_phase_2_v":null,"voltage_at_phase_3_v":null,"device_date_time":"2019-03-20 12:57:00","total_energy_consumption_tariff_1_kwh":null,"total_energy_consumption_tariff_2_kwh":null,"total_energy_consumption_tariff_3_kwh":null,"total_energy_production_tariff_1_kwh":null,"total_energy_production_tariff_2_kwh":null,"total_energy_production_tariff_3_kwh":null,"timestamp":"1111-11-11T11:11:11Z"} +// {"media":"electricity","meter":"amiplus","name":"MyElectricity1","id":"10101010","total_energy_consumption_kwh":15694.05,"current_power_consumption_kw":0.33,"total_energy_production_kwh":7.48,"current_power_production_kw":0,"voltage_at_phase_1_v":236,"device_date_time":"2019-03-20 12:57:00","timestamp":"1111-11-11T11:11:11Z"} // |MyElectricity1;10101010;15694.05;0.33;7.48;0;236;null;null;null;null;null;null;null;null;1111-11-11 11:11.11 // Test: MyElectricity2 amiplus 00254358 NOKEY -// amiplus/apator electricity meter with three phase voltages - +// Comment: amiplus/apator electricity meter with three phase voltages // telegram=|5E44B6105843250000027A2A005005_2F2F0C7835221400066D404708AC2A400E032022650900000E833C0000000000001B2B9647000B2B5510000BAB3C0000000AFDC9FC0135020AFDC9FC0245020AFDC9FC0339020BABC8FC100000002F2F| -// {"media":"electricity","meter":"amiplus","name":"MyElectricity2","id":"00254358","total_energy_consumption_kwh":9652.22,"current_power_consumption_kw":1.055,"total_energy_production_kwh":0,"current_power_production_kw":0,"voltage_at_phase_1_v":235,"voltage_at_phase_2_v":245,"voltage_at_phase_3_v":239,"device_date_time":"2021-10-12 08:07:00","total_energy_consumption_tariff_1_kwh":null,"total_energy_consumption_tariff_2_kwh":null,"total_energy_consumption_tariff_3_kwh":null,"total_energy_production_tariff_1_kwh":null,"total_energy_production_tariff_2_kwh":null,"total_energy_production_tariff_3_kwh":null,"timestamp":"1111-11-11T11:11:11Z"} +// {"media":"electricity","meter":"amiplus","name":"MyElectricity2","id":"00254358","total_energy_consumption_kwh":9652.22,"current_power_consumption_kw":1.055,"total_energy_production_kwh":0,"current_power_production_kw":0,"voltage_at_phase_1_v":235,"voltage_at_phase_2_v":245,"voltage_at_phase_3_v":239,"device_date_time":"2021-10-12 08:07:00","timestamp":"1111-11-11T11:11:11Z"} // |MyElectricity2;00254358;9652.22;1.055;0;0;235;245;239;null;null;null;null;null;null;1111-11-11 11:11.11 // Test: MyElectricity3 amiplus 86064864 NOKEY -// amiplus/apator electricity meter with three phase voltages and 2 tariffs - +// Comment: amiplus/apator electricity meter with three phase voltages and 2 tariffs. // telegram=|804401066448068602027A000070052F2F_066D1E5C11DA21400C78644806868E10036110012500008E20038106531800008E10833C9949000000008E20833C8606000000001B2B5228020B2B3217000BAB3C0000000AFDC9FC0131020AFDC9FC0225020AFDC9FC0331020BABC8FC100000002F2F2F2F2F2F2F2F2F2F2F2F2FDE47| -// {"media":"electricity","meter":"amiplus","name":"MyElectricity3","id":"86064864","total_energy_consumption_kwh":null,"current_power_consumption_kw":1.732,"total_energy_production_kwh":null,"current_power_production_kw":0,"voltage_at_phase_1_v":231,"voltage_at_phase_2_v":225,"voltage_at_phase_3_v":231,"device_date_time":"2022-01-26 17:28:30","total_energy_consumption_tariff_1_kwh":25011.061,"total_energy_consumption_tariff_2_kwh":18530.681,"total_energy_consumption_tariff_3_kwh":null,"total_energy_production_tariff_1_kwh":4.999,"total_energy_production_tariff_2_kwh":0.686,"total_energy_production_tariff_3_kwh":null,"timestamp":"1111-11-11T11:11:11Z"} +// {"media":"electricity","meter":"amiplus","name":"MyElectricity3","id":"86064864","current_power_consumption_kw":1.732,"current_power_production_kw":0,"voltage_at_phase_1_v":231,"voltage_at_phase_2_v":225,"voltage_at_phase_3_v":231,"device_date_time":"2022-01-26 17:28:30","total_energy_consumption_tariff_1_kwh":25011.061,"total_energy_consumption_tariff_2_kwh":18530.681,"total_energy_production_tariff_1_kwh":4.999,"total_energy_production_tariff_2_kwh":0.686,"timestamp":"1111-11-11T11:11:11Z"} // |MyElectricity3;86064864;null;1.732;null;0;231;225;231;25011.061;18530.681;null;4.999;0.686;null;1111-11-11 11:11.11 diff --git a/src/driver_apator08.cc b/src/driver_apator08.cc index 3a3350f..bfa508f 100644 --- a/src/driver_apator08.cc +++ b/src/driver_apator08.cc @@ -33,6 +33,7 @@ private: static bool ok = registerDriver([](DriverInfo&di) { di.setName("apator08"); + di.setDefaultFields("name,id,total_m3,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(0x8614/*APT?*/, 0x03, 0x03); @@ -44,7 +45,7 @@ MeterApator08::MeterApator08(MeterInfo &mi, DriverInfo &di) : MeterCommonImpleme addNumericField( "total", Quantity::Volume, - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, "The total water consumption recorded by this meter.", SET_FUNC(total_water_consumption_m3_, Unit::M3), GET_FUNC(total_water_consumption_m3_, Unit::M3)); @@ -83,4 +84,4 @@ void MeterApator08::processContent(Telegram *t) // Test: Vatten apator08 004444dd NOKEY // telegram=|73441486DD4444000303A0B9E527004C4034B31CED0106FF01D093270065F022009661230054D02300EC49240018B424005F012500936D2500FFD525000E3D26001EAC26000B2027000300000000371D0B2000000000000024000000000000280000000000002C0033150C010D2F000000000000| // {"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 +// |Vatten;004444dd;871.571;1111-11-11 11:11.11 diff --git a/src/driver_apator162.cc b/src/driver_apator162.cc index fd314cd..a509838 100644 --- a/src/driver_apator162.cc +++ b/src/driver_apator162.cc @@ -50,7 +50,7 @@ namespace addPrint("total", Quantity::Volume, [&](Unit u){ return convert(total_water_consumption_m3_, Unit::M3, u); }, "The total water consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } void Driver::processContent(Telegram *t) diff --git a/src/driver_apator172.cc b/src/driver_apator172.cc index ae78c25..597df4a 100644 --- a/src/driver_apator172.cc +++ b/src/driver_apator172.cc @@ -33,6 +33,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("apator172"); + di.setDefaultFields("name,id,total_m3,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addDetection(0x8614 /*APT?*/, 0x11, 0x04); di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new Driver(mi, di)); }); @@ -43,7 +44,7 @@ namespace addPrint("total", Quantity::Volume, [&](Unit u){ return convert(total_water_consumption_m3_, Unit::M3, u); }, "The total water consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } void Driver::processContent(Telegram *t) @@ -78,8 +79,8 @@ namespace // Test: Vattur apator172 0014a807 NOKEY // telegram=|1C44148607A814000411A0_1D5400000840030000000005FF05D83D0000| // {"media":"water","meter":"apator172","name":"Vattur","id":"0014a807","total_m3":7177.7,"timestamp":"1111-11-11T11:11:11Z"} -// |Vattur;0014a807;7177.700000;1111-11-11 11:11.11 +// |Vattur;0014a807;7177.7;1111-11-11 11:11.11 // telegram=|1C44148607A814000411A0_215400000840030000000005FF05D83D0000| // {"media":"water","meter":"apator172","name":"Vattur","id":"0014a807","total_m3":7179,"timestamp":"1111-11-11T11:11:11Z"} -// |Vattur;0014a807;7179.000000;1111-11-11 11:11.11 +// |Vattur;0014a807;7179;1111-11-11 11:11.11 diff --git a/src/driver_apatoreitn.cc b/src/driver_apatoreitn.cc index ed5f543..5f866e0 100644 --- a/src/driver_apatoreitn.cc +++ b/src/driver_apatoreitn.cc @@ -54,37 +54,37 @@ namespace addPrint("current", Quantity::HCA, [&](Unit u){ return convert(curr_energy_hca_, Unit::HCA, u);}, "Energy consumption so far in this billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("previous", Quantity::HCA, [&](Unit u){ return convert(prev_energy_hca_, Unit::HCA, u); }, "Energy consumption in previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("current_date", Quantity::Text, [&](){ return curr_energy_hca_date_; }, "Current date, as reported by meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("season_start_date", Quantity::Text, [&](){ return season_start_date_; }, "Season start date.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("esb_date", Quantity::Text, [&](){ return esb_date_; }, "Electronic seal protection break date.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("temp_room_avg", Quantity::Temperature, [&](Unit u){ return convert(temp_room_avg_, Unit::C, u); }, "Average room temperature in current season.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("temp_room_prev_avg", Quantity::Temperature, [&](Unit u){ return convert(temp_room_prev_avg_, Unit::C, u); }, "Average room temperature in previous season.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } void Driver::processContent(Telegram *t) diff --git a/src/driver_auto.cc b/src/driver_auto.cc index c36fc63..6d15c9e 100644 --- a/src/driver_auto.cc +++ b/src/driver_auto.cc @@ -29,6 +29,7 @@ struct MeterAuto : public virtual MeterCommonImplementation bool ok = registerDriver([](DriverInfo&di) { di.setName("auto"); + di.setDefaultFields("name,id,timestamp"); di.setMeterType(MeterType::AutoMeter); di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new MeterAuto(mi, di)); }); }); diff --git a/src/driver_aventieshca.cc b/src/driver_aventieshca.cc index c1b961e..ea63b7e 100644 --- a/src/driver_aventieshca.cc +++ b/src/driver_aventieshca.cc @@ -39,8 +39,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status from error flags and tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -67,7 +66,7 @@ namespace addStringFieldWithExtractorAndLookup( "error_flags", "Deprecated.", - PrintProperty::JSON | PrintProperty::DEPRECATED, + DEFAULT_PRINT_PROPERTIES | PrintProperty::DEPRECATED, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -94,7 +93,7 @@ namespace addNumericFieldWithExtractor( "current_consumption", "The current heat cost allocation.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -105,7 +104,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "Heat cost allocation at the most recent billing period date.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -117,7 +116,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_{storage_counter}", "The heat cost allocation at set date #.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_aventieswm.cc b/src/driver_aventieswm.cc index e4083bc..4f2c8d8 100644 --- a/src/driver_aventieswm.cc +++ b/src/driver_aventieswm.cc @@ -40,8 +40,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status from error flags and tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -68,7 +67,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -79,7 +78,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_{storage_counter}", "Water consumption at the # billing period date.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -92,7 +91,7 @@ namespace addStringFieldWithExtractorAndLookup( "error_flags", "Deprecated.", - PrintProperty::JSON | PrintProperty::DEPRECATED, + DEFAULT_PRINT_PROPERTIES | PrintProperty::DEPRECATED, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), diff --git a/src/driver_bfw240radio.cc b/src/driver_bfw240radio.cc index 351a690..e0242d3 100644 --- a/src/driver_bfw240radio.cc +++ b/src/driver_bfw240radio.cc @@ -47,12 +47,12 @@ namespace addPrint("current", Quantity::HCA, [&](Unit u){ return convert(current_hca_, Unit::HCA, u);}, "Energy consumption so far in this billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("prev", Quantity::HCA, [&](Unit u){ return convert(prev_hca_, Unit::HCA, u); }, "Energy consumption at end of previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); for (int i=0; i<18; ++i) { @@ -61,13 +61,13 @@ namespace addPrint(info, Quantity::HCA, [this,i](Unit u){ return convert(historic_hca_[i], Unit::HCA, u);}, - about, PrintProperty::JSON); + about, DEFAULT_PRINT_PROPERTIES); } addPrint("device_date", Quantity::Text, [&](){ return device_date_; }, "Device date when telegram was sent.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } diff --git a/src/driver_c5isf.cc b/src/driver_c5isf.cc index 77bfd16..bd4593a 100644 --- a/src/driver_c5isf.cc +++ b/src/driver_c5isf.cc @@ -51,15 +51,17 @@ namespace }; static bool ok = registerDriver([](DriverInfo&di) - { - di.setName("c5isf"); - di.setMeterType(MeterType::HeatMeter); - di.addLinkMode(LinkMode::T1); - di.addDetection(MANUFACTURER_ZRI, 0x0d, 0x88); // Telegram type T1A1 - di.addDetection(MANUFACTURER_ZRI, 0x07, 0x88); // Telegram type T1A2 - di.addDetection(MANUFACTURER_ZRI, 0x04, 0x88); // Telegram type T1B - di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new Driver(mi, di)); }); - }); + { + di.setName("c5isf"); + di.setDefaultFields("name,id,total_energy_consumption_kwh,total_volume_m3,status,timestamp"); + + di.setMeterType(MeterType::HeatMeter); + di.addLinkMode(LinkMode::T1); + di.addDetection(MANUFACTURER_ZRI, 0x0d, 0x88); // Telegram type T1A1 + di.addDetection(MANUFACTURER_ZRI, 0x07, 0x88); // Telegram type T1A2 + di.addDetection(MANUFACTURER_ZRI, 0x04, 0x88); // Telegram type T1B + di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new Driver(mi, di)); }); + }); Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) { @@ -68,7 +70,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total heat energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -79,7 +81,7 @@ namespace addNumericFieldWithExtractor( "total_volume", "The total heating media volume recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -92,8 +94,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags), { @@ -134,7 +135,7 @@ namespace addStringFieldWithExtractor( tostrprintf("prev_%d_month", i+1), "The due date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(StorageNr(32+i)) @@ -149,7 +150,7 @@ namespace addNumericFieldWithExtractor( tostrprintf("prev_%d_month", i+1), "The total heat energy consumption recorded at end of previous month.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -166,7 +167,7 @@ namespace addNumericFieldWithExtractor( tostrprintf("prev_%d_month", i+1), tostrprintf("Previous month %d last date.", i+1), - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -181,7 +182,7 @@ namespace addNumericFieldWithExtractor( "due_energy_consumption", "The total heat energy consumption at the due date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -193,7 +194,7 @@ namespace addStringFieldWithExtractor( "due_date", "The due date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(StorageNr(8)) @@ -203,7 +204,7 @@ namespace addNumericFieldWithExtractor( "volume_flow", "The current heat media volume flow.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -214,7 +215,7 @@ namespace addNumericFieldWithExtractor( "power", "The current power consumption.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -225,7 +226,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_last_month", "The total heat energy consumption recorded at end of last month.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -237,7 +238,7 @@ namespace addStringFieldWithExtractor( "last_month_date", "The due date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -246,7 +247,7 @@ namespace addNumericFieldWithExtractor( "max_power_last_month", "Maximum power consumption last month.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -259,7 +260,7 @@ namespace addNumericFieldWithExtractor( "flow_temperature", "The current forward heat media temperature.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -270,7 +271,7 @@ namespace addNumericFieldWithExtractor( "return_temperature", "The current return heat media temperature.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -284,21 +285,21 @@ namespace // telegram=|E544496A55554455880D7A320200002F2F_04060000000004130000000002FD17240084800106000000008280016C2124C480010600000080C280016CFFFF84810106000000808281016CFFFFC481010600000080C281016CFFFF84820106000000808282016CFFFFC482010600000080C282016CFFFF84830106000000808283016CFFFFC483010600000080C283016CFFFF84840106000000808284016CFFFFC484010600000080C284016CFFFF84850106000000808285016CFFFFC485010600000080C285016CFFFF84860106000000808286016CFFFFC486010600000080C286016CFFFF| // {"media":"heat/cooling load","meter":"c5isf","name":"Heat","id":"55445555","total_energy_consumption_kwh":0,"total_volume_m3":0,"status":"ERROR REVERSE_FLOW SUPPLY_SENSOR_INTERRUPTED","prev_1_month":"2017-04-01","prev_2_month":"2127-15-31","prev_3_month":"2127-15-31","prev_4_month":"2127-15-31","prev_5_month":"2127-15-31","prev_6_month":"2127-15-31","prev_7_month":"2127-15-31","prev_8_month":"2127-15-31","prev_9_month":"2127-15-31","prev_10_month":"2127-15-31","prev_11_month":"2127-15-31","prev_12_month":"2127-15-31","prev_13_month":"2127-15-31","prev_14_month":"2127-15-31","prev_1_month_kwh":0,"prev_2_month_kwh":2147483648,"prev_3_month_kwh":2147483648,"prev_4_month_kwh":2147483648,"prev_5_month_kwh":2147483648,"prev_6_month_kwh":2147483648,"prev_7_month_kwh":2147483648,"prev_8_month_kwh":2147483648,"prev_9_month_kwh":2147483648,"prev_10_month_kwh":2147483648,"prev_11_month_kwh":2147483648,"prev_12_month_kwh":2147483648,"prev_13_month_kwh":2147483648,"prev_14_month_kwh":2147483648,"total_energy_consumption_last_month_kwh":0,"timestamp":"1111-11-11T11:11:11Z"} -// |Heat;55445555;0.000000;0.000000;ERROR REVERSE_FLOW SUPPLY_SENSOR_INTERRUPTED;1111-11-11 11:11.11 +// |Heat;55445555;0;0;ERROR REVERSE_FLOW SUPPLY_SENSOR_INTERRUPTED;1111-11-11 11:11.11 // Type T1A2 telegram: // telegram=|DA44496A5555445588077A320200002F2F_04140000000084800114000000008280016C2124C480011400000080C280016CFFFF84810114000000808281016CFFFFC481011400000080C281016CFFFF84820114000000808282016CFFFFC482011400000080C282016CFFFF84830114000000808283016CFFFFC483011400000080C283016CFFFF84840114000000808284016CFFFFC484011400000080C284016CFFFF84850114000000808285016CFFFFC485011400000080C285016CFFFF84860114000000808286016CFFFFC486011400000080C286016CFFFF| // {"media":"water","meter":"c5isf","name":"Heat","id":"55445555","total_energy_consumption_kwh":0,"total_volume_m3":0,"status":"ERROR","prev_1_month":"2017-04-01","prev_2_month":"2127-15-31","prev_3_month":"2127-15-31","prev_4_month":"2127-15-31","prev_5_month":"2127-15-31","prev_6_month":"2127-15-31","prev_7_month":"2127-15-31","prev_8_month":"2127-15-31","prev_9_month":"2127-15-31","prev_10_month":"2127-15-31","prev_11_month":"2127-15-31","prev_12_month":"2127-15-31","prev_13_month":"2127-15-31","prev_14_month":"2127-15-31","prev_1_month_m3":0,"prev_2_month_m3":21474836.48,"prev_3_month_m3":21474836.48,"prev_4_month_m3":21474836.48,"prev_5_month_m3":21474836.48,"prev_6_month_m3":21474836.48,"prev_7_month_m3":21474836.48,"prev_8_month_m3":21474836.48,"prev_9_month_m3":21474836.48,"prev_10_month_m3":21474836.48,"prev_11_month_m3":21474836.48,"prev_12_month_m3":21474836.48,"prev_13_month_m3":21474836.48,"prev_14_month_m3":21474836.48,"total_energy_consumption_last_month_kwh":0,"timestamp":"1111-11-11T11:11:11Z"} -// |Heat;55445555;0.000000;0.000000;ERROR;1111-11-11 11:11.11 +// |Heat;55445555;0;0;ERROR;1111-11-11 11:11.11 // Type T1B telegram: // telegram=|5E44496A5555445588047A0A0050052F2F_04061A0000000413C20800008404060000000082046CC121043BA4000000042D1900000002591216025DE21002FD17000084800106000000008280016CC121948001AE25000000002F2F2F2F2F2F| // {"media":"heat","meter":"c5isf","name":"Heat","id":"55445555","total_energy_consumption_kwh":26,"total_volume_m3":2.242,"status":"OK","prev_1_month":"2022-01-01","prev_2_month":"2127-15-31","prev_3_month":"2127-15-31","prev_4_month":"2127-15-31","prev_5_month":"2127-15-31","prev_6_month":"2127-15-31","prev_7_month":"2127-15-31","prev_8_month":"2127-15-31","prev_9_month":"2127-15-31","prev_10_month":"2127-15-31","prev_11_month":"2127-15-31","prev_12_month":"2127-15-31","prev_13_month":"2127-15-31","prev_14_month":"2127-15-31","prev_1_month_kwh":0,"prev_2_month_kwh":2147483648,"prev_3_month_kwh":2147483648,"prev_4_month_kwh":2147483648,"prev_5_month_kwh":2147483648,"prev_6_month_kwh":2147483648,"prev_7_month_kwh":2147483648,"prev_8_month_kwh":2147483648,"prev_9_month_kwh":2147483648,"prev_10_month_kwh":2147483648,"prev_11_month_kwh":2147483648,"prev_12_month_kwh":2147483648,"prev_13_month_kwh":2147483648,"prev_14_month_kwh":2147483648,"prev_2_month_m3":21474836.48,"prev_3_month_m3":21474836.48,"prev_4_month_m3":21474836.48,"prev_5_month_m3":21474836.48,"prev_6_month_m3":21474836.48,"prev_7_month_m3":21474836.48,"prev_8_month_m3":21474836.48,"prev_9_month_m3":21474836.48,"prev_10_month_m3":21474836.48,"prev_11_month_m3":21474836.48,"prev_12_month_m3":21474836.48,"prev_13_month_m3":21474836.48,"prev_14_month_m3":21474836.48,"due_energy_consumption_kwh":0,"due_date":"2022-01-01","volume_flow_m3h":0.164,"power_kw":2.5,"total_energy_consumption_last_month_kwh":0,"max_power_last_month_kw":0,"flow_temperature_c":56.5,"return_temperature_c":43.22,"timestamp":"1111-11-11T11:11:11Z"} -// |Heat;55445555;26.000000;2.242000;OK;1111-11-11 11:11.11 +// |Heat;55445555;26;2.242;OK;1111-11-11 11:11.11 // Test: Heat c5isf 32002044 NOKEY // Test telegram with max_power_last_month_kwh which is non-zero // telegram=|5E44496A4420003288047AFC0050052F2F_0406D00E00000413B28A05008404060000000082046CC121043B00000000042D000000000259E719025D051402FD17000084800106C00C00008280016CC125948001AE25090000002F2F2F2F2F2F| // {"media":"heat","meter":"c5isf","name":"Heat","id":"32002044","total_energy_consumption_kwh":3792,"total_volume_m3":363.186,"status":"OK","prev_1_month":"2022-05-01","prev_1_month_kwh":3264,"due_energy_consumption_kwh":0,"due_date":"2022-01-01","volume_flow_m3h":0,"power_kw":0,"total_energy_consumption_last_month_kwh":3264,"max_power_last_month_kw":9,"flow_temperature_c":66.31,"return_temperature_c":51.25,"timestamp":"1111-11-11T11:11:11Z"} -// |Heat;32002044;3792.000000;363.186000;OK;1111-11-11 11:11.11 +// |Heat;32002044;3792;363.186;OK;1111-11-11 11:11.11 diff --git a/src/driver_cma12w.cc b/src/driver_cma12w.cc index e947f6d..9664973 100644 --- a/src/driver_cma12w.cc +++ b/src/driver_cma12w.cc @@ -44,13 +44,12 @@ namespace addStringField( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "current_temperature", "The current temperature.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -61,7 +60,7 @@ namespace addNumericFieldWithExtractor( "average_temperature_1h", "The average temperature over the last hour.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -73,7 +72,7 @@ namespace addStringFieldWithExtractorAndLookup( "battery", "Battery status.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DigitalInput), diff --git a/src/driver_compact5.cc b/src/driver_compact5.cc index dc96073..7ea5180 100644 --- a/src/driver_compact5.cc +++ b/src/driver_compact5.cc @@ -51,17 +51,17 @@ namespace addPrint("total", Quantity::Energy, [&](Unit u){ return convert(total_energy_kwh_, Unit::KWH, u); }, "The total energy consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("current", Quantity::Energy, [&](Unit u){ return convert(curr_energy_kwh_, Unit::KWH, u); }, "Energy consumption so far in this billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("previous", Quantity::Energy, [&](Unit u){ return convert(prev_energy_kwh_, Unit::KWH, u); }, "Energy consumption in previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } void Driver::processContent(Telegram *t) diff --git a/src/driver_dme_07.cc b/src/driver_dme_07.cc index 2093c0a..f00fb41 100644 --- a/src/driver_dme_07.cc +++ b/src/driver_dme_07.cc @@ -39,7 +39,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status of meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -59,7 +59,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_ebzwmbe.cc b/src/driver_ebzwmbe.cc index 0de964c..5c93fd1 100644 --- a/src/driver_ebzwmbe.cc +++ b/src/driver_ebzwmbe.cc @@ -39,7 +39,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -50,7 +50,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption_phase1", "Current power consumption at phase 1.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -60,7 +60,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption_phase2", "Current power consumption at phase 2.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -70,7 +70,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption_phase3", "Current power consumption at phase 3.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -80,7 +80,7 @@ namespace addStringFieldWithExtractor( "customer", "Customer name.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Customer) @@ -90,7 +90,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption", "Calculated sum of power consumption of all phases.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -102,7 +102,7 @@ namespace addNumericFieldWithCalculator( "current_power_consumption", "Calculated sum of power consumption of all phases.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, "current_power_consumption_phase1_kw + current_power_consumption_phase2_kw + current_power_consumption_phase3_kw" ); diff --git a/src/driver_ehzp.cc b/src/driver_ehzp.cc index d417d21..a6c3920 100644 --- a/src/driver_ehzp.cc +++ b/src/driver_ehzp.cc @@ -38,15 +38,14 @@ namespace addStringField( "status", "Meter status. Includes both meter error field and tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addOptionalCommonFields("on_time_h"); addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -57,7 +56,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption", "Current power consumption.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -68,7 +67,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production", "The total energy production recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_ei6500.cc b/src/driver_ei6500.cc index f7940e8..e0d7300 100644 --- a/src/driver_ei6500.cc +++ b/src/driver_ei6500.cc @@ -27,6 +27,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("ei6500"); + di.setDefaultFields("name,id,status,last_alarm_date,alarm_counter,timestamp"); di.setMeterType(MeterType::SmokeDetector); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_EIE, 0x1a, 0x0c); @@ -45,8 +46,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter error flags. IMPORTANT! Smoke alarm is NOT reported here! You MUST check last alarm date and counter!", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags), Translate::Lookup( @@ -77,7 +77,7 @@ namespace addStringFieldWithExtractor( "last_alarm_date", "Date when the smoke alarm last triggered.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(SubUnitNr(1)) @@ -88,7 +88,7 @@ namespace addNumericFieldWithExtractor( "alarm", "Number of times the smoke alarm has triggered.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -101,7 +101,7 @@ namespace addStringFieldWithExtractor( "software_version", "Meter software version number.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::SoftwareVersion) @@ -110,7 +110,7 @@ namespace addStringFieldWithExtractor( "message_datetime", "Device date time.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -119,7 +119,7 @@ namespace addNumericFieldWithExtractor( "duration_removed", "Time the smoke alarm has been removed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -132,7 +132,7 @@ namespace addStringFieldWithExtractor( "last_remove_date", "Date when the smoke alarm was last removed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(SubUnitNr(1)) @@ -143,7 +143,7 @@ namespace addNumericFieldWithExtractor( "removed", "Number of times the smoke alarm has been removed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -156,7 +156,7 @@ namespace addStringFieldWithExtractor( "test_button_last_date", "Date when test button was last pressed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(SubUnitNr(1)) @@ -167,7 +167,7 @@ namespace addNumericFieldWithExtractor( "test_button", "Number of times the test button has been pressed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -180,7 +180,7 @@ namespace addStringFieldWithExtractor( "installation_date", "Date when the smoke alarm was installed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(TariffNr(2)) @@ -190,7 +190,7 @@ namespace addStringFieldWithExtractor( "last_sound_check_date", "Date when the smoke alarm last checked the piezo speaker.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(StorageNr(1)) @@ -200,7 +200,7 @@ namespace addStringFieldWithExtractorAndLookup( "dust_level", "Dust level 0 (best) to 15 (worst).", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("8440FF2C")), Translate::Lookup( @@ -220,7 +220,7 @@ namespace addStringFieldWithExtractorAndLookup( "battery_level", "Battery voltage level.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("8440FF2C")), Translate::Lookup( @@ -259,7 +259,7 @@ namespace addStringFieldWithExtractorAndLookup( "obstacle_distance", "The distance to a detected obstacle.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("8440FF2C")), Translate::Lookup( @@ -289,7 +289,7 @@ namespace addStringFieldWithExtractorAndLookup( "head_status", "Status of smoke detector sensors, merged into the status field.", - PrintProperty::JOIN_INTO_STATUS, + PrintProperty::INJECT_INTO_STATUS | PrintProperty::HIDE, FieldMatcher::build() .set(DifVifKey("8440FF2C")), Translate::Lookup( @@ -329,16 +329,16 @@ namespace // Test: Smokey ei6500 01097274 NOKEY // telegram=|58442515747209010C1A7A8B0000000BFD0F070101046D2A06D82502FD17000082206CD825426CD0238440FF2C000F11008250FD61000082506C01018260FD6100008360FD3100000082606C01018270FD61000082706C0101| // {"media":"smoke detector","meter":"ei6500","name":"Smokey","id":"01097274","status":"OK","last_alarm_date":"2000-01-01","alarm_counter":0,"software_version":"010107","message_datetime":"2022-05-24 06:42","duration_removed_h":0,"last_remove_date":"2000-01-01","removed_counter":0,"test_button_last_date":"2000-01-01","test_button_counter":0,"installation_date":"2022-05-24","last_sound_check_date":"2022-03-16","dust_level":"DUST_0","battery_level":"3.00V","obstacle_distance":"","timestamp":"1111-11-11T11:11:11Z"} -// |Smokey;01097274;OK;2000-01-01;0.000000;1111-11-11 11:11.11 +// |Smokey;01097274;OK;2000-01-01;0;1111-11-11 11:11.11 // telegram=|58442515747209010C1A7A8D0000000BFD0F070101046D2E06D82502FD17000082206CD825426CD0238440FF2C000F11008250FD61000082506C01018260FD6100008360FD3100000082606C01018270FD61020082706CD825| // {"media":"smoke detector","meter":"ei6500","name":"Smokey","id":"01097274","status":"OK","last_alarm_date":"2000-01-01","alarm_counter":0,"software_version":"010107","message_datetime":"2022-05-24 06:46","duration_removed_h":0,"last_remove_date":"2000-01-01","removed_counter":0,"test_button_last_date":"2022-05-24","test_button_counter":2,"installation_date":"2022-05-24","last_sound_check_date":"2022-03-16","dust_level":"DUST_0","battery_level":"3.00V","obstacle_distance":"","timestamp":"1111-11-11T11:11:11Z"} -// |Smokey;01097274;OK;2000-01-01;0.000000;1111-11-11 11:11.11 +// |Smokey;01097274;OK;2000-01-01;0;1111-11-11 11:11.11 // telegram=|58442515747209010C1A7A900000000BFD0F070101046D3406D82502FD17000082206CD825426CD0238440FF2C020F11008250FD61010082506CD8258260FD6100008360FD3100000082606C01018270FD61020082706CD825| // {"media":"smoke detector","meter":"ei6500","name":"Smokey","id":"01097274","status":"OK","last_alarm_date":"2022-05-24","alarm_counter":1,"software_version":"010107","message_datetime":"2022-05-24 06:52","duration_removed_h":0,"last_remove_date":"2000-01-01","removed_counter":0,"test_button_last_date":"2022-05-24","test_button_counter":2,"installation_date":"2022-05-24","last_sound_check_date":"2022-03-16","dust_level":"DUST_2","battery_level":"3.00V","obstacle_distance":"","timestamp":"1111-11-11T11:11:11Z"} -// |Smokey;01097274;OK;2022-05-24;1.000000;1111-11-11 11:11.11 +// |Smokey;01097274;OK;2022-05-24;1;1111-11-11 11:11.11 // telegram=|58442515747209010C1A7A940000000BFD0F070101046D0007D82502FD17000082206CD825426CD0238440FF2C420F11008250FD61010082506CD8258260FD6101008360FD3101000082606CD8258270FD61020082706CD825| // {"media":"smoke detector","meter":"ei6500","name":"Smokey","id":"01097274","status":"TAMPER_WHILE_REMOVED","last_alarm_date":"2022-05-24","alarm_counter":1,"software_version":"010107","message_datetime":"2022-05-24 07:00","duration_removed_h":0.016667,"last_remove_date":"2022-05-24","removed_counter":1,"test_button_last_date":"2022-05-24","test_button_counter":2,"installation_date":"2022-05-24","last_sound_check_date":"2022-03-16","dust_level":"DUST_2","battery_level":"3.00V","obstacle_distance":"","timestamp":"1111-11-11T11:11:11Z"} -// |Smokey;01097274;TAMPER_WHILE_REMOVED;2022-05-24;1.000000;1111-11-11 11:11.11 +// |Smokey;01097274;TAMPER_WHILE_REMOVED;2022-05-24;1;1111-11-11 11:11.11 diff --git a/src/driver_elf.cc b/src/driver_elf.cc index 913d9b1..e12c4f3 100644 --- a/src/driver_elf.cc +++ b/src/driver_elf.cc @@ -38,8 +38,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status from manufacturer status and tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(DifVifKey("047F")), { @@ -59,7 +58,7 @@ namespace addStringFieldWithExtractor( "meter_date", "The meter date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -68,7 +67,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -79,7 +78,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption", "Current power consumption.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -90,7 +89,7 @@ namespace addNumericFieldWithExtractor( "total_volume", "Total volume of heat media.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -101,7 +100,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_at_date", "The total energy consumption recorded at the target date.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -113,7 +112,7 @@ namespace addNumericFieldWithExtractor( "flow_temperature", "The flow temperature.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -124,7 +123,7 @@ namespace addNumericFieldWithExtractor( "return_temperature", "The return temperature.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -135,7 +134,7 @@ namespace addNumericFieldWithExtractor( "external_temperature", "The external temperature.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -146,7 +145,7 @@ namespace addNumericFieldWithExtractor( "operating_time", "How long the meter has been collecting data.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -157,7 +156,7 @@ namespace addStringFieldWithExtractor( "version", "version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ModelVersion) @@ -166,7 +165,7 @@ namespace addNumericFieldWithExtractor( "battery", "Battery voltage.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Voltage, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_em24.cc b/src/driver_em24.cc index 65efcee..3974d03 100644 --- a/src/driver_em24.cc +++ b/src/driver_em24.cc @@ -44,7 +44,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status of meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT | PrintProperty::STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -71,7 +71,7 @@ namespace addStringFieldWithExtractorAndLookup( "error", "Any errors currently being reported, this field is deprecated and replaced by the status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | PrintProperty::DEPRECATED, + DEFAULT_PRINT_PROPERTIES | PrintProperty::DEPRECATED, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -98,7 +98,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -109,7 +109,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production", "The total energy backward (production) recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -121,7 +121,7 @@ namespace addNumericFieldWithExtractor( "total_reactive_energy_consumption", "The reactive total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Reactive_Energy, VifScaling::None, FieldMatcher::build() @@ -131,7 +131,7 @@ namespace addNumericFieldWithExtractor( "total_reactive_energy_production", "The total reactive energy backward (production) recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Reactive_Energy, VifScaling::None, FieldMatcher::build() @@ -142,7 +142,7 @@ namespace addNumericFieldWithCalculator( "total_apparent_energy_consumption", "Calculated: the total apparent energy consumption.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Apparent_Energy, "sqrt(" " (total_energy_consumption_kwh * total_energy_consumption_kwh) " @@ -153,7 +153,7 @@ namespace addNumericFieldWithCalculator( "total_apparent_energy_production", "Calculated: the total apparent energy production.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Apparent_Energy, R"STR( sqrt( (total_energy_production_kwh * total_energy_production_kwh) + diff --git a/src/driver_emerlin868.cc b/src/driver_emerlin868.cc index d919a35..3a0741f 100644 --- a/src/driver_emerlin868.cc +++ b/src/driver_emerlin868.cc @@ -40,7 +40,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -51,7 +51,7 @@ namespace addNumericFieldWithExtractor( "target", "The target water consumption recorded at previous period.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -62,7 +62,7 @@ namespace addStringFieldWithExtractor( "target_date", "Date when previous period ended.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) diff --git a/src/driver_enercal.cc b/src/driver_enercal.cc index 7f603be..b2eab2a 100644 --- a/src/driver_enercal.cc +++ b/src/driver_enercal.cc @@ -26,6 +26,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("enercal"); + di.setDefaultFields("name,id,status,total_kwh,target_kwh,total_m3,target_m3,timestamp"); di.setMeterType(MeterType::HeatMeter); di.addLinkMode(LinkMode::MBUS); di.addDetection(MANUFACTURER_GWF, 0x04, 0x08); @@ -37,13 +38,12 @@ namespace addStringField( "status", "Meter status.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "total", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -54,7 +54,7 @@ namespace addNumericFieldWithExtractor( "target", "The energy consumption recorded by this meter at the set date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -66,7 +66,7 @@ namespace addNumericFieldWithExtractor( "power", "The active power consumption.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -77,7 +77,7 @@ namespace addNumericFieldWithExtractor( "flow", "The flow of water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -88,7 +88,7 @@ namespace addNumericFieldWithExtractor( "flow_max", "The maximum forward flow of water since the last set date?", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -99,7 +99,7 @@ namespace addNumericFieldWithExtractor( "forward", "The forward temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -110,7 +110,7 @@ namespace addNumericFieldWithExtractor( "return", "The return temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -121,7 +121,7 @@ namespace addNumericFieldWithExtractor( "difference", "The temperature difference forward-return for the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::AutoSigned, FieldMatcher::build() @@ -132,7 +132,7 @@ namespace addNumericFieldWithExtractor( "total", "The total amount of water that has passed through this meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -143,7 +143,7 @@ namespace addNumericFieldWithExtractor( "target", "The amount of water that had passed through this meter at the set date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -155,7 +155,7 @@ namespace addNumericFieldWithExtractor( "subunit1", "The amount of water that has passed through subunit 1.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -167,7 +167,7 @@ namespace addNumericFieldWithExtractor( "subunit1_target", "The amount of water that had passed through the subunit 1 at the set date.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -180,7 +180,7 @@ namespace addNumericFieldWithExtractor( "subunit1", "The current heat cost allocation for subunit 1.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -192,7 +192,7 @@ namespace addNumericFieldWithExtractor( "subunit1_target", "The heat cost allocation for subunit 1 at the target date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -205,7 +205,7 @@ namespace addNumericFieldWithExtractor( "subunit2", "The current heat cost allocation for subunit 2.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -217,7 +217,7 @@ namespace addNumericFieldWithExtractor( "subunit2_target", "The heat cost allocation for subunit 2 at the target date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -230,7 +230,7 @@ namespace addStringFieldWithExtractor( "target_date", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -245,4 +245,4 @@ namespace // Comment: // telegram=|688e8e6808017224993000e61e080406000000040681460600041488f2350084401426e02600025B2600025f220002622a00042247880200042647880200043B00000000042c00000000046d2d0ede2784406e000000008480406e00000000c4800006B1450600c48000143Be43500c4c000142fd22600c4c0006e00000000c480406e00000000c280006cc1271f00000000f416| // {"media":"heat","meter":"enercal","name":"Heat","id":"00309924","status":"OK","total_kwh":411265,"target_kwh":411057,"power_kw":0,"flow_m3h":0,"forward_c":38,"return_c":34,"difference_c":4.2,"total_m3":35354.96,"target_m3":35318.35,"subunit1_m3":25477.5,"subunit1_target_m3":25441.75,"subunit1_hca":0,"subunit1_target_hca":0,"subunit2_hca":0,"subunit2_target_hca":0,"target_date":"2022-07-01","operating_time_h":165959,"on_time_h":165959,"meter_datetime":"2022-07-30 14:45","timestamp":"1111-11-11T11:11:11Z"} -// |Heat;00309924;OK;411265.000000;411057.000000;35354.960000;35318.350000;1111-11-11 11:11.11 +// |Heat;00309924;OK;411265;411057;35354.96;35318.35;1111-11-11 11:11.11 diff --git a/src/driver_engelmann-faw.cc b/src/driver_engelmann-faw.cc index cecb6b5..0440410 100644 --- a/src/driver_engelmann-faw.cc +++ b/src/driver_engelmann-faw.cc @@ -27,7 +27,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("engelmann-faw"); - di.setMeterType(MeterType::WaterMeter); + di.setDefaultFields("name,id,status,reporting_date,consumption_at_reporting_date_m3,timestamp"); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_EFE, 0x07, 0x00); di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new Driver(mi, di)); }); @@ -39,7 +39,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags), { @@ -66,7 +66,7 @@ namespace addStringFieldWithExtractor( "reporting_date", "The reporting date of the last billing period.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -76,7 +76,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_reporting_date", "The water consumption at the last billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -93,7 +93,7 @@ namespace addNumericFieldWithExtractor( name, info, - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -108,4 +108,4 @@ namespace // Test: Wasserzaehler engelmann-faw 43000255 NOKEY // telegram=|8f44c5145502004301077260402520c51400076b0000002f2f426cbf2c441322e9000001fd17008401133c340100c40113ae2d010084021303290100c402137e21010084031313180100c403138a0e010084041337060100c40413b2fc00008405139af30000c4051322e90000840613c1df0000c40613cdd5000084071365ce0000c407136dc500008408138dbf0000| // {"media":"water","meter":"engelmann-faw","name":"Wasserzaehler","id":"20254060","status":"OK","reporting_date":"2021-12-31","consumption_at_reporting_date_m3":59.682,"consumption_1_months_ago_m3":78.908,"consumption_2_months_ago_m3":77.23,"consumption_3_months_ago_m3":76.035,"consumption_4_months_ago_m3":74.11,"consumption_5_months_ago_m3":71.699,"consumption_6_months_ago_m3":69.258,"consumption_7_months_ago_m3":67.127,"consumption_8_months_ago_m3":64.69,"consumption_9_months_ago_m3":62.362,"consumption_10_months_ago_m3":59.682,"consumption_11_months_ago_m3":57.281,"consumption_12_months_ago_m3":54.733,"consumption_13_months_ago_m3":52.837,"consumption_14_months_ago_m3":50.541,"consumption_15_months_ago_m3":49.037,"timestamp":"1111-11-11T11:11:11Z"} -// |Wasserzaehler;20254060;OK;2021-12-31;59.682000;1111-11-11 11:11.11 +// |Wasserzaehler;20254060;OK;2021-12-31;59.682;1111-11-11 11:11.11 diff --git a/src/driver_esyswm.cc b/src/driver_esyswm.cc index 9ccc166..92b0c18 100644 --- a/src/driver_esyswm.cc +++ b/src/driver_esyswm.cc @@ -42,7 +42,7 @@ namespace addStringFieldWithExtractor( "location_hex", "Meter installed at this customer location. Deprecate field.", - PrintProperty::JSON | PrintProperty::OPTIONAL | PrintProperty::DEPRECATED, + DEFAULT_PRINT_PROPERTIES | PrintProperty::DEPRECATED, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Location) @@ -51,7 +51,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -62,7 +62,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption", "Calculated sum of power consumption of all phases.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -73,7 +73,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production", "The total energy production recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -85,7 +85,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_tariff1", "The total energy consumption recorded by this meter on tariff 1.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -97,7 +97,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_tariff2", "The total energy consumption recorded by this meter on tariff 2.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -109,7 +109,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption_phase1", "Current power consumption phase 1.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -119,7 +119,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption_phase2", "Current power consumption phase 2.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -129,7 +129,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption_phase3", "Current power consumption phase 3.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -139,7 +139,7 @@ namespace addStringFieldWithExtractor( "version", "Static version information.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(DifVifKey("0DFD09")) @@ -151,7 +151,7 @@ namespace // Test: Elen2 esyswm 77997799 NOKEY // Comment: Static telegram // telegram=|7B4479169977997730378C208B900F002C25E4EF0A002EA98E7D58B3ADC57299779977991611028B005087102F2F#0DFD090F34302e3030562030303030303030300D790E31323334353637383839595345310DFD100AAAAAAAAAAAAAAAAAAAAA0D780E31323334353637383930594553312F2F2F2F2F2F2F2F2F2F2F| -// {"media":"electricity","meter":"esyswm","name":"Elen2","id":"77997799","fabrication_no":"1SEY0987654321","enhanced_id":"1ESY9887654321","location":"AAAAAAAAAAAAAAAAAAAA","location_hex":"AAAAAAAAAAAAAAAAAAAA","total_energy_consumption_kwh":null,"current_power_consumption_kw":null,"total_energy_production_kwh":null,"total_energy_consumption_tariff1_kwh":null,"total_energy_consumption_tariff2_kwh":null,"current_power_consumption_phase1_kw":null,"current_power_consumption_phase2_kw":null,"current_power_consumption_phase3_kw":null,"version":"00000000 V00.04","timestamp":"1111-11-11T11:11:11Z"} +// {"media":"electricity","meter":"esyswm","name":"Elen2","id":"77997799","fabrication_no":"1SEY0987654321","enhanced_id":"1ESY9887654321","location":"AAAAAAAAAAAAAAAAAAAA","location_hex":"AAAAAAAAAAAAAAAAAAAA","version":"00000000 V00.04","timestamp":"1111-11-11T11:11:11Z"} // |Elen2;77997799;null;null;null;null;null;null;null;null;1ESY9887654321;1111-11-11 11:11.11 // Comment: Dynamic telegram diff --git a/src/driver_eurisii.cc b/src/driver_eurisii.cc index 8f42a83..a025eed 100644 --- a/src/driver_eurisii.cc +++ b/src/driver_eurisii.cc @@ -39,8 +39,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status from error flags and tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -67,8 +67,8 @@ namespace addStringFieldWithExtractorAndLookup( "error_flags", "Deprecated field! Use status instead.", - PrintProperty::JSON | PrintProperty::DEPRECATED | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::DEPRECATED | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -95,7 +95,7 @@ namespace addNumericFieldWithExtractor( "current_consumption", "The current heat cost allocation.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -106,7 +106,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_{storage_counter}", "The heat cost allocation at set date #.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -118,7 +118,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "Deprecated field.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_ev200.cc b/src/driver_ev200.cc index b231b2b..b30714f 100644 --- a/src/driver_ev200.cc +++ b/src/driver_ev200.cc @@ -40,7 +40,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -51,7 +51,7 @@ namespace addNumericFieldWithExtractor( "target", "The target water consumption recorded at previous period.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_evo868.cc b/src/driver_evo868.cc index 28ecd11..e73e79e 100644 --- a/src/driver_evo868.cc +++ b/src/driver_evo868.cc @@ -40,8 +40,8 @@ namespace addStringFieldWithExtractorAndLookup( "current_status", "Status of meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT - | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES + | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -65,7 +65,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "The total water consumption at the most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -77,7 +77,7 @@ namespace addStringFieldWithExtractor( "set_date", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -87,7 +87,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_2", "The total water consumption at the second most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -99,7 +99,7 @@ namespace addStringFieldWithExtractor( "set_date_2", "The second most recent billing period date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -109,7 +109,7 @@ namespace addNumericFieldWithExtractor( "max_flow_since_datetime", "Maximum water flow since date time.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -121,7 +121,7 @@ namespace addStringFieldWithExtractor( "max_flow_datetime", "The datetime to which maximum flow is measured.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -131,7 +131,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_history_{storage_counter-7counter}", "The total water consumption at the historic date.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -143,7 +143,7 @@ namespace addNumericFieldWithExtractor( "history_reference", "Reference date for history.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -156,7 +156,7 @@ namespace addNumericFieldWithCalculatorAndMatcher( "history_{storage_counter-7counter}", "The historic date #.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, "history_reference_date - ((storage_counter-8counter) * 1 month)", FieldMatcher::build() @@ -169,7 +169,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Date and time when the meter sent the telegram.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) diff --git a/src/driver_fhkvdataiii.cc b/src/driver_fhkvdataiii.cc index 84da7ad..e6be0ef 100644 --- a/src/driver_fhkvdataiii.cc +++ b/src/driver_fhkvdataiii.cc @@ -45,6 +45,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("fhkvdataiii"); + di.setDefaultFields("name,id,current_hca,current_date,previous_hca,previous_date,temp_room_c,temp_radiator_c,timestamp"); di.setMeterType(MeterType::HeatCostAllocationMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_TCH, 0x80, 0x69); @@ -58,32 +59,32 @@ namespace addPrint("current", Quantity::HCA, [&](Unit u){ return currentPeriodEnergyConsumption(u); }, "Energy consumption so far in this billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("current_date", Quantity::Text, [&](){ return currentPeriodDate(); }, "Date of current billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("previous", Quantity::HCA, [&](Unit u){ return previousPeriodEnergyConsumption(u); }, "Energy consumption in previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("previous_date", Quantity::Text, [&](){ return previousPeriodDate(); }, "Date of last billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("temp_room", Quantity::Temperature, [&](Unit u){ return currentRoomTemperature(u); }, "Current room temperature.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("temp_radiator", Quantity::Temperature, [&](Unit u){ return currentRadiatorTemperature(u); }, "Current radiator temperature.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } double Driver::currentPeriodEnergyConsumption(Unit u) @@ -229,11 +230,11 @@ namespace // Test: Room fhkvdataiii 11776622 NOKEY // Comment: There is a problem in the decoding here, the data stored inside the telegram does not seem to properly encode/decode the year.... We should not report a current_date with a full year, if the year is actually not part of the telegram. // telegram=|31446850226677116980A0119F27020480048300C408F709143C003D341A2B0B2A0707000000000000062D114457563D71A1850000| -// {"media":"heat cost allocator","meter":"fhkvdataiii","name":"Room","id":"11776622","current_hca":131,"current_date":"2022-02-08T02:00:00Z","previous_hca":1026,"previous_date":"2019-12-31T02:00:00Z","temp_room_c":22.44,"temp_radiator_c":25.51,"timestamp":"1111-11-11T11:11:11Z"} -// |Room;11776622;131.000000;2022-02-08T02:00:00Z;1026.000000;2019-12-31T02:00:00Z;22.440000;25.510000;1111-11-11 11:11.11 +// {"media":"heat cost allocator","meter":"fhkvdataiii","name":"Room","id":"11776622","current_hca":131,"current_date":"2023-02-08T02:00:00Z","previous_hca":1026,"previous_date":"2019-12-31T02:00:00Z","temp_room_c":22.44,"temp_radiator_c":25.51,"timestamp":"1111-11-11T11:11:11Z"} +// |Room;11776622;131;2023-02-08T02:00:00Z;1026;2019-12-31T02:00:00Z;22.44;25.51;1111-11-11 11:11.11 // Test: Rooom fhkvdataiii 11111234 NOKEY // Comment: FHKV radio 4 / EHKV vario 4 There is a problem in the decoding here, the data stored inside the telegram does not seem to properly encode/decode the year.... We should not report a current_date with a full year, if the year is actually not part of the telegram. // telegram=|33446850341211119480A2_0F9F292D005024040011BD08380904000000070000000000000000000000000001000000000003140E| -// {"media":"heat cost allocator","meter":"fhkvdataiii","name":"Rooom","id":"11111234","current_hca":4,"current_date":"2022-02-05T02:00:00Z","previous_hca":45,"previous_date":"2020-12-31T02:00:00Z","temp_room_c":22.37,"temp_radiator_c":23.6,"timestamp":"1111-11-11T11:11:11Z"} -// |Rooom;11111234;4.000000;2022-02-05T02:00:00Z;45.000000;2020-12-31T02:00:00Z;22.370000;23.600000;1111-11-11 11:11.11 +// {"media":"heat cost allocator","meter":"fhkvdataiii","name":"Rooom","id":"11111234","current_hca":4,"current_date":"2023-02-05T02:00:00Z","previous_hca":45,"previous_date":"2020-12-31T02:00:00Z","temp_room_c":22.37,"temp_radiator_c":23.6,"timestamp":"1111-11-11T11:11:11Z"} +// |Rooom;11111234;4;2023-02-05T02:00:00Z;45;2020-12-31T02:00:00Z;22.37;23.6;1111-11-11 11:11.11 diff --git a/src/driver_fhkvdataiv.cc b/src/driver_fhkvdataiv.cc index 77c1504..8e89800 100644 --- a/src/driver_fhkvdataiv.cc +++ b/src/driver_fhkvdataiv.cc @@ -42,13 +42,13 @@ namespace addStringField( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "current_consumption", "The current heat cost allocation.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -58,7 +58,7 @@ namespace addStringFieldWithExtractor( "set_date", "The most recent billing period date.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -67,7 +67,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "Heat cost allocation at the most recent billing period date.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -78,7 +78,7 @@ namespace addStringFieldWithExtractor( "set_date_1", "The most recent billing period date.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -87,7 +87,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_1", "Heat cost allocation at the most recent billing period date.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -98,7 +98,7 @@ namespace addStringFieldWithExtractor( "set_date_8", "The 8 billing period date.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -107,7 +107,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_8", "Heat cost allocation at the 8 billing period date.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_flowiq2200.cc b/src/driver_flowiq2200.cc index 276aec1..877f936 100644 --- a/src/driver_flowiq2200.cc +++ b/src/driver_flowiq2200.cc @@ -44,7 +44,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status of meter. Not fully understood!", - PrintProperty::JSON | PrintProperty::IMPORTANT | PrintProperty::STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS, FieldMatcher::build() .set(DifVifKey("04FF23")), { @@ -69,7 +69,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -80,7 +80,7 @@ namespace addNumericFieldWithExtractor( "target", "The total water consumption recorded at the beginning of this month.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -92,7 +92,7 @@ namespace addStringFieldWithExtractor( "target_date", "The date at the beginning of this month.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -102,7 +102,7 @@ namespace addNumericFieldWithExtractor( "flow", "The current flow of water through the meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -113,7 +113,7 @@ namespace addNumericFieldWithExtractor( "min_flow_temperature", "The water temperature.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -125,7 +125,7 @@ namespace addNumericFieldWithExtractor( "max_flow_temperature", "The maximum water temperature.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -137,7 +137,7 @@ namespace addNumericFieldWithExtractor( "min_external_temperature", "The external temperature outside of the meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -149,7 +149,7 @@ namespace addNumericFieldWithExtractor( "max_flow", "The maxium flow recorded during previous period.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -161,7 +161,7 @@ namespace addNumericFieldWithExtractor( "min_flow", "The minimum flow recorded during previous period.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -173,7 +173,7 @@ namespace addNumericFieldWithExtractor( "max_external_temperature", "The maxium temperature recorded during previous period.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -185,7 +185,7 @@ namespace addNumericFieldWithExtractor( "min_external_temperature", "The minimum flow recorded during previous period.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -197,7 +197,7 @@ namespace addNumericFieldWithExtractor( "max_flow", "The maxium flow recorded during previous period.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -209,7 +209,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_dry", "Amount of time the meter has been dry.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -236,7 +236,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_reversed", "Amount of time the meter has been reversed.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -263,7 +263,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_leaking", "Amount of time the meter has been leaking.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -290,7 +290,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_bursting", "Amount of time the meter has been bursting.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { diff --git a/src/driver_gransystems.cc b/src/driver_gransystems.cc index eddb0dd..8175898 100644 --- a/src/driver_gransystems.cc +++ b/src/driver_gransystems.cc @@ -62,7 +62,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status of meter.", - PrintProperty::JSON | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -116,7 +116,7 @@ namespace addStringFieldWithExtractorAndLookup( "info", "Is it a three phase or single phase meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -139,7 +139,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -150,7 +150,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_tariff_{tariff_counter}", "The total energy consumption recorded by this meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -162,7 +162,7 @@ namespace addNumericFieldWithExtractor( "target", "Last day?", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -174,7 +174,7 @@ namespace addNumericFieldWithExtractor( "target_energy_consumption", "Last day energy consumption?", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -186,7 +186,7 @@ namespace addNumericFieldWithExtractor( "target_energy_consumption_tariff_{tariff_counter}", "Last day energy consumption for tariff?", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -199,7 +199,7 @@ namespace addNumericFieldWithExtractor( "device", "Device date time when telegram was sent.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -210,7 +210,7 @@ namespace addNumericFieldWithExtractor( "voltage_at_phase_1", "Voltage for single phase meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Voltage, VifScaling::Auto, FieldMatcher::build() @@ -222,7 +222,7 @@ namespace addNumericFieldWithExtractor( "voltage_at_phase_{subunit_counter}", "Voltage at phase L#.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Voltage, VifScaling::Auto, FieldMatcher::build() @@ -234,7 +234,7 @@ namespace addNumericFieldWithExtractor( "current_at_phase_1", "Amperage for single phase meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Amperage, VifScaling::Auto, FieldMatcher::build() @@ -246,7 +246,7 @@ namespace addNumericFieldWithExtractor( "current_at_phase_{subunit_counter}", "Amperage at phase L#.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Amperage, VifScaling::Auto, FieldMatcher::build() @@ -258,7 +258,7 @@ namespace addNumericFieldWithExtractor( "raw_frequency", "Raw input to frequency.", - PrintProperty::JSON | PrintProperty::HIDE, + DEFAULT_PRINT_PROPERTIES | PrintProperty::HIDE, Quantity::Frequency, VifScaling::None, FieldMatcher::build() @@ -268,7 +268,7 @@ namespace addNumericFieldWithCalculator( "frequency", "Frequency of AC.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Frequency, "raw_frequency_hz / 100 counter"); } diff --git a/src/driver_hydrocalm3.cc b/src/driver_hydrocalm3.cc index 26f25bb..8454766 100644 --- a/src/driver_hydrocalm3.cc +++ b/src/driver_hydrocalm3.cc @@ -46,13 +46,13 @@ namespace addStringField( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "total_heating", "The total heating energy consumption recorded by this meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -64,7 +64,7 @@ namespace addNumericFieldWithExtractor( "device", "The date time when the recording was made.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -75,7 +75,7 @@ namespace addNumericFieldWithExtractor( "total_cooling", "The total cooling energy consumption recorded by this meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -87,7 +87,7 @@ namespace addNumericFieldWithExtractor( "total_heating", "Total heating volume of media.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -99,7 +99,7 @@ namespace addNumericFieldWithExtractor( "total_cooling", "Total cooling volume of media.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -111,7 +111,7 @@ namespace addNumericFieldWithExtractor( "c1_volume", "Supply c1 volume.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -123,7 +123,7 @@ namespace addNumericFieldWithExtractor( "c2_volume", "Return c2 volume.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -135,7 +135,7 @@ namespace addNumericFieldWithExtractor( "supply_temperature", "The supply t1 pipe temperature.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -147,7 +147,7 @@ namespace addNumericFieldWithExtractor( "return_temperature", "The return t2 pipe temperature.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_hydroclima.cc b/src/driver_hydroclima.cc index 356f744..a212455 100644 --- a/src/driver_hydroclima.cc +++ b/src/driver_hydroclima.cc @@ -35,6 +35,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("hydroclima"); + di.setDefaultFields("name,id,current_consumption_hca,average_ambient_temperature_c,timestamp"); di.setMeterType(MeterType::HeatCostAllocationMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_BMP, 0x08, 0x53); @@ -46,7 +47,7 @@ namespace addNumericFieldWithExtractor( "current_consumption", "The current heat cost allocation.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -58,25 +59,25 @@ namespace Quantity::Temperature, GET_FUNC(average_ambient_temperature_, Unit::C), "Average ambient temperature since this beginning of this month.", - PrintProperty::JSON | PrintProperty::FIELD); + DEFAULT_PRINT_PROPERTIES ); addPrint("max_ambient_temperature", Quantity::Temperature, GET_FUNC(max_ambient_temperature_, Unit::C), "Max ambient temperature since the beginning of this month.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("average_ambient_temperature_last_month", Quantity::Temperature, GET_FUNC(average_ambient_temperature_last_month_, Unit::C), "Average ambient temperature last month.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("average_heater_temperature_last_month", Quantity::Temperature, GET_FUNC(average_heater_temperature_last_month_, Unit::C), "Average heater temperature last month.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } double toTemperature(uchar hi, uchar lo) @@ -245,11 +246,11 @@ namespace // Comment: // telegram=|2e44b0099861036853087a000020002F2F036E0000000F100043106A7D2C4A078F12202CB1242A06D3062100210000| // {"media":"heat cost allocation","meter":"hydroclima","name":"HCA","id":"68036198","current_consumption_hca":0,"average_ambient_temperature_c":18.66,"max_ambient_temperature_c":47.51,"average_ambient_temperature_last_month_c":15.78,"average_heater_temperature_last_month_c":17.47,"timestamp":"1111-11-11T11:11:11Z"} -// |HCA;68036198;0.000000;18.660000;1111-11-11 11:11.11 +// |HCA;68036198;0;18.66;1111-11-11 11:11.11 // Test: HCAA hydroclima 74393723 NOKEY // Comment: // telegram=|2D44B009233739743308780F9D1300023ED97AEC7BC5908A32C15D8A32C126915AC15AC126912691269187912689| -// {"media":"heat cost allocation","meter":"hydroclima","name":"HCAA","id":"74393723","current_consumption_hca":null,"average_ambient_temperature_c":0,"max_ambient_temperature_c":0,"average_ambient_temperature_last_month_c":0,"average_heater_temperature_last_month_c":0,"timestamp":"1111-11-11T11:11:11Z"} -// |HCAA;74393723;nan;0.000000;1111-11-11 11:11.11 +// {"media":"heat cost allocation","meter":"hydroclima","name":"HCAA","id":"74393723","average_ambient_temperature_c":0,"max_ambient_temperature_c":0,"average_ambient_temperature_last_month_c":0,"average_heater_temperature_last_month_c":0,"timestamp":"1111-11-11T11:11:11Z"} +// |HCAA;74393723;null;0;1111-11-11 11:11.11 diff --git a/src/driver_hydrodigit.cc b/src/driver_hydrodigit.cc index 57e969e..f81fcff 100644 --- a/src/driver_hydrodigit.cc +++ b/src/driver_hydrodigit.cc @@ -41,7 +41,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -52,7 +52,7 @@ namespace addNumericFieldWithExtractor( "meter", "Meter timestamp for measurement.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_hydrus.cc b/src/driver_hydrus.cc index 9855427..5b7d23c 100644 --- a/src/driver_hydrus.cc +++ b/src/driver_hydrus.cc @@ -63,6 +63,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("hydrus"); + di.setDefaultFields("name,id,total_m3,total_at_date_m3,status,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_DME, 0x07, 0x70); @@ -102,77 +103,77 @@ namespace addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("total_tariff1", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff1(u); }, "The total water consumption recorded by this meter at tariff 1.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("total_tariff2", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff2(u); }, "The total water consumption recorded by this meter at tariff 2.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("max_flow", Quantity::Flow, [&](Unit u){ return maxFlow(u); }, "The maximum flow recorded during previous period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("flow_temperature", Quantity::Temperature, [&](Unit u){ return flowTemperature(u); }, "The water temperature.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("external_temperature", Quantity::Temperature, [&](Unit u){ return externalTemperature(u); }, "The external temperature.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("current_date", Quantity::Text, [&](){ return current_date_; }, "Current date of measurement.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("total_at_date", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionAtDate(u); }, "The total water consumption recorded at date.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("total_tariff1_at_date", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff1AtDate(u); }, "The total water consumption recorded at tariff 1 at date.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("total_tariff2_at_date", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff2AtDate(u); }, "The total water consumption recorded at tariff 2 at date.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("at_date", Quantity::Text, [&](){ return at_date_; }, "Date when total water consumption was recorded.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("actuality_duration", Quantity::Time, Unit::Second, [&](Unit u){ return convert(actuality_duration_s_, Unit::Second, u); }, "Elapsed time between measurement and transmission", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("operating_time", Quantity::Time, Unit::Hour, [&](Unit u){ return convert(operating_time_h_, Unit::Hour, u); }, "How long the meter is operating", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("remaining_battery_life", Quantity::Time, Unit::Year, [&](Unit u){ return convert(remaining_battery_life_year_, Unit::Year, u); }, "How many more years the battery is expected to last", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("status", Quantity::Text, [&](){ return status_; }, "The status is OK or some error condition.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } void Driver::processContent(Telegram *t) @@ -592,14 +593,14 @@ namespace // Test: HydrusWater hydrus 64646464 NOKEY // telegram=|4E44A5116464646470077AED004005_2F2F01FD08300C13741100007C1300000000FC101300000000FC201300000000726C00000B3B00000002FD748713025A6800C4016D3B177F2ACC011300020000| // {"media":"water","meter":"hydrus","name":"HydrusWater","id":"64646464","total_m3":1.174,"total_tariff1_m3":0,"total_tariff2_m3":0,"max_flow_m3h":0,"flow_temperature_c":10.4,"external_temperature_c":0,"current_date":"","total_at_date_m3":0,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":0,"at_date":"2000-00-00 00:00","actuality_duration_s":0,"operating_time_h":0,"remaining_battery_life_y":13.686516,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -// |HydrusWater;64646464;1.174000;0.000000;OK;1111-11-11 11:11.11 +// |HydrusWater;64646464;1.174;0;OK;1111-11-11 11:11.11 // Test: HydrusVater hydrus 65656565 NOKEY // telegram=|3E44A5116565656570067AFB0030052F2F_0C13503400000DFD110A383731303134423032410B3B00000002FD74DC15C4016D3B178D29CC0113313400002F2F| // {"media":"warm water","meter":"hydrus","name":"HydrusVater","id":"65656565","total_m3":3.45,"total_tariff1_m3":0,"total_tariff2_m3":0,"max_flow_m3h":0,"flow_temperature_c":127,"external_temperature_c":0,"current_date":"","total_at_date_m3":3.431,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":0,"at_date":"2020-09-13 23:59","actuality_duration_s":0,"operating_time_h":0,"remaining_battery_life_y":15.321013,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -// |HydrusVater;65656565;3.450000;0.000000;OK;1111-11-11 11:11.11 +// |HydrusVater;65656565;3.45;3.431;OK;1111-11-11 11:11.11 // Test: HydrusAES hydrus 64745666 NOKEY // telegram=||6644242328001081640E7266567464A51170071F0050052C411A08674048DD6BA82A0DF79FFD401309179A893A1BE3CE8EDC50C2A45CD7AFEC3B4CE765820BE8056C124A17416C3722985FFFF7FCEB7094901AB3A16294B511B9A740C9F9911352B42A72FB3B0C| // {"media":"water","meter":"hydrus","name":"HydrusAES","id":"64745666","total_m3":137.291,"total_tariff1_m3":0,"total_tariff2_m3":137.291,"max_flow_m3h":0,"flow_temperature_c":24.5,"external_temperature_c":23.9,"current_date":"2021-01-23 08:27","total_at_date_m3":128.638,"total_tariff1_at_date_m3":0,"total_tariff2_at_date_m3":128.638,"at_date":"2020-12-31 00:00","actuality_duration_s":6673,"operating_time_h":14678,"remaining_battery_life_y":0,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -// |HydrusAES;64745666;137.291000;0.000000;OK;1111-11-11 11:11.11 +// |HydrusAES;64745666;137.291;128.638;OK;1111-11-11 11:11.11 diff --git a/src/driver_iperl.cc b/src/driver_iperl.cc index a1c1307..1c2232c 100644 --- a/src/driver_iperl.cc +++ b/src/driver_iperl.cc @@ -28,6 +28,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("iperl"); + di.setDefaultFields("name,id,total_m3,max_flow_m3h,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_SEN, 0x06, 0x68); @@ -41,7 +42,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -52,7 +53,7 @@ namespace addNumericFieldWithExtractor( "max_flow", "The maxium flow recorded during previous period.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -65,10 +66,10 @@ namespace // Comment: Test iPerl T1 telegram, that after decryption, has 2f2f markers. // telegram=|1E44AE4C9956341268077A36001000_2F2F0413181E0000023B00002F2F2F2F| // {"media":"water","meter":"iperl","name":"MoreWater","id":"12345699","total_m3":7.704,"max_flow_m3h":0,"timestamp":"1111-11-11T11:11:11Z"} -// |MoreWater;12345699;7.704000;0.000000;1111-11-11 11:11.11 +// |MoreWater;12345699;7.704;0;1111-11-11 11:11.11 // Test: WaterWater iperl 33225544 NOKEY // Comment: Test iPerl T1 telegram not encrypted, which has no 2f2f markers. // telegram=|1844AE4C4455223368077A55000000_041389E20100023B0000| // {"media":"water","meter":"iperl","name":"WaterWater","id":"33225544","total_m3":123.529,"max_flow_m3h":0,"timestamp":"1111-11-11T11:11:11Z"} -// |WaterWater;33225544;123.529000;0.000000;1111-11-11 11:11.11 +// |WaterWater;33225544;123.529;0;1111-11-11 11:11.11 diff --git a/src/driver_itron.cc b/src/driver_itron.cc index 5a3b416..78e937f 100644 --- a/src/driver_itron.cc +++ b/src/driver_itron.cc @@ -49,7 +49,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags) @@ -71,7 +71,7 @@ namespace addNumericFieldWithExtractor( "target", "The total water consumption recorded at the end of previous billing period.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -83,7 +83,7 @@ namespace addStringFieldWithExtractor( "target_date", "Date when previous billing period ended.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -93,7 +93,7 @@ namespace addStringFieldWithExtractorAndLookup( "unknown_a", "Unknown flags.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("047F")), { @@ -113,7 +113,7 @@ namespace addStringFieldWithExtractorAndLookup( "unknown_b", "Unknown flags.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("027F")), { diff --git a/src/driver_izar.cc b/src/driver_izar.cc index 74afbba..459a567 100644 --- a/src/driver_izar.cc +++ b/src/driver_izar.cc @@ -73,6 +73,13 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("izar"); + di.setDefaultFields("name,id,prefix,serial_number,total_m3,last_month_total_m3," + "last_month_measure_date," + "remaining_battery_life_y," + "current_alarms," + "previous_alarms," + "transmit_period_s," + "manufacture_year,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_HYD, 0x07, 0x85); @@ -93,52 +100,52 @@ namespace addPrint("prefix", Quantity::Text, [&](){ return prefix; }, "The alphanumeric prefix printed before serial number on device.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("serial_number", Quantity::Text, [&](){ return serialNumber(); }, "The meter serial number.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("last_month_total", Quantity::Volume, [&](Unit u){ return lastMonthTotalWaterConsumption(u); }, "The total water consumption recorded by this meter around end of last month.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("last_month_measure_date", Quantity::Text, [&](){ return setH0Date(); }, "The date when the meter recorded the most recent billing value.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("remaining_battery_life", Quantity::Time, Unit::Year, [&](Unit u){ return convert(remaining_battery_life, Unit::Year, u); }, "How many more years the battery is expected to last", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("current_alarms", Quantity::Text, [&](){ return currentAlarmsText(); }, "Alarms currently reported by the meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("previous_alarms", Quantity::Text, [&](){ return previousAlarmsText(); }, "Alarms previously reported by the meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("transmit_period", Quantity::Time, Unit::Second, [&](Unit u){ return convert(transmit_period_s_, Unit::Second, u); }, "The period at which the meter transmits its data.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("manufacture_year", Quantity::Text, [&](){ return to_string(manufacture_year); }, "The year during which the meter was manufactured.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } double Driver::totalWaterConsumption(Unit u) @@ -304,31 +311,31 @@ namespace // Test: IzarWater izar 21242472 NOKEY // telegram=|1944304C72242421D401A2|013D4013DD8B46A4999C1293E582CC| // {"media":"water","meter":"izar","name":"IzarWater","id":"21242472","prefix":"C19UA","serial_number":"145842","total_m3":3.488,"last_month_total_m3":3.486,"last_month_measure_date":"2019-09-30","remaining_battery_life_y":14.5,"current_alarms":"meter_blocked,underflow","previous_alarms":"no_alarm","transmit_period_s":8,"manufacture_year":"2019","timestamp":"1111-11-11T11:11:11Z"} -// |IzarWater;21242472;C19UA;145842;3.488000;3.486000;2019-09-30;14.500000;meter_blocked,underflow;no_alarm;8.000000;2019;1111-11-11 11:11.11 +// |IzarWater;21242472;C19UA;145842;3.488;3.486;2019-09-30;14.5;meter_blocked,underflow;no_alarm;8;2019;1111-11-11 11:11.11 // Test: IzarWater2 izar 66236629 NOKEY // telegram=|2944A511780729662366A20118001378D3B3DB8CEDD77731F25832AAF3DA8CADF9774EA673172E8C61F2| // {"media":"water","meter":"izar","name":"IzarWater2","id":"66236629","prefix":"","serial_number":"000000","total_m3":16.76,"last_month_total_m3":11.84,"last_month_measure_date":"2019-11-30","remaining_battery_life_y":12,"current_alarms":"no_alarm","previous_alarms":"no_alarm","transmit_period_s":8,"manufacture_year":"0","timestamp":"1111-11-11T11:11:11Z"} -// |IzarWater2;66236629;;000000;16.760000;11.840000;2019-11-30;12.000000;no_alarm;no_alarm;8.000000;0;1111-11-11 11:11.11 +// |IzarWater2;66236629;;000000;16.76;11.84;2019-11-30;12;no_alarm;no_alarm;8;0;1111-11-11 11:11.11 // Test: IzarWater3 izar 20481979 NOKEY // telegram=|1944A511780779194820A1|21170013355F8EDB2D03C6912B1E37 // {"media":"water","meter":"izar","name":"IzarWater3","id":"20481979","prefix":"","serial_number":"000000","total_m3":4.366,"last_month_total_m3":0,"last_month_measure_date":"2020-12-31","remaining_battery_life_y":11.5,"current_alarms":"no_alarm","previous_alarms":"no_alarm","transmit_period_s":8,"manufacture_year":"0","timestamp":"1111-11-11T11:11:11Z"} -// |IzarWater3;20481979;;000000;4.366000;0.000000;2020-12-31;11.500000;no_alarm;no_alarm;8.000000;0;1111-11-11 11:11.11 +// |IzarWater3;20481979;;000000;4.366;0;2020-12-31;11.5;no_alarm;no_alarm;8;0;1111-11-11 11:11.11 // Test: IzarWater4 izar 2124589c NOKEY // Comment: With mfct specific tpl ci field a3. // telegram=|1944304c9c5824210c04a363140013716577ec59e8663ab0d31c| // {"media":"water","meter":"izar","name":"IzarWater4","id":"2124589c","prefix":"H19CA","serial_number":"159196","total_m3":38.944,"last_month_total_m3":38.691,"last_month_measure_date":"2021-02-01","remaining_battery_life_y":10,"current_alarms":"no_alarm","previous_alarms":"no_alarm","transmit_period_s":32,"manufacture_year":"2019","timestamp":"1111-11-11T11:11:11Z"} -// |IzarWater4;2124589c;H19CA;159196;38.944000;38.691000;2021-02-01;10.000000;no_alarm;no_alarm;32.000000;2019;1111-11-11 11:11.11 +// |IzarWater4;2124589c;H19CA;159196;38.944;38.691;2021-02-01;10;no_alarm;no_alarm;32;2019;1111-11-11 11:11.11 // Test: IzarWater5 izar 20e4ffde NOKEY // Comment: Ensure non-regression on manufacture year parsing // telegram=|1944304CDEFFE420CC01A2|63120013258F907B0AFF12529AC33B| // {"media":"water","meter":"izar","name":"IzarWater5","id":"20e4ffde","prefix":"C15SA","serial_number":"007710","total_m3":159.832,"last_month_total_m3":157.76,"last_month_measure_date":"2021-02-01","remaining_battery_life_y":9,"current_alarms":"no_alarm","previous_alarms":"no_alarm","transmit_period_s":32,"manufacture_year":"2015","timestamp":"1111-11-11T11:11:11Z"} -// |IzarWater5;20e4ffde;C15SA;007710;159.832000;157.760000;2021-02-01;9.000000;no_alarm;no_alarm;32.000000;2015;1111-11-11 11:11.11 +// |IzarWater5;20e4ffde;C15SA;007710;159.832;157.76;2021-02-01;9;no_alarm;no_alarm;32;2015;1111-11-11 11:11.11 // Test: IzarWater6 izar 48500375 NOKEY // telegram=|19442423860775035048A251520015BEB6B2E1ED623A18FC74A5| // {"media":"water","meter":"izar","name":"IzarWater6","id":"48500375","prefix":"","serial_number":"000000","total_m3":521.602,"last_month_total_m3":519.147,"last_month_measure_date":"2021-11-15","remaining_battery_life_y":9,"current_alarms":"no_alarm","previous_alarms":"leakage","transmit_period_s":8,"manufacture_year":"0","timestamp":"1111-11-11T11:11:11Z"} -// |IzarWater6;48500375;;000000;521.602000;519.147000;2021-11-15;9.000000;no_alarm;leakage;8.000000;0;1111-11-11 11:11.11 +// |IzarWater6;48500375;;000000;521.602;519.147;2021-11-15;9;no_alarm;leakage;8;0;1111-11-11 11:11.11 diff --git a/src/driver_kamheat.cc b/src/driver_kamheat.cc index 5b59d56..8fb118b 100644 --- a/src/driver_kamheat.cc +++ b/src/driver_kamheat.cc @@ -62,7 +62,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(DifVifKey("04FF22")), Translate::Lookup( @@ -114,7 +114,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -125,7 +125,7 @@ namespace addNumericFieldWithExtractor( "total_volume", "The volume of water (3/68/Volume V1).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -136,7 +136,7 @@ namespace addNumericFieldWithExtractor( "volume_flow", "The actual amount of water that pass through this meter (8/74/Flow V1 actual).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -147,7 +147,7 @@ namespace addNumericFieldWithExtractor( "power", "The current power flowing.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -158,7 +158,7 @@ namespace addNumericFieldWithExtractor( "max_power", "The maximum power supplied.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -169,7 +169,7 @@ namespace addNumericFieldWithExtractor( "t1_temperature", "The forward temperature of the water (6/86/t2 actual 2 decimals).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -180,7 +180,7 @@ namespace addNumericFieldWithExtractor( "t2_temperature", "The return temperature of the water (7/87/t2 actual 2 decimals).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -191,7 +191,7 @@ namespace addNumericFieldWithExtractor( "max_flow", "The maximum flow of water that passed through this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -202,7 +202,7 @@ namespace addNumericFieldWithExtractor( "forward_energy", "The forward energy of the water (4/97/Energy E8).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::None, FieldMatcher::build() @@ -212,7 +212,7 @@ namespace addNumericFieldWithExtractor( "return_energy", "The return energy of the water (5/110/Energy E9).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::None, FieldMatcher::build() @@ -222,7 +222,7 @@ namespace addStringFieldWithExtractor( "meter_date", "The date and time (10/348/Date and time).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -231,7 +231,7 @@ namespace addNumericFieldWithExtractor( "target_energy", "The energy consumption recorded by this meter at the set date (11/60/Heat energy E1/026C).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -243,7 +243,7 @@ namespace addNumericFieldWithExtractor( "target_volume", "The amount of water that had passed through this meter at the set date (13/68/Volume V1).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -255,7 +255,7 @@ namespace addStringFieldWithExtractor( "target_date", "The most recent billing period date and time (14/348/Date and Time logged).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) diff --git a/src/driver_kampress.cc b/src/driver_kampress.cc index bc116f5..741551c 100644 --- a/src/driver_kampress.cc +++ b/src/driver_kampress.cc @@ -27,6 +27,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("kampress"); + di.setDefaultFields("name,id,status,pressure_bar,max_pressure_bar,min_pressure_bar,timestamp"); di.setMeterType(MeterType::PressureSensor); di.addLinkMode(LinkMode::C1); di.addDetection(MANUFACTURER_KAM, 0x18, 0x01); @@ -38,7 +39,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD | JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | INCLUDE_TPL_STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags), { @@ -63,7 +64,7 @@ namespace addNumericFieldWithExtractor( "pressure", "The measured pressure.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Pressure, VifScaling::Auto, FieldMatcher::build() @@ -74,7 +75,7 @@ namespace addNumericFieldWithExtractor( "max_pressure", "The maximum pressure measured during ?.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Pressure, VifScaling::Auto, FieldMatcher::build() @@ -85,7 +86,7 @@ namespace addNumericFieldWithExtractor( "min_pressure", "The minumum pressure measured during ?.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Pressure, VifScaling::Auto, FieldMatcher::build() @@ -96,7 +97,7 @@ namespace addNumericFieldWithExtractor( "alfa", "We do not know what this is.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -106,7 +107,7 @@ namespace addNumericFieldWithExtractor( "beta", "We do not know what this is.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -118,12 +119,12 @@ namespace // Test: Pressing kampress 77000317 NOKEY // telegram=|32442D2C1703007701188D280080E39322DB8F78_22696600126967000269660005FF091954A33A05FF0A99BD823A02FD170800| // {"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"} -// |Pressing;77000317;LOW;1.020000;1.030000;1.020000;1111-11-11 11:11.11 +// |Pressing;77000317;LOW;1.02;1.03;1.02;1111-11-11 11:11.11 // telegram=|27442D2C1703007701188D280194E393226EC679DE735657_660067006600962B913A21B9423A0800| // {"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"} -// |Pressing;77000317;LOW;1.020000;1.030000;1.020000;1111-11-11 11:11.11 +// |Pressing;77000317;LOW;1.02;1.03;1.02;1111-11-11 11:11.11 // telegram=|27442D2C1703007701188D289554F295224ED579DE73188A_650066006600E80EA43A6B97A3BA0800| // {"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"} -// |Pressing;77000317;LOW;1.020000;1.020000;1.010000;1111-11-11 11:11.11 +// |Pressing;77000317;LOW;1.02;1.02;1.01;1111-11-11 11:11.11 diff --git a/src/driver_lansendw.cc b/src/driver_lansendw.cc index 88c5d8f..24fecec 100644 --- a/src/driver_lansendw.cc +++ b/src/driver_lansendw.cc @@ -38,6 +38,7 @@ private: static bool ok = registerDriver([](DriverInfo&di) { di.setName("lansendw"); + di.setDefaultFields("name,id,status,timestamp"); di.setMeterType(MeterType::DoorWindowDetector); di.addLinkMode(LinkMode::T1); di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new MeterLansenDW(mi, di)); }); @@ -56,23 +57,17 @@ MeterLansenDW::MeterLansenDW(MeterInfo &mi, DriverInfo &di) : addPrint("status", Quantity::Text, [&](){ return status(); }, "The current status: OPEN or CLOSED.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); - /* - addPrint("statuss", Quantity::Text, - [&](){ return status(); }, - "The current status: OPEN or CLOSED.", - PrintProperty::FIELD | PrintProperty::JSON); - */ addPrint("a", Quantity::Counter, [&](Unit u) { assertQuantity(u, Quantity::Counter); return pulse_counter_a_; }, "How many times the door/window has been opened or closed.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("b", Quantity::Counter, [&](Unit u) { assertQuantity(u, Quantity::Counter); return pulse_counter_b_; }, "The current number of counted pulses from counter b.", - PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } diff --git a/src/driver_lansenpu.cc b/src/driver_lansenpu.cc index 8218657..34b04a3 100644 --- a/src/driver_lansenpu.cc +++ b/src/driver_lansenpu.cc @@ -47,8 +47,8 @@ namespace addStringField( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); /* Doubles have a 52 bit significand 11 bit exp and 1 bit sign, so double is good for incremental pulses up to 2^52 counts @@ -58,7 +58,7 @@ namespace addNumericFieldWithExtractor( "a", "The current number of counted pulses from counter a.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -68,7 +68,7 @@ namespace addNumericFieldWithExtractor( "b", "The current number of counted pulses from counter b.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() diff --git a/src/driver_lansensm.cc b/src/driver_lansensm.cc index e2be090..711cfb3 100644 --- a/src/driver_lansensm.cc +++ b/src/driver_lansensm.cc @@ -39,8 +39,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags) .add(VIFCombinable::StandardConformantDataContent), @@ -67,7 +67,7 @@ namespace addNumericFieldWithExtractor( "async_msg_id", "Unique asynchronous message number.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -78,7 +78,7 @@ namespace addNumericFieldWithExtractor( "minutes_since_last_manual_test", "Minutes since last manual test.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() diff --git a/src/driver_lansenth.cc b/src/driver_lansenth.cc index aa0bc7a..f4f9baa 100644 --- a/src/driver_lansenth.cc +++ b/src/driver_lansenth.cc @@ -45,13 +45,13 @@ namespace addStringField( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "current_temperature", "The current temperature.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -62,7 +62,7 @@ namespace addNumericFieldWithExtractor( "current_relative_humidity", "The current humidity.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -73,7 +73,7 @@ namespace addNumericFieldWithExtractor( "average_temperature_1h", "The average temperature over the last hour.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -85,7 +85,7 @@ namespace addNumericFieldWithExtractor( "average_relative_humidity_1h", "The average humidity over the last hour.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -97,7 +97,7 @@ namespace addNumericFieldWithExtractor( "average_temperature_24h", "The average temperature over the last 24 hours.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -109,7 +109,7 @@ namespace addNumericFieldWithExtractor( "average_relative_humidity_24h", "The average humidity over the last 24 hours.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_lse_07_17.cc b/src/driver_lse_07_17.cc index 91482fe..bbe133c 100644 --- a/src/driver_lse_07_17.cc +++ b/src/driver_lse_07_17.cc @@ -27,6 +27,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("lse_07_17"); + di.setDefaultFields("name,id,total_m3,due_date_m3,due_date,error_code,error_date,device_date_time,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::S1); di.addDetection(MANUFACTURER_LSE, 0x06, 0x18); @@ -41,7 +42,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -52,7 +53,7 @@ namespace addNumericFieldWithExtractor( "due_date", "The water consumption at the due date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -64,7 +65,7 @@ namespace addStringFieldWithExtractor( "due_date", "The due date configured on the meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -74,7 +75,7 @@ namespace addNumericFieldWithExtractor( "what_date", "The water consumption at the what date?", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -86,7 +87,7 @@ namespace addStringFieldWithExtractor( "what_date", "The what date?", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -96,7 +97,7 @@ namespace addStringFieldWithExtractorAndLookup( "error_code", "Error code of the Meter, 0 means no error.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02BB56") ), @@ -117,7 +118,7 @@ namespace addStringFieldWithExtractor( "error_date", "The date the error occured at. If no error, reads 2127-15-31 (FFFF).", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::AtError) .set(VIFRange::Date) @@ -126,7 +127,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Date when measurement was recorded.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -135,7 +136,7 @@ namespace addStringFieldWithExtractor( "meter_version", "Meter model/version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ModelVersion) @@ -196,13 +197,13 @@ namespace // Test: Water lse_07_17 13963399 NOKEY // telegram=|244465329933961318067AE1000000_8C04130070000082046CBE2B01FD0C11046D010CA22C| -// {"media":"warm water","meter":"lse_07_17","name":"Water","id":"13963399","total_m3":null,"due_date_m3":null,"due_date":null,"what_date_m3":7,"what_date":"2021-11-30","error_code":null,"error_date":null,"device_date_time":"2021-12-02 12:01","meter_version":"11","timestamp":"1111-11-11T11:11:11Z"} -// |Water;13963399;nan;nan;null;null;null;2021-12-02 12:01;1111-11-11 11:11.11 +// {"media":"warm water","meter":"lse_07_17","name":"Water","id":"13963399","what_date_m3":7,"what_date":"2021-11-30","device_date_time":"2021-12-02 12:01","meter_version":"11","timestamp":"1111-11-11T11:11:11Z"} +// |Water;13963399;null;null;null;null;null;2021-12-02 12:01;1111-11-11 11:11.11 // telegram=|2A4465329933961318067AD8800000_8C04130070000082046CBE2B01FD0C11046D1800A12C02FDAC7E9B2E| -// {"media":"warm water","meter":"lse_07_17","name":"Water","id":"13963399","total_m3":null,"due_date_m3":null,"due_date":null,"what_date_m3":7,"what_date":"2021-11-30","error_code":null,"error_date":null,"device_date_time":"2021-12-01 00:24","meter_version":"11","timestamp":"1111-11-11T11:11:11Z"} -// |Water;13963399;nan;nan;null;null;null;2021-12-01 00:24;1111-11-11 11:11.11 +// {"media":"warm water","meter":"lse_07_17","name":"Water","id":"13963399","what_date_m3":7,"what_date":"2021-11-30","device_date_time":"2021-12-01 00:24","meter_version":"11","timestamp":"1111-11-11T11:11:11Z"} +// |Water;13963399;null;null;null;null;null;2021-12-01 00:24;1111-11-11 11:11.11 // 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.156000;0.000000;2127-15-31;OK;2127-15-31;2021-12-01 07:35;1111-11-11 11:11.11 +// |Water;13963399;7.156;0;2127-15-31;OK;2127-15-31;2021-12-01 07:35;1111-11-11 11:11.11 diff --git a/src/driver_lse_08.cc b/src/driver_lse_08.cc index 5d28d85..d2515f6 100644 --- a/src/driver_lse_08.cc +++ b/src/driver_lse_08.cc @@ -42,8 +42,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(DifVifKey("01FD73")), Translate::Lookup( @@ -64,7 +64,7 @@ namespace addNumericFieldWithExtractor( "current_consumption", "The current heat cost allocation.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -75,7 +75,7 @@ namespace addStringFieldWithExtractor( "set_date", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -85,7 +85,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "Heat cost allocation at the most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -97,7 +97,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Date and time when the meter sent the telegram.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -106,7 +106,7 @@ namespace addNumericFieldWithExtractor( "duration_since_readout", "Duration since last measurement.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -118,7 +118,7 @@ namespace addStringFieldWithExtractor( "model_version", "model version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ModelVersion) diff --git a/src/driver_microclima.cc b/src/driver_microclima.cc index 82fd777..668ac9a 100644 --- a/src/driver_microclima.cc +++ b/src/driver_microclima.cc @@ -42,8 +42,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status from error flags and tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -64,7 +64,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total heat energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -75,7 +75,7 @@ namespace addNumericFieldWithExtractor( "total_volume", "The total heating media volume recorded by this meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -86,7 +86,7 @@ namespace addNumericFieldWithExtractor( "volume_flow", "The current heat media volume flow.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -97,7 +97,7 @@ namespace addNumericFieldWithExtractor( "power", "The current power consumption.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -108,7 +108,7 @@ namespace addNumericFieldWithExtractor( "temperature_difference", "The difference between flow and return media temperatures.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::AutoSigned, FieldMatcher::build() @@ -119,7 +119,7 @@ namespace addNumericFieldWithExtractor( "set", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::OPTIONAL | PrintProperty::HIDE, + DEFAULT_PRINT_PROPERTIES | PrintProperty::HIDE, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -132,7 +132,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_{storage_counter}", "The total water consumption at the historic date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -144,7 +144,7 @@ namespace addNumericFieldWithCalculatorAndMatcher( "set_date_{storage_counter}", "Unclear! What is the date really?", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, "set_date - ((storage_counter-1counter) * 1 month)", FieldMatcher::build() diff --git a/src/driver_minomess.cc b/src/driver_minomess.cc index 9d14260..b6441c0 100644 --- a/src/driver_minomess.cc +++ b/src/driver_minomess.cc @@ -47,7 +47,7 @@ namespace addNumericFieldWithExtractor( "target", "The total water consumption recorded at the beginning of this month.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -59,7 +59,7 @@ namespace addStringFieldWithExtractor( "target_date", "Date when target water consumption was recorded.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -70,7 +70,7 @@ namespace addNumericFieldWithExtractor( "target", "The total water consumption recorded at the beginning of this month.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -82,7 +82,7 @@ namespace addStringFieldWithExtractor( "target_date", "Date when target water consumption was recorded.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -120,7 +120,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FD17")) , diff --git a/src/driver_mkradio3.cc b/src/driver_mkradio3.cc index 4f4a44f..6ff3f72 100644 --- a/src/driver_mkradio3.cc +++ b/src/driver_mkradio3.cc @@ -43,6 +43,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("mkradio3"); + di.setDefaultFields("name,id,total_m3,target_m3,current_date,prev_date,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_TCH, 0x62, 0x74); @@ -56,22 +57,22 @@ namespace addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The total water consumption recorded at the beginning of this month.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("current_date", Quantity::Text, [&](){ return currentDate(); }, "Date of current billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("prev_date", Quantity::Text, [&](){ return previousDate(); }, "Date of previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } void Driver::processContent(Telegram *t) @@ -174,5 +175,5 @@ namespace // Comment: There is a problem in the decoding here, the data stored inside the telegram does not seem to properly encode/decode the year.... // We should not report a current_date with a full year, if the year is actually not part of the telegram. // telegram=|2F446850313233347462A2_069F255900B029310000000306060906030609070606050509050505050407040605070500| -// {"media":"warm water","meter":"mkradio3","name":"Duschen","id":"34333231","total_m3":13.8,"target_m3":8.9,"current_date":"2022-04-27T02:00:00Z","prev_date":"2018-12-31T02:00:00Z","timestamp":"1111-11-11T11:11:11Z"} -// |Duschen;34333231;13.800000;8.900000;2022-04-27T02:00:00Z;2018-12-31T02:00:00Z;1111-11-11 11:11.11 +// {"media":"warm water","meter":"mkradio3","name":"Duschen","id":"34333231","total_m3":13.8,"target_m3":8.9,"current_date":"2023-04-27T02:00:00Z","prev_date":"2018-12-31T02:00:00Z","timestamp":"1111-11-11T11:11:11Z"} +// |Duschen;34333231;13.8;8.9;2023-04-27T02:00:00Z;2018-12-31T02:00:00Z;1111-11-11 11:11.11 diff --git a/src/driver_mkradio4.cc b/src/driver_mkradio4.cc index c344839..7d66ca8 100644 --- a/src/driver_mkradio4.cc +++ b/src/driver_mkradio4.cc @@ -37,6 +37,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("mkradio4"); + di.setDefaultFields("name,id,total_m3,target_m3,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_TCH, 0x62, 0x95); @@ -52,12 +53,12 @@ namespace addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The total water consumption recorded at the beginning of this month.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } void Driver::processContent(Telegram *t) @@ -112,4 +113,4 @@ namespace // Test: Duschagain mkradio4 02410120 NOKEY // telegram=|2F446850200141029562A2_06702901006017030004000300000000000000000000000000000000000000000000000000| // {"media":"warm water","meter":"mkradio4","name":"Duschagain","id":"02410120","total_m3":0.4,"target_m3":0.1,"timestamp":"1111-11-11T11:11:11Z"} -// |Duschagain;02410120;0.400000;0.100000;1111-11-11 11:11.11 +// |Duschagain;02410120;0.4;0.1;1111-11-11 11:11.11 diff --git a/src/driver_mkradio4a.cc b/src/driver_mkradio4a.cc index 5b4a803..351bcc6 100644 --- a/src/driver_mkradio4a.cc +++ b/src/driver_mkradio4a.cc @@ -44,7 +44,7 @@ namespace addNumericFieldWithExtractor( "target", "The total water consumption recorded at the end of previous year.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -56,7 +56,7 @@ namespace addNumericFieldWithExtractor( "target", "Date when previous year ended.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_multical21.cc b/src/driver_multical21.cc index f6dd185..e55bd56 100644 --- a/src/driver_multical21.cc +++ b/src/driver_multical21.cc @@ -42,7 +42,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status of meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS, FieldMatcher::build() .set(DifVifKey("02FF20")), Translate::Lookup() @@ -58,7 +58,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -69,7 +69,7 @@ namespace addNumericFieldWithExtractor( "target", "The total water consumption recorded at the beginning of this month.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -81,7 +81,7 @@ namespace addNumericFieldWithExtractor( "flow_temperature", "The water temperature.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -93,7 +93,7 @@ namespace addNumericFieldWithExtractor( "external_temperature", "The external temperature outside of the meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -106,7 +106,7 @@ namespace addNumericFieldWithExtractor( "min_external_temperature", "The lowest external temperature outside of the meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -117,7 +117,7 @@ namespace addNumericFieldWithExtractor( "max_flow", "The maxium flow recorded during previous period.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -129,7 +129,7 @@ namespace addStringFieldWithExtractorAndLookup( "current_status", "Status of meter. This field will go away use status instead.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::DEPRECATED, + DEFAULT_PRINT_PROPERTIES | PrintProperty::DEPRECATED, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -152,7 +152,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_dry", "Amount of time the meter has been dry.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -179,7 +179,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_reversed", "Amount of time the meter has been reversed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -206,7 +206,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_leaking", "Amount of time the meter has been leaking.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -233,7 +233,7 @@ namespace addStringFieldWithExtractorAndLookup( "time_bursting", "Amount of time the meter has been bursting.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("02FF20")), { @@ -272,9 +272,9 @@ namespace // Test: Vadden multical21 44556677 NOKEY // telegram=|2D442D2C776655441B168D2083B48D3A20_46887802FF20000004132F4E000092013B3D01A1015B028101E7FF0F03| -// {"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"target_m3":null,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} +// {"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} // |Vadden;44556677;20.015;null;0.317;2;3;OK;1111-11-11 11:11.11 // telegram=|21442D2C776655441B168D2079CC8C3A20_F4307912C40DFF00002F4E00003D010203| -// {"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"target_m3":null,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} +// {"media":"cold water","meter":"multical21","name":"Vadden","id":"44556677","status":"OK","total_m3":20.015,"flow_temperature_c":2,"external_temperature_c":3,"max_flow_m3h":0.317,"current_status":"","time_dry":"","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"1111-11-11T11:11:11Z"} // |Vadden;44556677;20.015;null;0.317;2;3;OK;1111-11-11 11:11.11 diff --git a/src/driver_munia.cc b/src/driver_munia.cc index dc8b0f1..eb54df2 100644 --- a/src/driver_munia.cc +++ b/src/driver_munia.cc @@ -40,8 +40,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status. Reports OK if neither tpl sts nor error flags have bits set.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(DifVifKey("02FD971D")), Translate::Lookup({ @@ -61,7 +61,7 @@ namespace addNumericFieldWithExtractor( "current_temperature", "The current temperature.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -72,7 +72,7 @@ namespace addNumericFieldWithExtractor( "current_relative_humidity", "The current relative humidity.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_omnipower.cc b/src/driver_omnipower.cc index 0c7ea3b..c432c7b 100644 --- a/src/driver_omnipower.cc +++ b/src/driver_omnipower.cc @@ -62,7 +62,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -73,7 +73,7 @@ namespace addNumericFieldWithExtractor( "total_energy_production", "The total energy backward (production) recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -85,7 +85,7 @@ namespace addNumericFieldWithExtractor( "current_power_consumption", "The current power consumption.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -96,7 +96,7 @@ namespace addNumericFieldWithExtractor( "current_power_production", "The current power production.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_piigth.cc b/src/driver_piigth.cc index a31e31b..e2b5c7d 100644 --- a/src/driver_piigth.cc +++ b/src/driver_piigth.cc @@ -41,13 +41,12 @@ namespace addStringField( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "temperature", "The current temperature.", - PrintProperty::JSON | PrintProperty::FIELD, + PrintProperty::REQUIRED, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -58,7 +57,7 @@ namespace addNumericFieldWithExtractor( "average_temperature_1h", "The average temperature over the last hour.", - PrintProperty::JSON | PrintProperty::FIELD, + PrintProperty::REQUIRED, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -70,7 +69,7 @@ namespace addNumericFieldWithExtractor( "average_temperature_24h", "The average temperature over the last 24 hours.", - PrintProperty::JSON | PrintProperty::FIELD, + PrintProperty::REQUIRED, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -82,7 +81,7 @@ namespace addNumericFieldWithExtractor( "relative_humidity", "The current relative humidity.", - PrintProperty::JSON | PrintProperty::FIELD, + PrintProperty::REQUIRED, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -93,7 +92,7 @@ namespace addNumericFieldWithExtractor( "relative_humidity_1h", "The average relative humidity over the last hour.", - PrintProperty::JSON | PrintProperty::FIELD, + PrintProperty::REQUIRED, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -105,7 +104,7 @@ namespace addNumericFieldWithExtractor( "relative_humidity_24h", "The average relative humidity over the last 24 hours.", - PrintProperty::JSON | PrintProperty::FIELD, + PrintProperty::REQUIRED, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_pollucomf.cc b/src/driver_pollucomf.cc index a88a615..64259eb 100644 --- a/src/driver_pollucomf.cc +++ b/src/driver_pollucomf.cc @@ -26,6 +26,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("pollucomf"); + di.setDefaultFields("name,id,status,total_kwh,total_m3,target_kwh,target_m3,timestamp"); di.setMeterType(MeterType::HeatMeter); di.addLinkMode(LinkMode::T1); // default di.addLinkMode(LinkMode::C1); @@ -39,13 +40,13 @@ namespace addStringField( "status", "Meter status.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "total", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -56,7 +57,7 @@ namespace addNumericFieldWithExtractor( "total", "The total amount of water that has passed through this meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -67,7 +68,7 @@ namespace addNumericFieldWithExtractor( "power", "The active power consumption.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -78,7 +79,7 @@ namespace addNumericFieldWithExtractor( "flow", "The flow of water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -89,7 +90,7 @@ namespace addNumericFieldWithExtractor( "forward", "The forward temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -100,7 +101,7 @@ namespace addNumericFieldWithExtractor( "return", "The return temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -111,7 +112,7 @@ namespace addStringFieldWithExtractor( "target_date", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -121,7 +122,7 @@ namespace addNumericFieldWithExtractor( "target", "The energy consumption recorded by this meter at the set date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -133,7 +134,7 @@ namespace addNumericFieldWithExtractor( "target", "The amount of water that had passed through this meter at the set date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -145,7 +146,7 @@ namespace addNumericFieldWithExtractor( "forward_max", "The maximum forward temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -157,7 +158,7 @@ namespace addNumericFieldWithExtractor( "return_max", "The maximum return temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -169,7 +170,7 @@ namespace addNumericFieldWithExtractor( "flow_max", "The maximum forward flow of water through this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -185,5 +186,5 @@ namespace // Test: Heat pollucomf 14175439 NOKEY // Comment: // telegram=|5e44ae4c395417141d047a9f0050252f2f046d2d32d92c0223B701040600000000041331000000032B000000033B000000025a3201025ef2003222000002fd170000426cBf2c440600000000441301000000525a0000525e0000533B000000| -// {"media":"heat","meter":"pollucomf","name":"Heat","id":"14175439","status":"OK","total_kwh":0,"total_m3":0.049,"power_kw":0,"flow_m3h":0,"forward_c":30.6,"return_c":24.2,"target_date":"2021-12-31","target_kwh":0,"target_m3":0.001,"forward_max_c":0,"return_max_c":0,"flow_max_m3h":0,"on_time_h":10536,"on_time_at_error_h":0,"meter_datetime":"2022-12-25 18:45","timestamp":"1111-11-11T11:11:11Z"} -// |Heat;14175439;OK;0.000000;0.049000;0.000000;0.001000;1111-11-11 11:11.11 +// {"media":"heat","meter":"pollucomf","name":"Heat","id":"14175439","status":"OK","total_kwh":0,"total_m3":0.049,"power_kw":0,"flow_m3h":0,"forward_c":30.6,"return_c":24.2,"target_date":"2021-12-31","target_kwh":0,"target_m3":0.001,"forward_max_c":0,"return_max_c":0,"flow_max_m3h":0,"on_time_h":10536,"on_time_at_error_h":0,"meter_datetime":"2022-12-25 18:45","timestamp":"1111-11-11T11:11:11Z"} +// |Heat;14175439;OK;0;0.049;0;0.001;1111-11-11 11:11.11 diff --git a/src/driver_q400.cc b/src/driver_q400.cc index c17250b..8870f6f 100644 --- a/src/driver_q400.cc +++ b/src/driver_q400.cc @@ -42,12 +42,12 @@ namespace addStringField( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addStringFieldWithExtractor( "set_datetime", "Date and time when the previous billing period ended.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -57,7 +57,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "The total water consumption at the end of the previous billing period.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -69,7 +69,7 @@ namespace addNumericFieldWithExtractor( "forward_at_set_date", "The total media volume flowing forward at the end of previous billing period.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -82,7 +82,7 @@ namespace addNumericFieldWithExtractor( "backward_at_set_date", "The total media volume flowing backward at the end of the previous billing period.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_qcaloric.cc b/src/driver_qcaloric.cc index 89eb2c2..2a6f7a3 100644 --- a/src/driver_qcaloric.cc +++ b/src/driver_qcaloric.cc @@ -48,8 +48,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(DifVifKey("01FD73")), Translate::Lookup( @@ -70,7 +70,7 @@ namespace addNumericFieldWithExtractor( "current_consumption", "The current heat cost allocation.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -81,7 +81,7 @@ namespace addStringFieldWithExtractor( "set_date", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -91,7 +91,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "Heat cost allocation at the most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -103,7 +103,7 @@ namespace addStringFieldWithExtractor( "set_date_1", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -113,7 +113,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_1", "Heat cost allocation at the most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -125,7 +125,7 @@ namespace addStringFieldWithExtractor( "set_date_8", "The 8 billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -135,7 +135,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_8", "Heat cost allocation at the 8 billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -147,7 +147,7 @@ namespace addStringFieldWithExtractor( "set_date_17", "The 17 billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -157,7 +157,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date_17", "Heat cost allocation at the 17 billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -169,7 +169,7 @@ namespace addStringFieldWithExtractor( "error_date", "Date when the meter entered an error state.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::AtError) .set(VIFRange::Date) @@ -178,7 +178,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Date and time when the meter sent the telegram.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -187,7 +187,7 @@ namespace addStringFieldWithExtractor( "model_version", "model version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ModelVersion) @@ -196,7 +196,7 @@ namespace addNumericFieldWithExtractor( "flow_temperature", "Forward media temperature.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -215,7 +215,7 @@ namespace // Test: MyElement2 qcaloric 90919293 NOKEY // Comment: Test mostly proprietary telegram without values // telegram=|49449344939291903408780DFF5F350082180000800007B06EFFFF970000009F2C70020000BE26970000000000010018002E001F002E0023FF210008000500020000002F046D220FA227| -// {"media":"heat cost allocation","meter":"qcaloric","name":"MyElement2","id":"90919293","status":"OK","current_consumption_hca":null,"set_date":null,"consumption_at_set_date_hca":null,"set_date_1":null,"consumption_at_set_date_1_hca":null,"device_date_time":"2021-07-02 15:34","timestamp":"1111-11-11T11:11:11Z"} +// {"media":"heat cost allocation","meter":"qcaloric","name":"MyElement2","id":"90919293","status":"OK","device_date_time":"2021-07-02 15:34","timestamp":"1111-11-11T11:11:11Z"} // |MyElement2;90919293;null;null;null;1111-11-11 11:11.11 // Comment: Normal telegram that fills in values. @@ -237,7 +237,7 @@ namespace // Comment: Another version of the heat cost allocator. Was known as whe46x, which now is a name alias mapped to qcaloric. // Test: HCA2 whe46x 60366655 NOKEY // telegram=|344465325566366018087A90040000046D1311962C01FD0C03326CFFFF01FD7300025AC2000DFF5F0C0008003030810613080BFFFC| -// {"media":"heat cost allocation","meter":"qcaloric","name":"HCA2","id":"60366655","status":"POWER_LOW","current_consumption_hca":null,"set_date":null,"consumption_at_set_date_hca":null,"set_date_1":null,"consumption_at_set_date_1_hca":null,"error_date":"2127-15-31","device_date_time":"2020-12-22 17:19","model_version":"03","flow_temperature_c":19.4,"timestamp":"1111-11-11T11:11:11Z"} +// {"media":"heat cost allocation","meter":"qcaloric","name":"HCA2","id":"60366655","status":"POWER_LOW","error_date":"2127-15-31","device_date_time":"2020-12-22 17:19","model_version":"03","flow_temperature_c":19.4,"timestamp":"1111-11-11T11:11:11Z"} // |HCA2;60366655;null;null;null;1111-11-11 11:11.11 // telegram=|2a4465325566366018087ac3040000046d1617Ba210B6e890000426c9f2c4B6e520600326cffff01fd7300| diff --git a/src/driver_qheat.cc b/src/driver_qheat.cc index 1aa0c9c..25da972 100644 --- a/src/driver_qheat.cc +++ b/src/driver_qheat.cc @@ -41,7 +41,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), @@ -78,7 +78,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -89,7 +89,7 @@ namespace addStringFieldWithExtractor( "last_month_date", "Last day previous month when total energy consumption was recorded.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(StorageNr(17)) @@ -99,7 +99,7 @@ namespace addNumericFieldWithExtractor( "last_month_energy_consumption", "The total energy consumption recorded at the last day of the previous month.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -111,7 +111,7 @@ namespace addStringFieldWithExtractor( "last_year_date", "Last day previous year when total energy consumption was recorded.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(StorageNr(1)) @@ -121,7 +121,7 @@ namespace addNumericFieldWithExtractor( "last_year_energy_consumption", "The total energy consumption recorded at the last day of the previous year.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -133,7 +133,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Device date time.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -142,7 +142,7 @@ namespace addStringFieldWithExtractor( "device_error_date", "Device error date.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::AtError) .set(VIFRange::Date) diff --git a/src/driver_qheat_55_us.cc b/src/driver_qheat_55_us.cc index a9493ac..1e1c4ab 100644 --- a/src/driver_qheat_55_us.cc +++ b/src/driver_qheat_55_us.cc @@ -51,7 +51,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Device date time.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -60,7 +60,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -74,7 +74,7 @@ namespace addStringFieldWithExtractor( "key_date", "The key (billing) date", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -86,7 +86,7 @@ namespace addNumericFieldWithExtractor( "key_date", "The total energy consumption recorded at key (billing) date", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -100,7 +100,7 @@ namespace addStringFieldWithExtractor( "prev_month", "The date of end of last month.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -118,7 +118,7 @@ namespace addNumericFieldWithExtractor( key, info, - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -133,7 +133,7 @@ namespace addNumericFieldWithExtractor( "actuality_duration", "The time between the measurement and the sending of this telegram.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -144,7 +144,7 @@ namespace addNumericFieldWithExtractor( "time_without_measurement", "How long the meter has been in an error state and unable to measure values, while powered up.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_qsmoke.cc b/src/driver_qsmoke.cc index 65f56df..11b92fc 100644 --- a/src/driver_qsmoke.cc +++ b/src/driver_qsmoke.cc @@ -40,8 +40,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter error flags. IMPORTANT! Smoke alarm is probably NOT reported here! You MUST check last alarm date and counter!", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags), Translate::Lookup( @@ -61,7 +61,7 @@ namespace addStringFieldWithExtractor( "last_alarm_date", "Date when the smoke alarm last triggered.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(StorageNr(6)) @@ -71,7 +71,7 @@ namespace addNumericFieldWithExtractor( "alarm", "Number of times the smoke alarm has triggered.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -81,7 +81,7 @@ namespace addStringFieldWithExtractor( "message_datetime", "Device date time.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -90,7 +90,7 @@ namespace addStringFieldWithExtractor( "test_button_last_date", "Date when test button was last pressed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(StorageNr(4)) @@ -100,7 +100,7 @@ namespace addNumericFieldWithExtractor( "test_button", "Number of times the test button has been pressed.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -110,7 +110,7 @@ namespace addNumericFieldWithExtractor( "transmission", "Transmission counter?", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -121,7 +121,7 @@ namespace addStringFieldWithExtractor( "at_error_date", "Date when the device entered an error state.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::AtError) .set(VIFRange::Date) @@ -130,7 +130,7 @@ namespace addNumericFieldWithExtractor( "some_sort_of_duration", "What does this mean?", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_qualcosonic.cc b/src/driver_qualcosonic.cc index 8ea1c68..2c20318 100644 --- a/src/driver_qualcosonic.cc +++ b/src/driver_qualcosonic.cc @@ -27,6 +27,8 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("qualcosonic"); + di.setDefaultFields("name,id,status,total_heat_energy_kwh,total_cooling_energy_kwh," + "power_kw,target_datetime,target_heat_energy_kwh,target_cooling_energy_kwh,timestamp"); di.setMeterType(MeterType::HeatCoolingMeter); di.addLinkMode(LinkMode::C1); di.addDetection(MANUFACTURER_AXI, 0x0d, 0x0b); @@ -41,8 +43,8 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Meter status. Includes both meter error field and tpl status field.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags), Translate::Lookup( @@ -64,7 +66,7 @@ namespace addNumericFieldWithExtractor( "total_heat_energy", "The total heating energy consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -76,7 +78,7 @@ namespace addNumericFieldWithExtractor( "total_cooling_energy", "The total cooling energy consumption recorded by this meter.", - PrintProperty::FIELD | PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -88,7 +90,7 @@ namespace addNumericFieldWithExtractor( "power", "The current power consumption.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::AutoSigned, FieldMatcher::build() @@ -99,7 +101,7 @@ namespace addStringFieldWithExtractor( "target_datetime", "Date and time when the previous billing period ended.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -109,7 +111,7 @@ namespace addNumericFieldWithExtractor( "target_heat_energy", "The heating energy consumption recorded at the end of the previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -122,7 +124,7 @@ namespace addNumericFieldWithExtractor( "target_cooling_energy", "The cooling energy consumption recorded at the end of the previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -138,4 +140,4 @@ namespace // Test: qualco qualcosonic 03016408 NOKEY // telegram=|76440907086401030B0d7a78000000046d030fB726346d0000010134fd170000000004200f13cf0104240f13cf0104863B0000000004863cdc0000000413B5150600042B86f1ffff043B030200000259c002025d2c05026194fd0c780864010384086d3B17Bf258408863B000000008408863c0B000000| // {"media":"heat/cooling load","meter":"qualcosonic","name":"qualco","id":"03016408","fabrication_no":"03016408","operating_time_h":8430.013056,"on_time_h":8430.013056,"meter_datetime":"2021-06-23 15:03","meter_datetime_at_error":"2000-01-01 00:00","total_m3":398.773,"flow_temperature_c":7.04,"return_temperature_c":13.24,"flow_return_temperature_difference_c":-6.2,"volume_flow_m3h":0.515,"status":"OK","total_heat_energy_kwh":0,"total_cooling_energy_kwh":220,"power_kw":-3.706,"target_datetime":"2021-05-31 23:59","target_heat_energy_kwh":0,"target_cooling_energy_kwh":11,"timestamp":"1111-11-11T11:11:11Z"} -// |qualco;03016408;OK;0.000000;220.000000;-3.706000;2021-05-31 23:59;0.000000;11.000000;1111-11-11 11:11.11 +// |qualco;03016408;OK;0;220;-3.706;2021-05-31 23:59;0;11;1111-11-11 11:11.11 diff --git a/src/driver_qwater.cc b/src/driver_qwater.cc index fa72084..ff30921 100644 --- a/src/driver_qwater.cc +++ b/src/driver_qwater.cc @@ -52,12 +52,12 @@ namespace addStringField( "status", "Meter status tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "due_date", "The water consumption at the due date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -69,7 +69,7 @@ namespace addNumericFieldWithExtractor( "due", "The due date for billing date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -82,7 +82,7 @@ namespace addNumericFieldWithExtractor( "due_17_date", "The water consumption at the 17 due date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -94,7 +94,7 @@ namespace addNumericFieldWithExtractor( "due_17", "The due date for billing date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -107,7 +107,7 @@ namespace addNumericFieldWithExtractor( "volume_flow", "Media volume flow when duration exceeds lower last.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -119,7 +119,7 @@ namespace addNumericFieldWithExtractor( "error", "The date the error occured at. If no error, reads 2127-15-31 (FFFF).", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_rfmamb.cc b/src/driver_rfmamb.cc index 97bb754..111d9ad 100644 --- a/src/driver_rfmamb.cc +++ b/src/driver_rfmamb.cc @@ -39,13 +39,13 @@ namespace addStringField( "status", "Meter status from tpl status field.", - PrintProperty::JSON | PrintProperty::IMPORTANT | - PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS); + DEFAULT_PRINT_PROPERTIES | + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS); addNumericFieldWithExtractor( "current_temperature", "The current temperature.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -56,7 +56,7 @@ namespace addNumericFieldWithExtractor( "average_temperature_1h", "The average temperature over the last hour.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -68,7 +68,7 @@ namespace addNumericFieldWithExtractor( "average_temperature_24h", "The average temperature over the last 24 hours.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -80,7 +80,7 @@ namespace addNumericFieldWithExtractor( "maximum_temperature_1h", "The maximum temperature over the last hour.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -91,7 +91,7 @@ namespace addNumericFieldWithExtractor( "maximum_temperature_24h", "The maximum temperature over the last 24 hours.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -103,7 +103,7 @@ namespace addNumericFieldWithExtractor( "minimum_temperature_1h", "The minimum temperature over the last hour.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -114,7 +114,7 @@ namespace addNumericFieldWithExtractor( "minimum_temperature_24h", "The minimum temperature over the last 24 hours.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -126,7 +126,7 @@ namespace addNumericFieldWithExtractor( "current_relative_humidity", "The current relative humidity.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -137,7 +137,7 @@ namespace addNumericFieldWithExtractor( "average_relative_humidity_1h", "The average relative humidity over the last hour.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -149,7 +149,7 @@ namespace addNumericFieldWithExtractor( "average_relative_humidity_24h", "The average relative humidity over the last 24 hours.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -161,7 +161,7 @@ namespace addNumericFieldWithExtractor( "maximum_relative_humidity_1h", "The maximum relative humidity over the last hour.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -172,7 +172,7 @@ namespace addNumericFieldWithExtractor( "maximum_relative_humidity_24h", "The maximum relative humidity over the last 24 hours.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -184,7 +184,7 @@ namespace addNumericFieldWithExtractor( "minimum_relative_humidity_1h", "The minimum relative humidity over the last hour.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -195,7 +195,7 @@ namespace addNumericFieldWithExtractor( "minimum_relative_humidity_24h", "The minimum relative humidity over the last 24 hours.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::RelativeHumidity, VifScaling::Auto, FieldMatcher::build() @@ -207,7 +207,7 @@ namespace addNumericFieldWithExtractor( "device", "The meters date time.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_rfmtx1.cc b/src/driver_rfmtx1.cc index 9f4801f..8deb507 100644 --- a/src/driver_rfmtx1.cc +++ b/src/driver_rfmtx1.cc @@ -40,7 +40,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -51,7 +51,7 @@ namespace addStringFieldWithExtractor( "meter_datetime", "Date time when meter sent this telegram.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime)); diff --git a/src/driver_sensostar.cc b/src/driver_sensostar.cc index 63641c8..0b4b829 100644 --- a/src/driver_sensostar.cc +++ b/src/driver_sensostar.cc @@ -27,6 +27,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("sensostar"); + di.setDefaultFields("name,id,total_kwh,total_water_m3,current_status,reporting_date,energy_consumption_at_reporting_date_kwh,timestamp"); di.setMeterType(MeterType::HeatMeter); di.addLinkMode(LinkMode::C1); di.addLinkMode(LinkMode::T1); @@ -39,7 +40,7 @@ namespace addStringFieldWithExtractor( "meter_timestamp", "Date time for this reading.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -48,7 +49,7 @@ namespace addNumericFieldWithExtractor( "total", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -59,7 +60,7 @@ namespace addNumericFieldWithExtractor( "power", "The active power consumption.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -70,7 +71,7 @@ namespace addNumericFieldWithExtractor( "power_max", "The maximum power consumption over ?period?.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -81,7 +82,7 @@ namespace addNumericFieldWithExtractor( "flow_water", "The flow of water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -92,7 +93,7 @@ namespace addNumericFieldWithExtractor( "flow_water_max", "The maximum forward flow of water over a ?period?.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -103,7 +104,7 @@ namespace addNumericFieldWithExtractor( "forward", "The forward temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -114,7 +115,7 @@ namespace addNumericFieldWithExtractor( "return", "The return temperature of the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -125,7 +126,7 @@ namespace addNumericFieldWithExtractor( "difference", "The temperature difference forward-return for the water.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::AutoSigned, FieldMatcher::build() @@ -136,7 +137,7 @@ namespace addNumericFieldWithExtractor( "total_water", "The total amount of water that has passed through this meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -147,7 +148,7 @@ namespace addStringFieldWithExtractorAndLookup( "current_status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(VIFRange::ErrorFlags), { @@ -175,7 +176,7 @@ namespace addStringFieldWithExtractor( "reporting_date", "The reporting date of the last billing period.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -185,7 +186,7 @@ namespace addNumericFieldWithExtractor( "energy_consumption_at_reporting_date", "The energy consumption at the last billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -202,7 +203,7 @@ namespace addNumericFieldWithExtractor( name, info, - PrintProperty::JSON| PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -217,10 +218,10 @@ namespace // Comment: // telegram=|68B3B36808007257004820c51400046c100000047839803801040600000000041300000000042B00000000142B00000000043B00000000143B00000000025B1400025f15000261daff02235c00046d2c2ddc24440600000000441300000000426c000001fd171003fd0c05000084200600000000c420060000000084300600000000c430060000000084401300000000c44013000000008480401300000000c48040130000000084c0401300000000c4c0401300000000a216| // {"media":"heat","meter":"sensostar","name":"Heat","id":"20480057","meter_timestamp":"2022-04-28 13:44","total_kwh":0,"power_kw":0,"power_max_kw":0,"flow_water_m3h":0,"flow_water_max_m3h":0,"forward_c":20,"return_c":21,"difference_c":-0.38,"total_water_m3":0,"current_status":"ERROR_FLOW_MEASUREMENT_SYSTEM_ERROR","reporting_date":"2000-00-00","energy_consumption_at_reporting_date_kwh":0,"consumption_1_months_ago_kwh":0,"timestamp":"1111-11-11T11:11:11Z"} -// |Heat;20480057;0.000000;0.000000;ERROR_FLOW_MEASUREMENT_SYSTEM_ERROR;2000-00-00;0.000000;1111-11-11 11:11.11 +// |Heat;20480057;0;0;ERROR_FLOW_MEASUREMENT_SYSTEM_ERROR;2000-00-00;0;1111-11-11 11:11.11 // Test: WMZ sensostar 02752560 NOKEY // Comment: from "Sensostar U" //telegram=a444c5146025750200047ac20000202f2f046d2e26c62a040643160000041310f0050001fd1700426cbf2c4406570e00008401061f160000840206f6150000840306f5150000840406f3150000840506ea150000840606bf1500008407065214000084080692120000840906c5100000840a06570e0000840b06ca0b0000840c06da090000840d06ca080000840e06c8080000840f06c608000003fd0c05010002fd0b2111 //{"media":"heat","meter":"sensostar","name":"WMZ","id":"02752560","meter_timestamp":"2022-10-06 06:46","total_kwh":5699,"total_water_m3":389.136,"current_status":"OK","reporting_date":"2021-12-31","energy_consumption_at_reporting_date_kwh":3671,"consumption_1_months_ago_kwh":5663,"consumption_2_months_ago_kwh":5622,"consumption_3_months_ago_kwh":5621,"consumption_4_months_ago_kwh":5619,"consumption_5_months_ago_kwh":5610,"consumption_6_months_ago_kwh":5567,"consumption_7_months_ago_kwh":5202,"consumption_8_months_ago_kwh":4754,"consumption_9_months_ago_kwh":4293,"consumption_10_months_ago_kwh":3671,"consumption_11_months_ago_kwh":3018,"consumption_12_months_ago_kwh":2522,"consumption_13_months_ago_kwh":2250,"consumption_14_months_ago_kwh":2248,"consumption_15_months_ago_kwh":2246,"timestamp":"1111-11-11 11:11.11"} -//WMZ;02752560;5699.000000;389.136000;OK;1111-11-11 11:11.11 +//WMZ;02752560;5699;389.136000;OK;1111-11-11 11:11.11 diff --git a/src/driver_sharky.cc b/src/driver_sharky.cc index d4ad996..49dd77b 100644 --- a/src/driver_sharky.cc +++ b/src/driver_sharky.cc @@ -28,6 +28,9 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("sharky"); + di.setDefaultFields("name,id,total_energy_consumption_kwh,total_energy_consumption_tariff1_kwh,total_volume_m3," + "total_volume_tariff2_m3,volume_flow_m3h,power_kw,flow_temperature_c," + "return_temperature_c,temperature_difference_c,timestamp"); di.setMeterType(MeterType::HeatMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_HYD, 0x04, 0x20); @@ -39,7 +42,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total heat energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -50,7 +53,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption_tariff1", "The total heat energy consumption recorded by this meter on tariff 1.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -62,7 +65,7 @@ namespace addNumericFieldWithExtractor( "total_volume", "The total heating media volume recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -73,7 +76,7 @@ namespace addNumericFieldWithExtractor( "total_volume_tariff2", "The total heating media volume recorded by this meter on tariff 2.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -85,7 +88,7 @@ namespace addNumericFieldWithExtractor( "volume_flow", "The current heat media volume flow.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -96,7 +99,7 @@ namespace addNumericFieldWithExtractor( "power", "The current power consumption.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -107,7 +110,7 @@ namespace addNumericFieldWithExtractor( "flow_temperature", "The current forward heat media temperature.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -118,7 +121,7 @@ namespace addNumericFieldWithExtractor( "return_temperature", "The current return heat media temperature.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -129,7 +132,7 @@ namespace addNumericFieldWithExtractor( "temperature_difference", "The current return heat media temperature.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::AutoSigned, FieldMatcher::build() @@ -142,4 +145,4 @@ namespace // Test: Heat sharky ANYID NOKEY // telegram=|534424232004256092687A370045752235854DEEEA5939FAD81C25FEEF5A23C38FB9168493C563F08DB10BAF87F660FBA91296BA2397E8F4220B86D3A192FB51E0BFCF24DCE72118E0C75A9E89F43BDFE370824B| // {"media":"heat","meter":"sharky","name":"Heat","id":"68926025","total_energy_consumption_kwh":2651,"total_energy_consumption_tariff1_kwh":0,"total_volume_m3":150.347,"total_volume_tariff2_m3":0.018,"volume_flow_m3h":0,"power_kw":0,"flow_temperature_c":42.3,"return_temperature_c":28.1,"temperature_difference_c":14.1,"timestamp":"1111-11-11T11:11:11Z"} -// |Heat;68926025;2651.000000;0.000000;150.347000;0.018000;0.000000;0.000000;42.300000;28.100000;14.100000;1111-11-11 11:11.11 +// |Heat;68926025;2651;0;150.347;0.018;0;0;42.3;28.1;14.1;1111-11-11 11:11.11 diff --git a/src/driver_sharky774.cc b/src/driver_sharky774.cc index bf921b5..00f36cb 100644 --- a/src/driver_sharky774.cc +++ b/src/driver_sharky774.cc @@ -45,7 +45,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -56,7 +56,7 @@ namespace addNumericFieldWithExtractor( "total_cooling_consumption", "The total cooling energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -68,7 +68,7 @@ namespace addNumericFieldWithExtractor( "total_volume", "The total volume recorded by this meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -79,7 +79,7 @@ namespace addNumericFieldWithExtractor( "total_cooling_volume", "The total cooling volume recorded by this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -91,7 +91,7 @@ namespace addNumericFieldWithExtractor( "volume_flow", "The current flow.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -102,7 +102,7 @@ namespace addNumericFieldWithExtractor( "power", "The power.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::AutoSigned, FieldMatcher::build() @@ -113,7 +113,7 @@ namespace addNumericFieldWithExtractor( "flow_temperature", "The flow temperature.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -124,7 +124,7 @@ namespace addNumericFieldWithExtractor( "return_temperature", "The return temperature.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -135,7 +135,7 @@ namespace addNumericFieldWithExtractor( "operating_time", "How long the meter has been collecting data.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -146,7 +146,7 @@ namespace addNumericFieldWithExtractor( "operating_time_in_error", "How long the meter has been in an error state and not collected data.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -158,7 +158,7 @@ namespace addNumericFieldWithExtractor( "energy_at_set_date", "The total energy consumption recorded by this meter at the set date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -170,7 +170,7 @@ namespace addNumericFieldWithExtractor( "cooling_at_set_date", "The total cooling energy consumption recorded by this meter at the set date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -183,7 +183,7 @@ namespace addNumericFieldWithExtractor( "set", "The last billing set date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_sontex868.cc b/src/driver_sontex868.cc index 5b002f3..2b86353 100644 --- a/src/driver_sontex868.cc +++ b/src/driver_sontex868.cc @@ -41,7 +41,7 @@ namespace addNumericFieldWithExtractor( "current_consumption", "The current heat cost allocation for this meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -52,7 +52,7 @@ namespace addStringFieldWithExtractor( "set_date", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -62,7 +62,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "Heat cost allocation at the most recent billing period date.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() @@ -74,7 +74,7 @@ namespace addNumericFieldWithExtractor( "current_temp", "The current temperature of the heating element.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -85,7 +85,7 @@ namespace addNumericFieldWithExtractor( "current_room_temp", "The current room temperature.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -96,7 +96,7 @@ namespace addNumericFieldWithExtractor( "max_temp", "The maximum temperature so far during this billing period.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -108,7 +108,7 @@ namespace addNumericFieldWithExtractor( "max_temp_previous_period", "The maximum temperature during the previous billing period.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -120,7 +120,7 @@ namespace addStringFieldWithExtractor( "device_date_time", "Date and time when the meter sent the telegram.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) diff --git a/src/driver_supercom587.cc b/src/driver_supercom587.cc index 6c1478e..9e5af8f 100644 --- a/src/driver_supercom587.cc +++ b/src/driver_supercom587.cc @@ -43,7 +43,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status of meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ErrorFlags), diff --git a/src/driver_topaseskr.cc b/src/driver_topaseskr.cc index cd291ce..f6164ec 100644 --- a/src/driver_topaseskr.cc +++ b/src/driver_topaseskr.cc @@ -65,7 +65,7 @@ namespace addNumericFieldWithExtractor( "temperature", "Current water temperature recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -75,7 +75,7 @@ namespace addNumericFieldWithExtractor( "current_flow", "The current water flow.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -85,7 +85,7 @@ namespace addNumericFieldWithExtractor( "volume_year_period", "Volume up to end of last year-period.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -97,7 +97,7 @@ namespace addNumericFieldWithExtractor( "reverse_volume_year_period", "Reverse volume in this year-period (?)", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -111,7 +111,7 @@ namespace addStringFieldWithExtractor( "meter_year_period_start_date", "Meter date for year-period start.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -121,7 +121,7 @@ namespace addNumericFieldWithExtractor( "volume_month_period", "Volume up to end of last month-period.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -133,7 +133,7 @@ namespace addStringFieldWithExtractor( "meter_month_period_start_datetime", "Meter timestamp for month-period start.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -143,7 +143,7 @@ namespace addNumericFieldWithExtractor( "battery", "Remaining battery life in years.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_tsd2.cc b/src/driver_tsd2.cc index 95c7004..2533afb 100644 --- a/src/driver_tsd2.cc +++ b/src/driver_tsd2.cc @@ -39,6 +39,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("tsd2"); + di.setDefaultFields("name,id,status,prev_date,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_TCH, 0xf0, 0x76); @@ -57,12 +58,12 @@ namespace addPrint("status", Quantity::Text, [&](){ return status(); }, "The current status: OK, SMOKE or ERROR.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); addPrint("prev_date", Quantity::Text, [&](){ return previousDate(); }, "Date of previous billing period.", - PrintProperty::FIELD | PrintProperty::JSON); + DEFAULT_PRINT_PROPERTIES); } #define INFO_CODE_SMOKE 0x0001 diff --git a/src/driver_ultraheat.cc b/src/driver_ultraheat.cc index 8655048..a068051 100644 --- a/src/driver_ultraheat.cc +++ b/src/driver_ultraheat.cc @@ -27,6 +27,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("ultraheat"); + di.setDefaultFields("name,id,heat_kwh,timestamp"); di.setMeterType(MeterType::HeatMeter); di.addDetection(MANUFACTURER_LUG, 0x04, 0x04); di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new Driver(mi, di)); }); @@ -37,7 +38,7 @@ namespace addNumericFieldWithExtractor( "heat", "The total heat energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -48,7 +49,7 @@ namespace addNumericFieldWithExtractor( "volume", "The total heating media volume recorded by this meter.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -59,7 +60,7 @@ namespace addNumericFieldWithExtractor( "power", "The current power consumption.", - PrintProperty::JSON , + DEFAULT_PRINT_PROPERTIES, Quantity::Power, VifScaling::Auto, FieldMatcher::build() @@ -70,7 +71,7 @@ namespace addNumericFieldWithExtractor( "flow", "The current heat media volume flow.", - PrintProperty::JSON , + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -81,7 +82,7 @@ namespace addNumericFieldWithExtractor( "flow", "The current forward heat media temperature.", - PrintProperty::JSON , + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -92,7 +93,7 @@ namespace addNumericFieldWithExtractor( "return", "The current return heat media temperature.", - PrintProperty::JSON , + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_ultrimis.cc b/src/driver_ultrimis.cc index c387824..9c84821 100644 --- a/src/driver_ultrimis.cc +++ b/src/driver_ultrimis.cc @@ -26,6 +26,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("ultrimis"); + di.setDefaultFields("name,id,total_m3,target_m3,current_status,total_backward_flow_m3,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::T1); di.addDetection(MANUFACTURER_APA, 0x16, 0x01); @@ -37,7 +38,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -48,7 +49,7 @@ namespace addNumericFieldWithExtractor( "target", "The total water consumption recorded at the beginning of this month.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -60,7 +61,7 @@ namespace addStringFieldWithExtractorAndLookup( "current_status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(DifVifKey("03FD17")), { @@ -89,7 +90,7 @@ namespace addNumericFieldWithExtractor( "total_backward_flow", "The total backward water volume recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -102,4 +103,4 @@ namespace // Comment: // telegram=|2E4401069897969501167A4B0320052F2F_0413320C000003FD1700000044132109000004933C000000002F2F2F2F2F| // {"media":"cold water","meter":"ultrimis","name":"Water","id":"95969798","total_m3":3.122,"target_m3":2.337,"current_status":"OK","total_backward_flow_m3":0,"timestamp":"1111-11-11T11:11:11Z"} -// |Water;95969798;3.122000;2.337000;OK;0.000000;1111-11-11 11:11.11 +// |Water;95969798;3.122;2.337;OK;0;1111-11-11 11:11.11 diff --git a/src/driver_unismart.cc b/src/driver_unismart.cc index 5fbe5af..141c5b6 100644 --- a/src/driver_unismart.cc +++ b/src/driver_unismart.cc @@ -42,7 +42,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status of meter?", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS, FieldMatcher::build() .set(DifVifKey("02FD74")), { @@ -61,7 +61,7 @@ namespace addStringFieldWithExtractorAndLookup( "other", "Other status of meter?", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::STATUS, FieldMatcher::build() .set(DifVifKey("017F")), { @@ -80,7 +80,7 @@ namespace addStringFieldWithExtractor( "total_date_time", "Timestamp for this total measurement.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -90,7 +90,7 @@ namespace addNumericFieldWithExtractor( "total", "The total gas consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -102,7 +102,7 @@ namespace addStringFieldWithExtractor( "target_date_time", "Timestamp for gas consumption recorded at the beginning of this month.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -112,7 +112,7 @@ namespace addNumericFieldWithExtractor( "target", "The total gas consumption recorded by this meter at the beginning of this month.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -125,7 +125,7 @@ namespace addStringFieldWithExtractor( "version", "Model version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ModelVersion) @@ -134,7 +134,7 @@ namespace addStringFieldWithExtractor( "supplier_info", "Supplier info?", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::SpecialSupplierInformation) @@ -143,7 +143,7 @@ namespace addStringFieldWithExtractor( "parameter_set", "Meter configued with this parameter set?", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ParameterSet) @@ -152,7 +152,7 @@ namespace addStringFieldWithExtractor( "meter_timestamp", "Timestamp when this measurement was sent.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) diff --git a/src/driver_unknown.cc b/src/driver_unknown.cc index 6051bc9..cb62780 100644 --- a/src/driver_unknown.cc +++ b/src/driver_unknown.cc @@ -29,6 +29,7 @@ struct MeterUnknown : public virtual MeterCommonImplementation static bool ok = registerDriver([](DriverInfo&di) { di.setName("unknown"); + di.setDefaultFields("name,id,timestamp"); di.setMeterType(MeterType::UnknownMeter); di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new MeterUnknown(mi, di)); }); }); diff --git a/src/driver_vario411.cc b/src/driver_vario411.cc index bd3f0c7..c53ec29 100644 --- a/src/driver_vario411.cc +++ b/src/driver_vario411.cc @@ -42,7 +42,7 @@ namespace addNumericFieldWithExtractor( "target", "Total energy consumption at the end of the year", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -54,7 +54,7 @@ namespace addNumericFieldWithExtractor( "target", "Date when previous year ended.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_vario451.cc b/src/driver_vario451.cc index 35a1761..cee554f 100644 --- a/src/driver_vario451.cc +++ b/src/driver_vario451.cc @@ -29,6 +29,7 @@ namespace static bool ok = registerDriver([](DriverInfo&di) { di.setName("vario451"); + di.setDefaultFields("name,id,total_kwh,current_kwh,previous_kwh,timestamp"); di.setMeterType(MeterType::WaterMeter); di.addLinkMode(LinkMode::C1); di.addLinkMode(LinkMode::T1); @@ -41,17 +42,17 @@ namespace { addNumericField("total", Quantity::Energy, - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, "The total energy consumption recorded by this meter."); addNumericField("current", Quantity::Energy, - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, "Energy consumption so far in this billing period."); addNumericField("previous", Quantity::Energy, - PrintProperty::FIELD | PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, "Energy consumption in previous billing period."); } diff --git a/src/driver_vario451mid.cc b/src/driver_vario451mid.cc index ba5e008..93b6c34 100644 --- a/src/driver_vario451mid.cc +++ b/src/driver_vario451mid.cc @@ -40,7 +40,7 @@ namespace addNumericFieldWithExtractor( "total_energy_consumption", "The total energy consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -51,7 +51,7 @@ namespace addNumericFieldWithExtractor( "energy_at_old_date", "The total energy consumption recorded when?", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -63,7 +63,7 @@ namespace addNumericFieldWithExtractor( "old", "The last billing old date?", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -75,7 +75,7 @@ namespace addNumericFieldWithExtractor( "energy_at_set_date", "The total energy consumption recorded by this meter at the due date.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::Energy, VifScaling::Auto, FieldMatcher::build() @@ -87,7 +87,7 @@ namespace addNumericFieldWithExtractor( "set", "The last billing set date.", - PrintProperty::JSON, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() diff --git a/src/driver_waterstarm.cc b/src/driver_waterstarm.cc index 663371a..51a5971 100644 --- a/src/driver_waterstarm.cc +++ b/src/driver_waterstarm.cc @@ -45,7 +45,7 @@ namespace addStringFieldWithExtractorAndLookup( "status", "Status and error flags.", - PrintProperty::JSON | PrintProperty::JOIN_TPL_STATUS | PrintProperty::STATUS, + DEFAULT_PRINT_PROPERTIES | PrintProperty::INCLUDE_TPL_STATUS | PrintProperty::STATUS, FieldMatcher::build() .set(VIFRange::ErrorFlags), { @@ -73,7 +73,7 @@ namespace addNumericFieldWithExtractor( "meter", "Device date time.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -84,7 +84,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -95,7 +95,7 @@ namespace addNumericFieldWithExtractor( "total_backwards", "The total backward water volume recorded by this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -107,7 +107,7 @@ namespace addStringFieldWithExtractorAndLookup( "current_status", "Status and error flags. (Deprecated use status instead.)", - PrintProperty::JSON | PrintProperty::JOIN_TPL_STATUS | PrintProperty::STATUS | PrintProperty::DEPRECATED, + DEFAULT_PRINT_PROPERTIES | PrintProperty::INCLUDE_TPL_STATUS | PrintProperty::STATUS | PrintProperty::DEPRECATED, FieldMatcher::build() .set(VIFRange::ErrorFlags), { @@ -135,7 +135,7 @@ namespace addStringFieldWithExtractor( "meter_version", "Meter model/version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ModelVersion) @@ -144,7 +144,7 @@ namespace addStringFieldWithExtractor( "parameter_set", "Parameter set.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ParameterSet) @@ -153,7 +153,7 @@ namespace addNumericFieldWithExtractor( "battery", "The battery voltage.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Voltage, VifScaling::Auto, FieldMatcher::build() @@ -164,7 +164,7 @@ namespace addNumericFieldWithExtractor( "set", "The most recent billing period date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, VifScaling::Auto, FieldMatcher::build() @@ -177,7 +177,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_set_date", "The total water consumption at the most recent billing period date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -189,7 +189,7 @@ namespace addNumericFieldWithExtractor( "consumption_at_history_{storage_counter - 1 counter}", "The total water consumption at the historic date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -201,7 +201,7 @@ namespace addNumericFieldWithCalculatorAndMatcher( "history_{storage_counter - 1 counter}", "The historic date.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::PointInTime, "meter_datetime - ((storage_counter-1counter) * 1 month)", FieldMatcher::build() diff --git a/src/driver_weh_07.cc b/src/driver_weh_07.cc index 4293154..b0087ad 100644 --- a/src/driver_weh_07.cc +++ b/src/driver_weh_07.cc @@ -40,7 +40,7 @@ namespace addNumericFieldWithExtractor( "total", "The total water consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() diff --git a/src/meters.cc b/src/meters.cc index a1891f4..c4865d2 100644 --- a/src/meters.cc +++ b/src/meters.cc @@ -265,7 +265,7 @@ void MeterCommonImplementation::addExtraCalculatedField(string ecf) addNumericFieldWithCalculator( vname, "Calculated: "+ecf, - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, quantity, parts[1], unit @@ -985,46 +985,6 @@ void MeterCommonImplementation::triggerUpdate(Telegram *t) t->handled = true; } -string concatAllFields(Meter *m, Telegram *t, char c, vector &fields, bool hr, - vector *extra_constant_fields) -{ - string s; - s = ""; - s += m->name() + c; - if (t->ids.size() > 0) - { - s += t->ids.back() + c; - } - else - { - s += c; - } - for (FieldInfo &fi : fields) - { - if (fi.printProperties().hasFIELD()) - { - if (fi.xuantity() == Quantity::Text) - { - s += m->getStringValue(&fi); - } - else - { - Unit u = fi.displayUnit(); - double v = m->getNumericValue(&fi, u); - if (hr) { - s += valueToString(v, u); - s += " "+unitToStringHR(u); - } else { - s += to_string(v); - } - } - s += c; - } - } - s += m->datetimeOfUpdateHumanReadable(); - return s; -} - string findField(string key, vector *extra_constant_fields) { key = key+"="; @@ -1166,16 +1126,9 @@ string concatFields(Meter *m, Telegram *t, char c, vector &prints, bo { if (selected_fields == NULL || selected_fields->size() == 0) { - // No global override, but is there a meter driver setting? - if (m->selectedFields().size() > 0) - { - selected_fields = &m->selectedFields(); - } - else - { - return concatAllFields(m, t, c, prints, human_readable, extra_constant_fields); - } + selected_fields = &m->selectedFields(); } + string buf = ""; for (string field : *selected_fields) @@ -1363,7 +1316,7 @@ void MeterCommonImplementation::processFieldExtractors(Telegram *t) { fi.performExtraction(this, t, NULL); } - else if (founds.count(&fi) == 0 && fi.printProperties().hasJOINTPLSTATUS()) + else if (founds.count(&fi) == 0 && fi.printProperties().hasINCLUDETPLSTATUS()) { // This is a status field and it joins the tpl status but it also // has a potential dve match, which did not trigger. Now @@ -1532,7 +1485,7 @@ string MeterCommonImplementation::getStringValue(FieldInfo *fi) // joined into this status field. for (FieldInfo &f : field_infos_) { - if (f.printProperties().hasJOININTOSTATUS()) + if (f.printProperties().hasINJECTINTOSTATUS()) { string more = getStringValue(&f); string joined = joinStatusOKStrings(value, more); @@ -1780,64 +1733,62 @@ void MeterCommonImplementation::printMeter(Telegram *t, for (FieldInfo& fi : field_infos_) { - if (fi.printProperties().hasJSON() && !fi.printProperties().hasHIDE()) - { - // The field should be printed in the json. (Most usually should.) - for (auto& i : t->dv_entries) - { - // Check each telegram dv entry. - DVEntry *dve = &i.second.second; - // Has the entry been matches to this field, then print it as json. - if (dve->hasFieldInfo(&fi)) - { - assert(founds[&fi].count(dve) == 0); + if (fi.printProperties().hasHIDE()) continue; - founds[&fi].insert(dve); - string field_name = fi.generateFieldNameNoUnit(dve); - found_vnames.insert(field_name); - } + // The field should be printed in the json. (Most usually should.) + for (auto& i : t->dv_entries) + { + // Check each telegram dv entry. + DVEntry *dve = &i.second.second; + // Has the entry been matches to this field, then print it as json. + if (dve->hasFieldInfo(&fi)) + { + assert(founds[&fi].count(dve) == 0); + + founds[&fi].insert(dve); + string field_name = fi.generateFieldNameNoUnit(dve); + found_vnames.insert(field_name); } } } for (FieldInfo& fi : field_infos_) { - if (fi.printProperties().hasJSON() && !fi.printProperties().hasHIDE()) + if (fi.printProperties().hasHIDE()) continue; + + if (founds.count(&fi) != 0) { - if (founds.count(&fi) != 0) + // This field info has matched against some dventries. + for (DVEntry *dve : founds[&fi]) { - // This field info has matched against some dventries. - for (DVEntry *dve : founds[&fi]) - { - debug("(meters) render field %s(%s %s)[%d] with dventry @%d key %s data %s\n", - fi.vname().c_str(), toString(fi.xuantity()), unitToStringLowerCase(fi.displayUnit()).c_str(), fi.index(), - dve->offset, - dve->dif_vif_key.str().c_str(), - dve->value.c_str()); - string out = fi.renderJson(this, dve); - debug("(meters) %s\n", out.c_str()); - s += indent+out+","+newline; - } + debug("(meters) render field %s(%s %s)[%d] with dventry @%d key %s data %s\n", + fi.vname().c_str(), toString(fi.xuantity()), unitToStringLowerCase(fi.displayUnit()).c_str(), fi.index(), + dve->offset, + dve->dif_vif_key.str().c_str(), + dve->value.c_str()); + string out = fi.renderJson(this, dve); + debug("(meters) %s\n", out.c_str()); + s += indent+out+","+newline; } - else + } + else + { + // Ok, no value found in received telegram. + // Print field anyway if it is required, + // or if a value has been received before and this field has not been received using a different rule. + // Why this complicated rule? + // E.g. the minmoess mbus seems to use storage 1 for target_m3 but the wmbus version uses storage 8. + // I.e. we have two rules that store into target_m3, this check will prevent target_m3 from being printed twice. + if (fi.printProperties().hasREQUIRED() || (found_vnames.count(fi.vname()) == 0 && hasValue(&fi))) { - // Ok, no value found in received telegram. - // Print field anyway, if it is not OPTIONAL - // or if a value has been received before and this field has not been received using a different rule. - // Why this complicated rule? - // E.g. the minmoess mbus seems to use storage 1 for target_m3 but the wmbus version uses storage 8. - // I.e. we have two rules that store into target_m3, this check will prevent target_m3 from being printed twice. - if (!fi.printProperties().hasOPTIONAL() || (found_vnames.count(fi.vname()) == 0 && hasValue(&fi))) - { - // No telegram entries found, but this field should be printed anyway. - // It will be printed with any value received from a previous telegram. - // Or if no value has been received, null. - debug("(meters) render field %s(%s)[%d] without dventry\n", - fi.vname().c_str(), toString(fi.xuantity()), fi.index()); - string out = fi.renderJson(this, NULL); - debug("(meters) %s\n", out.c_str()); - s += indent+out+","+newline; - } + // No telegram entries found, but this field should be printed anyway. + // It will be printed with any value received from a previous telegram. + // Or if no value has been received, null. + debug("(meters) render field %s(%s)[%d] without dventry\n", + fi.vname().c_str(), toString(fi.xuantity()), fi.index()); + string out = fi.renderJson(this, NULL); + debug("(meters) %s\n", out.c_str()); + s += indent+out+","+newline; } } } @@ -1888,21 +1839,20 @@ void MeterCommonImplementation::printMeter(Telegram *t, for (FieldInfo& fi : field_infos_) { - if (fi.printProperties().hasJSON() && !fi.printProperties().hasHIDE()) + if (fi.printProperties().hasHIDE()) continue; + + string display_unit_s = unitToStringUpperCase(fi.displayUnit()); + string var = fi.vname(); + std::transform(var.begin(), var.end(), var.begin(), ::toupper); + if (fi.xuantity() == Quantity::Text) { - string display_unit_s = unitToStringUpperCase(fi.displayUnit()); - string var = fi.vname(); - std::transform(var.begin(), var.end(), var.begin(), ::toupper); - if (fi.xuantity() == Quantity::Text) - { - string envvar = "METER_"+var+"="+getStringValue(&fi); - envs->push_back(envvar); - } - else - { - string envvar = "METER_"+var+"_"+display_unit_s+"="+valueToString(getNumericValue(&fi, fi.displayUnit()), fi.displayUnit()); - envs->push_back(envvar); - } + string envvar = "METER_"+var+"="+getStringValue(&fi); + envs->push_back(envvar); + } + else + { + string envvar = "METER_"+var+"_"+display_unit_s+"="+valueToString(getNumericValue(&fi, fi.displayUnit()), fi.displayUnit()); + envs->push_back(envvar); } } @@ -2380,7 +2330,7 @@ bool FieldInfo::extractString(Meter *m, Telegram *t, DVEntry *dve) if (!hasMatcher()) { // There is no matcher, only use case is to capture JOIN_TPL_STATUS. - if (print_properties_.hasJOINTPLSTATUS()) + if (print_properties_.hasINCLUDETPLSTATUS()) { string status = add_tpl_status("OK", m, t); m->setStringValue(this, status); @@ -2400,7 +2350,7 @@ bool FieldInfo::extractString(Meter *m, Telegram *t, DVEntry *dve) // No entry was found. if (!ok) { // Nothing found, however check if capturing JOIN_TPL_STATUS. - if (print_properties_.hasJOINTPLSTATUS()) + if (print_properties_.hasINCLUDETPLSTATUS()) { string status = add_tpl_status("OK", m, t); m->setStringValue(this, status); @@ -2414,7 +2364,7 @@ bool FieldInfo::extractString(Meter *m, Telegram *t, DVEntry *dve) if (t->dv_entries.count(key) == 0) { // Nothing found, however check if capturing JOIN_TPL_STATUS. - if (print_properties_.hasJOINTPLSTATUS()) + if (print_properties_.hasINCLUDETPLSTATUS()) { string status = add_tpl_status("OK", m, t); m->setStringValue(this, status); @@ -2431,7 +2381,7 @@ bool FieldInfo::extractString(Meter *m, Telegram *t, DVEntry *dve) string field_name = generateFieldNameNoUnit(dve); uint64_t extracted_bits {}; - if (lookup_.hasLookups() || (print_properties_.hasJOINTPLSTATUS())) + if (lookup_.hasLookups() || (print_properties_.hasINCLUDETPLSTATUS())) { string translated_bits = ""; // The field has lookups, or the print property JOIN_TPL_STATUS is set, @@ -2442,7 +2392,7 @@ bool FieldInfo::extractString(Meter *m, Telegram *t, DVEntry *dve) found = true; } - if (print_properties_.hasJOINTPLSTATUS()) + if (print_properties_.hasINCLUDETPLSTATUS()) { translated_bits = add_tpl_status(translated_bits, m, t); } @@ -2621,7 +2571,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "fabrication_no", "Fabrication number.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::FabricationNo) @@ -2633,7 +2583,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "enhanced_id", "Enhanced identification number.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::EnhancedIdentification) @@ -2645,7 +2595,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "software_version", "Software version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::SoftwareVersion) @@ -2657,7 +2607,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "model_version", "Meter model version.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ModelVersion) @@ -2669,7 +2619,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "parameter_set", "Parameter set for this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::ParameterSet) @@ -2681,7 +2631,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "customer", "Customer name.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Customer) @@ -2693,7 +2643,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "location", "Meter installed at this customer location.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Location) @@ -2705,7 +2655,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addNumericFieldWithExtractor( "operating_time", "How long the meter has been collecting data.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -2719,7 +2669,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addNumericFieldWithExtractor( "on_time", "How long the meter has been powered up.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -2733,7 +2683,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addNumericFieldWithExtractor( "on_time_at_error", "How long the meter has been in an error state while powered up.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Time, VifScaling::Auto, FieldMatcher::build() @@ -2747,7 +2697,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "meter_date", "Date when the meter sent the telegram.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::Date) @@ -2759,7 +2709,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "meter_date_at_error", "Date when the meter was in error.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::AtError) .set(VIFRange::Date) @@ -2771,7 +2721,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "meter_datetime", "Date and time when the meter sent the telegram.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::Instantaneous) .set(VIFRange::DateTime) @@ -2783,7 +2733,7 @@ void MeterCommonImplementation::addOptionalCommonFields(string field_names) addStringFieldWithExtractor( "meter_datetime_at_error", "Date and time when the meter was in error.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, FieldMatcher::build() .set(MeasurementType::AtError) .set(VIFRange::DateTime) @@ -2802,7 +2752,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "total", "The total media volume consumption recorded by this meter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -2816,7 +2766,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "total_forward", "The total media volume flowing forward.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -2831,7 +2781,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "total_backward", "The total media volume flowing backward.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Volume, VifScaling::Auto, FieldMatcher::build() @@ -2846,7 +2796,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "flow_temperature", "Forward media temperature.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -2860,7 +2810,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "return_temperature", "Return media temperature.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::Auto, FieldMatcher::build() @@ -2874,7 +2824,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "flow_return_temperature_difference", "The difference between flow and return media temperatures.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Temperature, VifScaling::AutoSigned, FieldMatcher::build() @@ -2888,7 +2838,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "volume_flow", "Media volume flow.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Flow, VifScaling::Auto, FieldMatcher::build() @@ -2902,7 +2852,7 @@ void MeterCommonImplementation::addOptionalFlowRelatedFields(string field_names) addNumericFieldWithExtractor( "access", "Meter access counter.", - PrintProperty::JSON | PrintProperty::OPTIONAL, + DEFAULT_PRINT_PROPERTIES, Quantity::Counter, VifScaling::None, FieldMatcher::build() @@ -2921,7 +2871,7 @@ void MeterCommonImplementation::addHCARelatedFields(string field_names) addNumericFieldWithExtractor( "consumption", "The current heat cost allocation for this meter.", - PrintProperty::JSON | PrintProperty::FIELD, + DEFAULT_PRINT_PROPERTIES, Quantity::HCA, VifScaling::Auto, FieldMatcher::build() diff --git a/src/meters.h b/src/meters.h index c98dfcb..7e0410d 100644 --- a/src/meters.h +++ b/src/meters.h @@ -237,37 +237,31 @@ const char* toString(VifScaling s); enum PrintProperty { - JSON = 1, // This field should be printed when using --format=json - FIELD = 2, // This field should be printed when using --format=field - IMPORTANT = 4, // The most important field. - OPTIONAL = 8, // If no data has arrived, then do not include this field in the json output. - REQUIRED = 16, // If no data has arrived, then print this field anyway with NaN or null. - DEPRECATED = 32, // This field is about to be removed or changed in a newer driver, which will have a new name. - STATUS = 64, // This is >the< status field and it should read OK of not error flags are set. - JOIN_TPL_STATUS = 128, // This text field also includes the tpl status decoding. multiple OK:s collapse to a single OK. - JOIN_INTO_STATUS = 256, // This text field is injected into the already defined status field. multiple OK:s collapse. - OFFICIAL = 512, // This field is listed as an official field for the driver. - HIDE = 1024 // This field is only used in calculations, do not print it! + REQUIRED = 1, // If no data has arrived, then print this field anyway with NaN or null. + DEPRECATED = 2, // This field is about to be removed or changed in a newer driver, which will have a new name. + STATUS = 4, // This is >the< status field and it should read OK of not error flags are set. + INCLUDE_TPL_STATUS = 8, // This text field also includes the tpl status decoding. multiple OK:s collapse to a single OK. + INJECT_INTO_STATUS = 16, // This text field is injected into the already defined status field. multiple OK:s collapse. + HIDE = 32 // This field is only used in calculations, do not print it! }; struct PrintProperties { PrintProperties(int x) : props_(x) {} - bool hasJSON() { return props_ & PrintProperty::JSON; } - bool hasHIDE() { return props_ & PrintProperty::HIDE; } - bool hasFIELD() { return props_ & PrintProperty::FIELD; } - bool hasIMPORTANT() { return props_ & PrintProperty::IMPORTANT; } - bool hasOPTIONAL() { return props_ & PrintProperty::OPTIONAL; } + bool hasREQUIRED() { return props_ & PrintProperty::REQUIRED; } bool hasDEPRECATED() { return props_ & PrintProperty::DEPRECATED; } bool hasSTATUS() { return props_ & PrintProperty::STATUS; } - bool hasJOINTPLSTATUS() { return props_ & PrintProperty::JOIN_TPL_STATUS; } - bool hasJOININTOSTATUS() { return props_ & PrintProperty::JOIN_INTO_STATUS; } + bool hasINCLUDETPLSTATUS() { return props_ & PrintProperty::INCLUDE_TPL_STATUS; } + bool hasINJECTINTOSTATUS() { return props_ & PrintProperty::INJECT_INTO_STATUS; } + bool hasHIDE() { return props_ & PrintProperty::HIDE; } private: int props_; }; +#define DEFAULT_PRINT_PROPERTIES 0 + struct FieldInfo { ~FieldInfo(); diff --git a/tests/test_analyze.sh b/tests/test_analyze.sh index 4d0f1a4..c8e942b 100755 --- a/tests/test_analyze.sh +++ b/tests/test_analyze.sh @@ -52,14 +52,6 @@ Using driver : multical21 00/00 "meter":"multical21", "name":"", "id":"76348799", - "status":null, - "total_m3":null, - "target_m3":null, - "current_status":null, - "time_dry":null, - "time_reversed":null, - "time_leaking":null, - "time_bursting":null, "timestamp":"1111-11-11T11:11:11Z" } EOF @@ -97,14 +89,6 @@ Using driver : multical21 00/00 "meter":"multical21", "name":"", "id":"76348799", - "status":null, - "total_m3":null, - "target_m3":null, - "current_status":null, - "time_dry":null, - "time_reversed":null, - "time_leaking":null, - "time_bursting":null, "timestamp":"1111-11-11T11:11:11Z" } EOF