diff --git a/CHANGES b/CHANGES index 9c22cc4..1eb9894 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ +Alexander Streit added support for the Zenner Zelsius C5 ISF heat meter. Thanks Alexander! + Version 1.7.0: 2022-03-28 Added verio451mid heat meter. diff --git a/src/driver_c5isf_t1a1.cc b/src/driver_c5isf_t1a1.cc deleted file mode 100644 index 7115ec8..0000000 --- a/src/driver_c5isf_t1a1.cc +++ /dev/null @@ -1,551 +0,0 @@ -/* - Copyright (C) 2022 Fredrik Öhrström - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include"meters_common_implementation.h" - -struct MeterC5isf_t1a1 : public virtual MeterCommonImplementation -{ -MeterC5isf_t1a1(MeterInfo &mi, DriverInfo &di); - -private: - double total_energy_kwh_ {}; - double total_volume_m3_ {}; - string status_; - double total_energy_last_month_kwh_ {}; - string last_month_date_; - double total_energy_last_month_2_kwh_ {}; - string last_month_2_date_; - double total_energy_last_month_3_kwh_ {}; - string last_month_3_date_; - double total_energy_last_month_4_kwh_ {}; - string last_month_4_date_; - double total_energy_last_month_5_kwh_ {}; - string last_month_5_date_; - double total_energy_last_month_6_kwh_ {}; - string last_month_6_date_; - double total_energy_last_month_7_kwh_ {}; - string last_month_7_date_; - double total_energy_last_month_8_kwh_ {}; - string last_month_8_date_; - double total_energy_last_month_9_kwh_ {}; - string last_month_9_date_; - double total_energy_last_month_10_kwh_ {}; - string last_month_10_date_; - double total_energy_last_month_11_kwh_ {}; - string last_month_11_date_; - double total_energy_last_month_12_kwh_ {}; - string last_month_12_date_; - double total_energy_last_month_13_kwh_ {}; - string last_month_13_date_; - double total_energy_last_month_14_kwh_ {}; - string last_month_14_date_; -}; - -static bool ok = registerDriver([](DriverInfo&di) -{ - di.setName("c5isf_t1a1"); - di.setMeterType(MeterType::HeatMeter); - di.setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV); - di.addLinkMode(LinkMode::T1); - di.addDetection(MANUFACTURER_ZRI, 0x0d, 0x88); - di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new MeterC5isf_t1a1(mi, di)); }); -}); - -MeterC5isf_t1a1::MeterC5isf_t1a1(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) -{ - addFieldWithExtractor( - "total_energy_consumption", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, - "The total heat energy consumption recorded by this meter.", - SET_FUNC(total_energy_kwh_, Unit::KWH), - GET_FUNC(total_energy_kwh_, Unit::KWH)); - - addFieldWithExtractor( - "total_volume", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heating media volume recorded by this meter.", - SET_FUNC(total_volume_m3_, Unit::M3), - GET_FUNC(total_volume_m3_, Unit::M3)); - - addStringFieldWithExtractorAndLookup( - "status", - Quantity::Text, - DifVifKey("02FD17"), - MeasurementType::Unknown, - ValueInformation::Any, - AnyStorageNr, - AnyTariffNr, - IndexNr(1), - PrintProperty::JSON | PrintProperty::FIELD, - "Status and error flags.", - SET_STRING_FUNC(status_), - GET_STRING_FUNC(status_), - { - { - { - "ERROR_FLAGS", - Translate::Type::BitToString, - 0xffff, - "OK", - { - { 0x01, "?" }, - } - }, - }, - }); - - addFieldWithExtractor( - "total_energy_consumption_last_month", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(32), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "last_month_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(32), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_date_), - GET_STRING_FUNC(last_month_date_)); - - addFieldWithExtractor( - "total_energy_consumption_month-2", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(33), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_2_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_2_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-2_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(33), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_2_date_), - GET_STRING_FUNC(last_month_2_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-3", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(34), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_3_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_3_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-3_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(34), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_3_date_), - GET_STRING_FUNC(last_month_3_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-4", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(35), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_4_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_4_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-4_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(35), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_4_date_), - GET_STRING_FUNC(last_month_4_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-5", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(36), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_5_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_5_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-5_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(36), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_5_date_), - GET_STRING_FUNC(last_month_5_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-6", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(37), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_6_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_6_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-6_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(37), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_6_date_), - GET_STRING_FUNC(last_month_6_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-7", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(38), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_7_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_7_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-7_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(38), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_7_date_), - GET_STRING_FUNC(last_month_7_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-8", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(39), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_8_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_8_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-8_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(39), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_8_date_), - GET_STRING_FUNC(last_month_8_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-9", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(40), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_9_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_9_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-9_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(40), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_9_date_), - GET_STRING_FUNC(last_month_9_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-10", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(41), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_10_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_10_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-10_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(41), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_10_date_), - GET_STRING_FUNC(last_month_10_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-11", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(42), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_11_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_11_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-11_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(42), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_11_date_), - GET_STRING_FUNC(last_month_11_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-12", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(43), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_12_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_12_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-12_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(43), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_12_date_), - GET_STRING_FUNC(last_month_12_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-13", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(44), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_13_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_13_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-13_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(44), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_13_date_), - GET_STRING_FUNC(last_month_13_date_)); - - - addFieldWithExtractor( - "total_energy_consumption_month-14", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(45), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_14_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_14_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "month-14_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(45), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_14_date_), - GET_STRING_FUNC(last_month_14_date_)); - - -} - -// Test: Heat c5isf_t1a1 ANYID NOKEY -// telegram=|544496A44554455880D7A320200002F2F04060000000004130000000002FD17240084800106000000008280016C2124C480010600000080C280016CFFFF84810106000000808281016CFFFFC481010600000080C281016CFFFF84820106000000808282016CFFFFC482010600000080C282016CFFFF84830106000000808283016CFFFFC483010600000080C283016CFFFF84840106000000808284016CFFFFC484010600000080C284016CFFFF84850106000000808285016CFFFFC485010600000080C285016CFFFF84860106000000808286016CFFFFC486010600000080C286016CFFFF| -// {"media":"Unknown","meter":"c5isf_t1a1","name":"Heat","id":"58455445","total_energy_consumption_kwh":0,"total_volume_m3":0,"status":"","total_energy_consumption_last_month_kwh":0,"last_month_date":"","total_energy_consumption_month-2_kwh":0,"month-2_date":"","total_energy_consumption_month-3_kwh":0,"month-3_date":"","total_energy_consumption_month-4_kwh":0,"month-4_date":"","total_energy_consumption_month-5_kwh":0,"month-5_date":"","total_energy_consumption_month-6_kwh":0,"month-6_date":"","total_energy_consumption_month-7_kwh":0,"month-7_date":"","total_energy_consumption_month-8_kwh":0,"month-8_date":"","total_energy_consumption_month-9_kwh":0,"month-9_date":"","total_energy_consumption_month-10_kwh":0,"month-10_date":"","total_energy_consumption_month-11_kwh":0,"month-11_date":"","total_energy_consumption_month-12_kwh":0,"month-12_date":"","total_energy_consumption_month-13_kwh":0,"month-13_date":"","total_energy_consumption_month-14_kwh":0,"month-14_date":"","timestamp":"1111-11-11T11:11:11Z"} -// |Heat;58455445;0.000000;;1111-11-11 11:11.11 diff --git a/src/driver_c5isf_t1a2.cc b/src/driver_c5isf_t1a2.cc deleted file mode 100644 index f670466..0000000 --- a/src/driver_c5isf_t1a2.cc +++ /dev/null @@ -1,507 +0,0 @@ -/* - Copyright (C) 2022 Fredrik Öhrström - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include"meters_common_implementation.h" - -struct MeterC5isf_t1a2 : public virtual MeterCommonImplementation -{ -MeterC5isf_t1a2(MeterInfo &mi, DriverInfo &di); - -private: - double total_volume_m3_ {}; - double total_volume_last_month_m3_ {}; - string last_month_date_; - double total_volume_last_month_2_m3_ {}; - string last_month_2_date_; - double total_volume_last_month_3_m3_ {}; - string last_month_3_date_; - double total_volume_last_month_4_m3_ {}; - string last_month_4_date_; - double total_volume_last_month_5_m3_ {}; - string last_month_5_date_; - double total_volume_last_month_6_m3_ {}; - string last_month_6_date_; - double total_volume_last_month_7_m3_ {}; - string last_month_7_date_; - double total_volume_last_month_8_m3_ {}; - string last_month_8_date_; - double total_volume_last_month_9_m3_ {}; - string last_month_9_date_; - double total_volume_last_month_10_m3_ {}; - string last_month_10_date_; - double total_volume_last_month_11_m3_ {}; - string last_month_11_date_; - double total_volume_last_month_12_m3_ {}; - string last_month_12_date_; - double total_volume_last_month_13_m3_ {}; - string last_month_13_date_; - double total_volume_last_month_14_m3_ {}; - string last_month_14_date_; -}; - -static bool ok = registerDriver([](DriverInfo&di) -{ - di.setName("c5isf_t1a2"); - di.setMeterType(MeterType::WaterMeter); - di.setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV); - di.addLinkMode(LinkMode::T1); - di.addDetection(MANUFACTURER_ZRI, 0x07, 0x88); - di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new MeterC5isf_t1a2(mi, di)); }); -}); - -MeterC5isf_t1a2::MeterC5isf_t1a2(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) -{ - addFieldWithExtractor( - "total_volume", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heating media volume recorded by this meter.", - SET_FUNC(total_volume_m3_, Unit::M3), - GET_FUNC(total_volume_m3_, Unit::M3)); - - addFieldWithExtractor( - "total_volume_consumption_last_month", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(32), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total m3 volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "last_month_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(32), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_date_), - GET_STRING_FUNC(last_month_date_)); - - addFieldWithExtractor( - "total_volume_consumption_month-2", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(33), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_2_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_2_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-2_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(33), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_2_date_), - GET_STRING_FUNC(last_month_2_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-3", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(34), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_3_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_3_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-3_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(34), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_3_date_), - GET_STRING_FUNC(last_month_3_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-4", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(35), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_4_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_4_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-4_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(35), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_4_date_), - GET_STRING_FUNC(last_month_4_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-5", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(36), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_5_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_5_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-5_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(36), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_5_date_), - GET_STRING_FUNC(last_month_5_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-6", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(37), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_6_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_6_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-6_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(37), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_6_date_), - GET_STRING_FUNC(last_month_6_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-7", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(38), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_7_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_7_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-7_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(38), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_7_date_), - GET_STRING_FUNC(last_month_7_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-8", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(39), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_8_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_8_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-8_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(39), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_8_date_), - GET_STRING_FUNC(last_month_8_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-9", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(40), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_9_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_9_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-9_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(40), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_9_date_), - GET_STRING_FUNC(last_month_9_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-10", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(41), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_10_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_10_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-10_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(41), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_10_date_), - GET_STRING_FUNC(last_month_10_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-11", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(42), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_11_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_11_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-11_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(42), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_11_date_), - GET_STRING_FUNC(last_month_11_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-12", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(43), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_12_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_12_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-12_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(43), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_12_date_), - GET_STRING_FUNC(last_month_12_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-13", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(44), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_13_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_13_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-13_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(44), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_13_date_), - GET_STRING_FUNC(last_month_13_date_)); - - - addFieldWithExtractor( - "total_volume_consumption_month-14", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(45), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat volume consumption recorded at end of last month.", - SET_FUNC(total_volume_last_month_14_m3_, Unit::M3), - GET_FUNC(total_volume_last_month_14_m3_, Unit::M3)); - - addStringFieldWithExtractor( - "month-14_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(45), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_14_date_), - GET_STRING_FUNC(last_month_14_date_)); - - -} - -// Test: Heat c5isf_t1a2 ANYID NOKEY -// telegram=|DA44496A5555445588077A320200002F2F04140000000084800114000000008280016C2124C480011400000080C280016CFFFF84810114000000808281016CFFFFC481011400000080C281016CFFFF84820114000000808282016CFFFFC482011400000080C282016CFFFF84830114000000808283016CFFFFC483011400000080C283016CFFFF84840114000000808284016CFFFFC484011400000080C284016CFFFF84850114000000808285016CFFFFC485011400000080C285016CFFFF84860114000000808286016CFFFFC486011400000080C286016CFFFF| -// {"media":"water","meter":"c5isf_t1a2","name":"Heat","id":"55445555","total_volume_m3":0,"total_volume_consumption_last_month_m3":0,"last_month_date":"2017-04-01","total_volume_consumption_month-2_m3":21474836.48,"month-2_date":"2127-15-31","total_volume_consumption_month-3_m3":21474836.48,"month-3_date":"2127-15-31","total_volume_consumption_month-4_m3":21474836.48,"month-4_date":"2127-15-31","total_volume_consumption_month-5_m3":21474836.48,"month-5_date":"2127-15-31","total_volume_consumption_month-6_m3":21474836.48,"month-6_date":"2127-15-31","total_volume_consumption_month-7_m3":21474836.48,"month-7_date":"2127-15-31","total_volume_consumption_month-8_m3":21474836.48,"month-8_date":"2127-15-31","total_volume_consumption_month-9_m3":21474836.48,"month-9_date":"2127-15-31","total_volume_consumption_month-10_m3":21474836.48,"month-10_date":"2127-15-31","total_volume_consumption_month-11_m3":21474836.48,"month-11_date":"2127-15-31","total_volume_consumption_month-12_m3":21474836.48,"month-12_date":"2127-15-31","total_volume_consumption_month-13_m3":21474836.48,"month-13_date":"2127-15-31","total_volume_consumption_month-14_m3":21474836.48,"month-14_date":"2127-15-31","timestamp":"1111-11-11T11:11:11Z"} -// |Heat;55445555;1111-11-11 11:11.11 diff --git a/src/driver_c5isf_t1b.cc b/src/driver_c5isf_t1b.cc deleted file mode 100644 index 2f8de6a..0000000 --- a/src/driver_c5isf_t1b.cc +++ /dev/null @@ -1,246 +0,0 @@ -/* - Copyright (C) 2022 Fredrik Öhrström (gpl-3.0-or-later) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include"meters_common_implementation.h" - -struct MeterC5isf_t1b : public virtual MeterCommonImplementation -{ - MeterC5isf_t1b(MeterInfo &mi, DriverInfo &di); - -private: - double total_energy_kwh_ {}; - double total_volume_m3_ {}; - double due_energy_kwh_ {}; - string due_date_; - double volume_flow_m3h_ {}; - double power_kw_ {}; - double total_energy_last_month_kwh_ {}; - string last_month_date_; - double max_power_last_month_kw_ {}; - double flow_temperature_c_ {}; - double return_temperature_c_ {}; - string status_; -}; - -static bool ok = registerDriver([](DriverInfo&di) -{ - di.setName("c5isf_t1b"); - di.setMeterType(MeterType::HeatMeter); - di.setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV); - di.addLinkMode(LinkMode::T1); - di.addDetection(MANUFACTURER_ZRI, 0x04, 0x88); - di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr(new MeterC5isf_t1b(mi, di)); }); -}); - -MeterC5isf_t1b::MeterC5isf_t1b(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) -{ - addFieldWithExtractor( - "total_energy_consumption", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT, - "The total heat energy consumption recorded by this meter.", - SET_FUNC(total_energy_kwh_, Unit::KWH), - GET_FUNC(total_energy_kwh_, Unit::KWH)); - - addFieldWithExtractor( - "total_volume", - Quantity::Volume, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::Volume, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heating media volume recorded by this meter.", - SET_FUNC(total_volume_m3_, Unit::M3), - GET_FUNC(total_volume_m3_, Unit::M3)); - - addFieldWithExtractor( - "due_energy_consumption", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(8), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption at the due date.", - SET_FUNC(due_energy_kwh_, Unit::KWH), - GET_FUNC(due_energy_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "due_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(8), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(due_date_), - GET_STRING_FUNC(due_date_)); - - addFieldWithExtractor( - "volume_flow", - Quantity::Flow, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::VolumeFlow, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The current heat media volume flow.", - SET_FUNC(volume_flow_m3h_, Unit::M3H), - GET_FUNC(volume_flow_m3h_, Unit::M3H)); - - addFieldWithExtractor( - "power", - Quantity::Power, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::PowerW, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON | PrintProperty::FIELD, - "The current power consumption.", - SET_FUNC(power_kw_, Unit::KW), - GET_FUNC(power_kw_, Unit::KW)); - - addFieldWithExtractor( - "total_energy_consumption_last_month", - Quantity::Energy, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::EnergyWh, - StorageNr(32), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The total heat energy consumption recorded at end of last month.", - SET_FUNC(total_energy_last_month_kwh_, Unit::KWH), - GET_FUNC(total_energy_last_month_kwh_, Unit::KWH)); - - addStringFieldWithExtractor( - "last_month_date", - Quantity::Text, - NoDifVifKey, - MeasurementType::Instantaneous, - ValueInformation::Date, - StorageNr(32), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The due date.", - SET_STRING_FUNC(last_month_date_), - GET_STRING_FUNC(last_month_date_)); - - addFieldWithExtractor( - "max_power_last_month", - Quantity::Power, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Maximum, - ValueInformation::PowerW, - StorageNr(32), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "Maximum power consumption last month.", - SET_FUNC(max_power_last_month_kw_, Unit::KW), - GET_FUNC(max_power_last_month_kw_, Unit::KW)); - - addFieldWithExtractor( - "flow_temperature", - Quantity::Temperature, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::FlowTemperature, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON, - "The current forward heat media temperature.", - SET_FUNC(flow_temperature_c_, Unit::C), - GET_FUNC(flow_temperature_c_, Unit::C)); - - addFieldWithExtractor( - "return_temperature", - Quantity::Temperature, - NoDifVifKey, - VifScaling::Auto, - MeasurementType::Instantaneous, - ValueInformation::ReturnTemperature, - StorageNr(0), - TariffNr(0), - IndexNr(1), - PrintProperty::JSON | PrintProperty::FIELD, - "The current return heat media temperature.", - SET_FUNC(return_temperature_c_, Unit::C), - GET_FUNC(return_temperature_c_, Unit::C)); - - addStringFieldWithExtractorAndLookup( - "status", - Quantity::Text, - DifVifKey("02FD17"), - MeasurementType::Unknown, - ValueInformation::Any, - AnyStorageNr, - AnyTariffNr, - IndexNr(1), - PrintProperty::JSON | PrintProperty::FIELD, - "Status and error flags.", - SET_STRING_FUNC(status_), - GET_STRING_FUNC(status_), - { - { - { - "ERROR_FLAGS", - Translate::Type::BitToString, - 0xffff, - "OK", - { - { 0x01, "?" }, - } - }, - }, - }); - -} - -// Test: Heat c5isf_t1b ANYID NOKEY -// telegram=|5E44496A4420003288047A0A0050052F2F#04061A0000000413C20800008404060000000082046CC121043BA4000000042D1900000002591216025DE21002FD17000084800106000000008280016CC121948001AE25000000002F2F2F2F2F2F| -// {"media":"heat","meter":"c5isf_t1b","name":"Heat","id":"32002044","total_energy_consumption_kwh":26,"total_volume_m3":2.242,"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,"last_month_date":"2022-01-01","max_power_last_month_kw":0,"flow_temperature_c":56.5,"return_temperature_c":43.22,"status":"OK","timestamp":"1111-11-11T11:11:11Z"} -// |Heat;32002044;26.000000;2.500000;43.220000;OK;1111-11-11 11:11.11 diff --git a/src/driver_lansendw.cc b/src/driver_lansendw.cc index 757076e..2f2fa03 100644 --- a/src/driver_lansendw.cc +++ b/src/driver_lansendw.cc @@ -56,23 +56,23 @@ MeterLansenDW::MeterLansenDW(MeterInfo &mi, DriverInfo &di) : addPrint("status", Quantity::Text, [&](){ return status(); }, "The current status: OPEN or CLOSED.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); /* addPrint("statuss", Quantity::Text, [&](){ return status(); }, "The current status: OPEN or CLOSED.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); */ addPrint("counter_a", Quantity::Counter, [&](Unit u) { assertQuantity(u, Quantity::Counter); return pulse_counter_a_; }, "How many times the door/window has been opened or closed.", - false, true); + PrintProperty::JSON); addPrint("counter_b", Quantity::Counter, [&](Unit u) { assertQuantity(u, Quantity::Counter); return pulse_counter_b_; }, "The current number of counted pulses from counter b.", - false, true); + PrintProperty::JSON); } diff --git a/src/meter_apator162.cc b/src/meter_apator162.cc index 1dd5b57..4641958 100644 --- a/src/meter_apator162.cc +++ b/src/meter_apator162.cc @@ -60,7 +60,7 @@ MeterApator162::MeterApator162(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } void MeterApator162::processExtras(string miExtras) diff --git a/src/meter_bfw240radio.cc b/src/meter_bfw240radio.cc index 201a7a9..f174b02 100644 --- a/src/meter_bfw240radio.cc +++ b/src/meter_bfw240radio.cc @@ -66,33 +66,33 @@ MeterBFW240RADIO::MeterBFW240RADIO(MeterInfo &mi) : addPrint("current", Quantity::HCA, [&](Unit u){ return currentPeriodEnergyConsumption(u); }, "Energy consumption so far in this billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); /* addPrint("current_date", Quantity::Text, [&](){ return currentPeriodDate(); }, "Date of current billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); */ addPrint("previous", Quantity::HCA, [&](Unit u){ return previousPeriodEnergyConsumption(u); }, "Energy consumption in previous billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); /* addPrint("previous_date", Quantity::Text, [&](){ return previousPeriodDate(); }, "Date of last billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("temp_room", Quantity::Temperature, [&](Unit u){ return currentRoomTemperature(u); }, "Current room temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("temp_radiator", Quantity::Temperature, [&](Unit u){ return currentRadiatorTemperature(u); }, "Current radiator temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); */ } diff --git a/src/meter_cma12w.cc b/src/meter_cma12w.cc index 33a5f59..ef27c75 100644 --- a/src/meter_cma12w.cc +++ b/src/meter_cma12w.cc @@ -47,12 +47,12 @@ MeterCMa12w::MeterCMa12w(MeterInfo &mi) : addPrint("current_temperature", Quantity::Temperature, [&](Unit u){ return currentTemperature(u); }, "The current temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("average_temperature_1h", Quantity::Temperature, [&](Unit u){ return convert(average_temperature_1h_c_, Unit::C, u); }, "The average temperature over the last hour.", - false, true); + PrintProperty::JSON); } shared_ptr createCMa12w(MeterInfo &mi) diff --git a/src/meter_compact5.cc b/src/meter_compact5.cc index 2230227..b43d3f4 100644 --- a/src/meter_compact5.cc +++ b/src/meter_compact5.cc @@ -59,17 +59,17 @@ MeterCompact5::MeterCompact5(MeterInfo &mi) : addPrint("total", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current", Quantity::Energy, [&](Unit u){ return currentPeriodEnergyConsumption(u); }, "Energy consumption so far in this billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("previous", Quantity::Energy, [&](Unit u){ return previousPeriodEnergyConsumption(u); }, "Energy consumption in previous billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } double MeterCompact5::totalEnergyConsumption(Unit u) diff --git a/src/meter_dme_07.cc b/src/meter_dme_07.cc index e489ebc..a536a75 100644 --- a/src/meter_dme_07.cc +++ b/src/meter_dme_07.cc @@ -56,12 +56,12 @@ MeterDME_07::MeterDME_07(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } void MeterDME_07::processContent(Telegram *t) diff --git a/src/meter_ebzwmbe.cc b/src/meter_ebzwmbe.cc index bd9e00b..7c7fa9d 100644 --- a/src/meter_ebzwmbe.cc +++ b/src/meter_ebzwmbe.cc @@ -59,32 +59,32 @@ MeterEBZWMBE::MeterEBZWMBE(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption", Quantity::Power, [&](Unit u){ return currentPowerConsumption(u); }, "Current power consumption.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption_phase1", Quantity::Power, [&](Unit u){ return currentPowerConsumptionPhase1(u); }, "Current power consumption phase 1.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption_phase2", Quantity::Power, [&](Unit u){ return currentPowerConsumptionPhase2(u); }, "Current power consumption phase 2.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption_phase3", Quantity::Power, [&](Unit u){ return currentPowerConsumptionPhase3(u); }, "Current power consumption phase 3.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("customer", Quantity::Text, [&](){ return customer_; }, "Customer name.", - false, true); + PrintProperty::JSON); } shared_ptr createEBZWMBE(MeterInfo &mi) diff --git a/src/meter_ehzp.cc b/src/meter_ehzp.cc index 9359b7e..e88dd83 100644 --- a/src/meter_ehzp.cc +++ b/src/meter_ehzp.cc @@ -54,23 +54,23 @@ MeterEHZP::MeterEHZP(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption", Quantity::Power, [&](Unit u){ return currentPowerConsumption(u); }, "Current power consumption.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_energy_production", Quantity::Energy, [&](Unit u){ return totalEnergyProduction(u); }, "The total energy production recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("on_time", Quantity::Time, [&](Unit u){ assertQuantity(u, Quantity::Time); return convert(on_time_h_, Unit::Hour, u); }, "Device on time.", - false, true); + PrintProperty::JSON); } shared_ptr createEHZP(MeterInfo &mi) diff --git a/src/meter_ei6500.cc b/src/meter_ei6500.cc index 4d1f084..ada5202 100644 --- a/src/meter_ei6500.cc +++ b/src/meter_ei6500.cc @@ -87,43 +87,43 @@ MeterEI6500::MeterEI6500(MeterInfo &mi) : addPrint("software_version", Quantity::Text, [&](){ return software_version_; }, "Software version.", - false, true); + PrintProperty::JSON); addPrint("message_datetime", Quantity::Text, [&](){ return messageDate(); }, "Date of message.", - false, true); + PrintProperty::JSON); addPrint("last_alarm_date", Quantity::Text, [&](){ return lastAlarmDate(); }, "Date of last alarm.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("smoke_alarm_counter", Quantity::Text, [&](){ return smokeAlarmCounter(); }, "Number of times smoke alarm was triggered.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_remove_duration", Quantity::Text, [&](){ return totalRemoveDuration(); }, "Number of times it was removed.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("last_remove_date", Quantity::Text, [&](){ return lastRemoveDate(); }, "Date of last removal.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("removed_counter", Quantity::Text, [&](){ return removedCounter(); }, "removed counter", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("test_button_last_date", Quantity::Text, [&](){ return testButtonLastDate(); }, "Date of last test button press.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("test_button_counter", Quantity::Text, [&](){ return testButtonCounter(); }, "test button counter", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("status", Quantity::Text, [&](){ return status(); }, "Status of smoke detector.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createEI6500(MeterInfo &mi) diff --git a/src/meter_elf.cc b/src/meter_elf.cc index 4f5e7d0..3c2ba33 100644 --- a/src/meter_elf.cc +++ b/src/meter_elf.cc @@ -61,62 +61,62 @@ MeterElf::MeterElf(MeterInfo &mi) : addPrint("meter_date", Quantity::Text, [&](){ return meter_date_; }, "Date when measurement was recorded.", - false, true); + PrintProperty::JSON); addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption", Quantity::Power, [&](Unit u){ return currentPowerConsumption(u); }, "Current power consumption.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_volume", Quantity::Volume, [&](Unit u){ return totalVolume(u); }, "Total volume of heat media.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_energy_consumption_at_date", Quantity::Energy, [&](Unit u){ return targetEnergyConsumption(u); }, "The total energy consumption recorded at the target date.", - false, true); + PrintProperty::JSON); addPrint("flow_temperature", Quantity::Temperature, [&](Unit u){ assertQuantity(u, Quantity::Temperature); return convert(flow_temperature_c_, Unit::C, u); }, "The water temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("return_temperature", Quantity::Temperature, [&](Unit u){ assertQuantity(u, Quantity::Temperature); return convert(return_temperature_c_, Unit::C, u); }, "The return temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("external_temperature", Quantity::Temperature, [&](Unit u){ assertQuantity(u, Quantity::Temperature); return convert(external_temperature_c_, Unit::C, u); }, "The external temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("operating_time", Quantity::Time, [&](Unit u){ assertQuantity(u, Quantity::Time); return convert(operating_time_days_, Unit::Day, u); }, "Operating time.", - false, true); + PrintProperty::JSON); addPrint("version", Quantity::Text, [&](){ return version_; }, "Version number.", - false, true); + PrintProperty::JSON); addPrint("battery", Quantity::Voltage, [&](Unit u){ assertQuantity(u, Quantity::Voltage); return convert(battery_v_, Unit::Volt, u); }, "Battery voltage. Not yet implemented.", - false, true); + PrintProperty::JSON); } diff --git a/src/meter_em24.cc b/src/meter_em24.cc index 4c402f6..4b9213e 100644 --- a/src/meter_em24.cc +++ b/src/meter_em24.cc @@ -81,37 +81,37 @@ MeterEM24::MeterEM24(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_energy_production", Quantity::Energy, [&](Unit u){ return totalEnergyProduction(u); }, "The total energy production recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_reactive_energy_consumption", Quantity::Reactive_Energy, [&](Unit u){ return totalReactiveEnergyConsumption(u); }, "The total reactive energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_reactive_energy_production", Quantity::Reactive_Energy, [&](Unit u){ return totalReactiveEnergyProduction(u); }, "The total reactive energy production recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_apparent_energy_consumption", Quantity::Apparent_Energy, [&](Unit u){ return totalApparentEnergyConsumption(u); }, "The total apparent energy consumption by calculation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_apparent_energy_production", Quantity::Apparent_Energy, [&](Unit u){ return totalApparentEnergyProduction(u); }, "The total apparent energy production by calculation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("errors", Quantity::Text, [&](){ return status(); }, "Any errors currently being reported.", - false, true); + PrintProperty::JSON); } double MeterEM24::totalEnergyConsumption(Unit u) diff --git a/src/meter_emerlin868.cc b/src/meter_emerlin868.cc index 42cdc39..91f7d4e 100644 --- a/src/meter_emerlin868.cc +++ b/src/meter_emerlin868.cc @@ -55,12 +55,12 @@ MeterEMerlin868::MeterEMerlin868(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The target water consumption recorded at previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createEMerlin868(MeterInfo &mi) diff --git a/src/meter_esyswm.cc b/src/meter_esyswm.cc index 944e304..4c99f89 100644 --- a/src/meter_esyswm.cc +++ b/src/meter_esyswm.cc @@ -75,62 +75,62 @@ MeterESYSWM::MeterESYSWM(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption", Quantity::Power, [&](Unit u){ return currentPowerConsumption(u); }, "Current power consumption.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_energy_production", Quantity::Energy, [&](Unit u){ return totalEnergyProduction(u); }, "The total energy production recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_energy_consumption_tariff1", Quantity::Energy, [&](Unit u){ return totalEnergyConsumptionTariff1(u); }, "The total energy consumption recorded by this meter on tariff 1.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_energy_consumption_tariff2", Quantity::Energy, [&](Unit u){ return totalEnergyConsumptionTariff2(u); }, "The total energy consumption recorded by this meter on tariff 2.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption_phase1", Quantity::Power, [&](Unit u){ return currentPowerConsumptionPhase1(u); }, "Current power consumption phase 1.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption_phase2", Quantity::Power, [&](Unit u){ return currentPowerConsumptionPhase2(u); }, "Current power consumption phase 2.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption_phase3", Quantity::Power, [&](Unit u){ return currentPowerConsumptionPhase3(u); }, "Current power consumption phase 3.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("enhanced_id", Quantity::Text, [&](){ return enhanced_id_; }, "Static enhanced id information.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("version", Quantity::Text, [&](){ return version_; }, "Static version information.", - false, true); + PrintProperty::JSON); addPrint("location_hex", Quantity::Text, [&](){ return location_hex_; }, "Static location information.", - false, true); + PrintProperty::JSON); addPrint("fabrication_no", Quantity::Text, [&](){ return fabrication_no_; }, "Static fabrication no information.", - false, true); + PrintProperty::JSON); } shared_ptr createESYSWM(MeterInfo &mi) diff --git a/src/meter_eurisii.cc b/src/meter_eurisii.cc index 40a80f3..6151f86 100644 --- a/src/meter_eurisii.cc +++ b/src/meter_eurisii.cc @@ -53,17 +53,17 @@ MeterEurisII::MeterEurisII(MeterInfo &mi) : addPrint("current_consumption", Quantity::HCA, [&](Unit u){ return currentConsumption(u); }, "The current heat cost allocation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::HCA, [&](Unit u){ return consumption_at_set_date_hca_[0]; }, "Heat cost allocation at the most recent billing period date.", - false, true); + PrintProperty::JSON); for (int i=1; i<=17; ++i) { @@ -73,13 +73,13 @@ MeterEurisII::MeterEurisII(MeterInfo &mi) : addPrint(msg, Quantity::HCA, [this,i](Unit u){ return consumption_at_set_date_hca_[i-1]; }, info, - false, true); + PrintProperty::JSON); } addPrint("error_flags", Quantity::Text, [&](){ return errorFlagsHumanReadable(); }, "Error flags.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createEurisII(MeterInfo &mi) diff --git a/src/meter_ev200.cc b/src/meter_ev200.cc index f8f83e8..ad380f7 100644 --- a/src/meter_ev200.cc +++ b/src/meter_ev200.cc @@ -55,12 +55,12 @@ MeterEV200::MeterEV200(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The target water consumption recorded at previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createEV200(MeterInfo &mi) diff --git a/src/meter_evo868.cc b/src/meter_evo868.cc index baa8d27..bc39db3 100644 --- a/src/meter_evo868.cc +++ b/src/meter_evo868.cc @@ -70,52 +70,52 @@ MeterEvo868::MeterEvo868(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("fabrication_no", Quantity::Text, [&](){ return fabrication_no_; }, "Fabrication number.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::Volume, [&](Unit u){ assertQuantity(u, Quantity::Volume); return convert(consumption_at_set_date_m3_, Unit::M3, u); }, "The total water consumption at the most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return set_date_; }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date_2", Quantity::Volume, [&](Unit u){ assertQuantity(u, Quantity::Volume); return convert(consumption_at_set_date_2_m3_, Unit::M3, u); }, "The total water consumption at the second recent billing period date.", - false, true); + PrintProperty::JSON); addPrint("set_date_2", Quantity::Text, [&](){ return set_date_2_; }, "The second recent billing period date.", - false, true); + PrintProperty::JSON); addPrint("max_flow_since_datetime", Quantity::Flow, [&](Unit u){ assertQuantity(u, Quantity::Flow); return convert(max_flow_since_datetime_m3h_, Unit::M3H, u); }, "Maximum water flow since date time.", - false, true); + PrintProperty::JSON); addPrint("max_flow_datetime", Quantity::Text, [&](){ return max_flow_datetime_; }, "The datetime to which maximum flow is measured.", - false, true); + PrintProperty::JSON); for (int i=1; i<=12; ++i) { @@ -125,14 +125,14 @@ MeterEvo868::MeterEvo868(MeterInfo &mi) : addPrint(key, Quantity::Volume, [this,i](Unit u){ assertQuantity(u, Quantity::Volume); return convert(consumption_at_history_date_m3_[i-1], Unit::M3, u); }, epl, - false, true); + PrintProperty::JSON); key = tostrprintf("history_%d_date", i); epl = tostrprintf("The history date %d.", i); addPrint(key, Quantity::Text, [this,i](){ return history_date_[i-1]; }, epl, - false, true); + PrintProperty::JSON); } } diff --git a/src/meter_fhkvdataiii.cc b/src/meter_fhkvdataiii.cc index 69463f0..8e316bb 100644 --- a/src/meter_fhkvdataiii.cc +++ b/src/meter_fhkvdataiii.cc @@ -66,32 +66,32 @@ MeterFHKVDataIII::MeterFHKVDataIII(MeterInfo &mi) : addPrint("current", Quantity::HCA, [&](Unit u){ return currentPeriodEnergyConsumption(u); }, "Energy consumption so far in this billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_date", Quantity::Text, [&](){ return currentPeriodDate(); }, "Date of current billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("previous", Quantity::HCA, [&](Unit u){ return previousPeriodEnergyConsumption(u); }, "Energy consumption in previous billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("previous_date", Quantity::Text, [&](){ return previousPeriodDate(); }, "Date of last billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("temp_room", Quantity::Temperature, [&](Unit u){ return currentRoomTemperature(u); }, "Current room temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("temp_radiator", Quantity::Temperature, [&](Unit u){ return currentRadiatorTemperature(u); }, "Current radiator temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } double MeterFHKVDataIII::currentPeriodEnergyConsumption(Unit u) diff --git a/src/meter_fhkvdataiv.cc b/src/meter_fhkvdataiv.cc index 33150af..7bc1cf3 100644 --- a/src/meter_fhkvdataiv.cc +++ b/src/meter_fhkvdataiv.cc @@ -57,47 +57,47 @@ MeterFHKVDataIV::MeterFHKVDataIV(MeterInfo &mi) : addPrint("current_consumption", Quantity::HCA, [&](Unit u){ return currentConsumption(u); }, "The current heat cost allocation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date_1", Quantity::Text, [&](){ return setDate(); }, "The 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date_1", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("set_date_17", Quantity::Text, [&](){ return set_date_8_; }, "The 8 billing period date.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date_8", Quantity::HCA, [&](Unit u){ return consumption_at_set_date_8_hca_; }, "Heat cost allocation at the 8 billing period date.", - false, true); + PrintProperty::JSON); addPrint("error_date", Quantity::Text, [&](){ return error_date_; }, "Error date.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); } shared_ptr createFHKVDataIV(MeterInfo &mi) diff --git a/src/meter_flowiq2200.cc b/src/meter_flowiq2200.cc index b3d76ba..e88ea8b 100644 --- a/src/meter_flowiq2200.cc +++ b/src/meter_flowiq2200.cc @@ -116,77 +116,77 @@ MeterFlowIQ2200::MeterFlowIQ2200(MeterInfo &mi, string mt) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The total water consumption recorded at the beginning of this month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target_datetime", Quantity::Text, [&](){ return target_datetime_; }, "Timestamp for water consumption recorded at the beginning of this month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_flow", Quantity::Flow, [&](Unit u){ return currentFlow(u); }, "The current flow of water.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("max_flow", Quantity::Flow, [&](Unit u){ return maxFlow(u); }, "The maxium flow recorded during previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("min_flow", Quantity::Flow, [&](Unit u){ return currentFlow(u); }, "The minimum flow recorded during previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("min_flow_temperature", Quantity::Temperature, [&](Unit u){ return minFlowTemperature(u); }, "The minimum water temperature during previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("max_flow_temperature", Quantity::Temperature, [&](Unit u){ return maxFlowTemperature(u); }, "The maximum water temperature during previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("external_temperature", Quantity::Temperature, [&](Unit u){ return externalTemperature(u); }, "The external temperature outside of the meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("", Quantity::Text, [&](){ return statusHumanReadable(); }, "Status of meter.", - true, false); + PrintProperty::FIELD); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - false, true); + PrintProperty::JSON); addPrint("time_dry", Quantity::Text, [&](){ return timeDry(); }, "Amount of time the meter has been dry.", - false, true); + PrintProperty::JSON); addPrint("time_reversed", Quantity::Text, [&](){ return timeReversed(); }, "Amount of time the meter has been reversed.", - false, true); + PrintProperty::JSON); addPrint("time_leaking", Quantity::Text, [&](){ return timeLeaking(); }, "Amount of time the meter has been leaking.", - false, true); + PrintProperty::JSON); addPrint("time_bursting", Quantity::Text, [&](){ return timeBursting(); }, "Amount of time the meter has been bursting.", - false, true); + PrintProperty::JSON); } double MeterFlowIQ2200::totalWaterConsumption(Unit u) diff --git a/src/meter_gransystems_ccx01.cc b/src/meter_gransystems_ccx01.cc index cb8d007..36c6e8b 100644 --- a/src/meter_gransystems_ccx01.cc +++ b/src/meter_gransystems_ccx01.cc @@ -91,47 +91,47 @@ MeterGransystemsCCx01::MeterGransystemsCCx01(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("voltage_at_phase_1", Quantity::Voltage, [&](Unit u){ return convert(voltage_L_[0], Unit::Volt, u); }, "Voltage at phase L1.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("voltage_at_phase_2", Quantity::Voltage, [&](Unit u){ return convert(voltage_L_[1], Unit::Volt, u); }, "Voltage at phase L2.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("voltage_at_phase_3", Quantity::Voltage, [&](Unit u){ return convert(voltage_L_[2], Unit::Volt, u); }, "Voltage at phase L3.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("currrent_at_phase_1", Quantity::Current, [&](Unit u){ return convert(current_L_[0], Unit::Ampere, u); }, "Current at phase L1.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("currrent_at_phase_2", Quantity::Current, [&](Unit u){ return convert(current_L_[1], Unit::Ampere, u); }, "Current at phase L2.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("currrent_at_phase_3", Quantity::Current, [&](Unit u){ return convert(current_L_[2], Unit::Ampere, u); }, "Current at phase L3.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("frequency", Quantity::Frequency, [&](Unit u){ return convert(frequency_, Unit::Hz, u); }, "Frequency.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("status", Quantity::Text, [&](){ return status(); }, "The meter status.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } double MeterGransystemsCCx01::totalEnergyConsumption(Unit u) diff --git a/src/meter_hydrocalm3.cc b/src/meter_hydrocalm3.cc index aea9316..84bca77 100644 --- a/src/meter_hydrocalm3.cc +++ b/src/meter_hydrocalm3.cc @@ -60,47 +60,47 @@ MeterHydrocalM3::MeterHydrocalM3(MeterInfo &mi) : addPrint("total_heating", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(total_heating_energy_kwh_, Unit::KWH, u); }, "The total heating energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_cooling", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(total_cooling_energy_kwh_, Unit::KWH, u); }, "The total cooling energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Date when total energy consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("total_heating", Quantity::Volume, [&](Unit u){ assertQuantity(u, Quantity::Volume); return convert(total_heating_volume_m3_, Unit::M3, u); }, "Total heating volume of media.", - false, true); + PrintProperty::JSON); addPrint("total_cooling", Quantity::Volume, [&](Unit u){ assertQuantity(u, Quantity::Volume); return convert(total_cooling_volume_m3_, Unit::M3, u); }, "Total cooling volume of media.", - false, true); + PrintProperty::JSON); addPrint("c1_volume", Quantity::Volume, [&](Unit u){ assertQuantity(u, Quantity::Volume); return convert(c1_volume_m3_, Unit::M3, u); }, "Supply c1 volume.", - false, true); + PrintProperty::JSON); addPrint("c2_volume", Quantity::Volume, [&](Unit u){ assertQuantity(u, Quantity::Volume); return convert(c2_volume_m3_, Unit::M3, u); }, "Return c2 volume.", - false, true); + PrintProperty::JSON); addPrint("supply_temperature", Quantity::Temperature, [&](Unit u){ return convert(t1_temperature_c_, Unit::C, u); }, "The supply t1 pipe temperature.", - false, true); + PrintProperty::JSON); addPrint("return_temperature", Quantity::Temperature, [&](Unit u){ return convert(t2_temperature_c_, Unit::C, u); }, "The return t2 pipe temperature.", - false, true); + PrintProperty::JSON); } shared_ptr createHydrocalM3(MeterInfo &mi) { diff --git a/src/meter_hydrodigit.cc b/src/meter_hydrodigit.cc index ad132bb..97b878d 100644 --- a/src/meter_hydrodigit.cc +++ b/src/meter_hydrodigit.cc @@ -55,12 +55,12 @@ MeterHydrodigit::MeterHydrodigit(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("meter_datetime", Quantity::Text, [&](){ return meter_datetime_; }, "Meter timestamp for measurement.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } void MeterHydrodigit::processContent(Telegram *t) diff --git a/src/meter_hydrus.cc b/src/meter_hydrus.cc index 1aea7ef..aca200a 100644 --- a/src/meter_hydrus.cc +++ b/src/meter_hydrus.cc @@ -82,77 +82,77 @@ MeterHydrus::MeterHydrus(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_tariff1", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff1(u); }, "The total water consumption recorded by this meter at tariff 1.", - false, true); + PrintProperty::JSON); addPrint("total_tariff2", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff2(u); }, "The total water consumption recorded by this meter at tariff 2.", - false, true); + PrintProperty::JSON); addPrint("max_flow", Quantity::Flow, [&](Unit u){ return maxFlow(u); }, "The maximum flow recorded during previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("flow_temperature", Quantity::Temperature, [&](Unit u){ return flowTemperature(u); }, "The water temperature.", - false, true); + PrintProperty::JSON); addPrint("external_temperature", Quantity::Temperature, [&](Unit u){ return externalTemperature(u); }, "The external temperature.", - false, true); + PrintProperty::JSON); addPrint("current_date", Quantity::Text, [&](){ return current_date_; }, "Current date of measurement.", - false, true); + PrintProperty::JSON); addPrint("total_at_date", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionAtDate(u); }, "The total water consumption recorded at date.", - false, true); + PrintProperty::JSON); addPrint("total_tariff1_at_date", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff1AtDate(u); }, "The total water consumption recorded at tariff 1 at date.", - false, true); + PrintProperty::JSON); addPrint("total_tariff2_at_date", Quantity::Volume, [&](Unit u){ return totalWaterConsumptionTariff2AtDate(u); }, "The total water consumption recorded at tariff 2 at date.", - false, true); + PrintProperty::JSON); addPrint("at_date", Quantity::Text, [&](){ return at_date_; }, "Date when total water consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("actuality_duration", Quantity::Time, Unit::Second, [&](Unit u){ return convert(actuality_duration_s_, Unit::Second, u); }, "Elapsed time between measurement and transmission", - false, true); + PrintProperty::JSON); addPrint("operating_time", Quantity::Time, Unit::Hour, [&](Unit u){ return convert(operating_time_h_, Unit::Hour, u); }, "How long the meter is operating", - false, true); + PrintProperty::JSON); 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", - false, true); + PrintProperty::JSON); addPrint("status", Quantity::Text, [&](){ return status_; }, "The status is OK or some error condition.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createHydrus(MeterInfo &mi) diff --git a/src/meter_izar.cc b/src/meter_izar.cc index e5f7981..32a1b18 100644 --- a/src/meter_izar.cc +++ b/src/meter_izar.cc @@ -91,52 +91,52 @@ MeterIzar::MeterIzar(MeterInfo &mi) : addPrint("prefix", Quantity::Text, [&](){ return prefix; }, "The alphanumeric prefix printed before serial number on device.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("serial_number", Quantity::Text, [&](){ return serialNumber(); }, "The meter serial number.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("last_month_total", Quantity::Volume, [&](Unit u){ return lastMonthTotalWaterConsumption(u); }, "The total water consumption recorded by this meter around end of last month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("last_month_measure_date", Quantity::Text, [&](){ return setH0Date(); }, "The date when the meter recorded the most recent billing value.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); 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", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_alarms", Quantity::Text, [&](){ return currentAlarmsText(); }, "Alarms currently reported by the meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("previous_alarms", Quantity::Text, [&](){ return previousAlarmsText(); }, "Alarms previously reported by the meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); 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.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("manufacture_year", Quantity::Text, [&](){ return to_string(manufacture_year); }, "The year during which the meter was manufactured.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } double MeterIzar::totalWaterConsumption(Unit u) diff --git a/src/meter_izar3.cc b/src/meter_izar3.cc index 84206d1..7aa08c0 100644 --- a/src/meter_izar3.cc +++ b/src/meter_izar3.cc @@ -53,7 +53,7 @@ MeterIzar3::MeterIzar3(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } double MeterIzar3::totalWaterConsumption(Unit u) diff --git a/src/meter_lansenpu.cc b/src/meter_lansenpu.cc index 2a33350..d68d7e1 100644 --- a/src/meter_lansenpu.cc +++ b/src/meter_lansenpu.cc @@ -52,12 +52,12 @@ MeterLansenPU::MeterLansenPU(MeterInfo &mi) : addPrint("counter_a", Quantity::Counter, [&](Unit u) { assertQuantity(u, Quantity::Counter); return counterA(); }, "The current number of counted pulses from counter a.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("counter_b", Quantity::Counter, [&](Unit u) { assertQuantity(u, Quantity::Counter); return counterB(); }, "The current number of counted pulses from counter b.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createLansenPU(MeterInfo &mi) diff --git a/src/meter_lansensm.cc b/src/meter_lansensm.cc index 83d9b3f..920b376 100644 --- a/src/meter_lansensm.cc +++ b/src/meter_lansensm.cc @@ -52,7 +52,7 @@ MeterLansenSM::MeterLansenSM(MeterInfo &mi) : addPrint("status", Quantity::Text, [&](){ return status(); }, "The current status: OK, SMOKE, TEST or 'SMOKE TEST'.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createLansenSM(MeterInfo &mi) diff --git a/src/meter_lansenth.cc b/src/meter_lansenth.cc index 9d89e07..378f40f 100644 --- a/src/meter_lansenth.cc +++ b/src/meter_lansenth.cc @@ -51,32 +51,32 @@ MeterLansenTH::MeterLansenTH(MeterInfo &mi) : addPrint("current_temperature", Quantity::Temperature, [&](Unit u){ return currentTemperature(u); }, "The current temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_relative_humidity", Quantity::RelativeHumidity, [&](Unit u){ return currentRelativeHumidity(); }, "The current relative humidity.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("average_temperature_1h", Quantity::Temperature, [&](Unit u){ return convert(average_temperature_1h_c_, Unit::C, u); }, "The average temperature over the last hour.", - false, true); + PrintProperty::JSON); addPrint("average_relative_humidity_1h", Quantity::RelativeHumidity, [&](Unit u){ return average_relative_humidity_1h_rh_; }, "The average relative humidity over the last hour.", - false, true); + PrintProperty::JSON); addPrint("average_temperature_24h", Quantity::Temperature, [&](Unit u){ return convert(average_temperature_24h_c_, Unit::C, u); }, "The average temperature over the last 24 hours.", - false, true); + PrintProperty::JSON); addPrint("average_relative_humidity_24h", Quantity::RelativeHumidity, [&](Unit u){ return average_relative_humidity_24h_rh_; }, "The average relative humidity over the last 24 hours.", - false, true); + PrintProperty::JSON); } shared_ptr createLansenTH(MeterInfo &mi) diff --git a/src/meter_lse_08.cc b/src/meter_lse_08.cc index 45dbe08..7f73bc3 100644 --- a/src/meter_lse_08.cc +++ b/src/meter_lse_08.cc @@ -51,17 +51,17 @@ MeterLSE_08::MeterLSE_08(MeterInfo &mi) : addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); addPrint("duration_since_readout", Quantity::Time, [&](Unit u) { @@ -69,12 +69,12 @@ MeterLSE_08::MeterLSE_08(MeterInfo &mi) : return convert(duration_since_readout_s_, Unit::Second, u); }, "Device date time.", - false, true); + PrintProperty::JSON); addPrint("software_version", Quantity::Text, [&](){ return software_version_; }, "Software version.", - false, true); + PrintProperty::JSON); } shared_ptr createLSE_08(MeterInfo &mi) diff --git a/src/meter_mkradio3.cc b/src/meter_mkradio3.cc index 8dce456..f9eb841 100644 --- a/src/meter_mkradio3.cc +++ b/src/meter_mkradio3.cc @@ -56,22 +56,22 @@ MKRadio3::MKRadio3(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The total water consumption recorded at the beginning of this month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_date", Quantity::Text, [&](){ return currentDate(); }, "Date of current billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("prev_date", Quantity::Text, [&](){ return previousDate(); }, "Date of previous billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createMKRadio3(MeterInfo &mi) diff --git a/src/meter_mkradio4.cc b/src/meter_mkradio4.cc index ff16268..360d174 100644 --- a/src/meter_mkradio4.cc +++ b/src/meter_mkradio4.cc @@ -52,12 +52,12 @@ MKRadio4::MKRadio4(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The total water consumption recorded at the beginning of this month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createMKRadio4(MeterInfo &mi) diff --git a/src/meter_multical21.cc b/src/meter_multical21.cc index 06de81a..1da88d8 100644 --- a/src/meter_multical21.cc +++ b/src/meter_multical21.cc @@ -99,57 +99,57 @@ MeterMultical21::MeterMultical21(MeterInfo &mi, string mt) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The total water consumption recorded at the beginning of this month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("max_flow", Quantity::Flow, [&](Unit u){ return maxFlow(u); }, "The maxium flow recorded during previous period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("flow_temperature", Quantity::Temperature, [&](Unit u){ return flowTemperature(u); }, "The water temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("external_temperature", Quantity::Temperature, [&](Unit u){ return externalTemperature(u); }, "The external temperature outside of the meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("", Quantity::Text, [&](){ return statusHumanReadable(); }, "Status of meter.", - true, false); + PrintProperty::FIELD); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - false, true); + PrintProperty::JSON); addPrint("time_dry", Quantity::Text, [&](){ return timeDry(); }, "Amount of time the meter has been dry.", - false, true); + PrintProperty::JSON); addPrint("time_reversed", Quantity::Text, [&](){ return timeReversed(); }, "Amount of time the meter has been reversed.", - false, true); + PrintProperty::JSON); addPrint("time_leaking", Quantity::Text, [&](){ return timeLeaking(); }, "Amount of time the meter has been leaking.", - false, true); + PrintProperty::JSON); addPrint("time_bursting", Quantity::Text, [&](){ return timeBursting(); }, "Amount of time the meter has been bursting.", - false, true); + PrintProperty::JSON); } double MeterMultical21::totalWaterConsumption(Unit u) diff --git a/src/meter_multical302.cc b/src/meter_multical302.cc index 903e0a0..b906ca0 100644 --- a/src/meter_multical302.cc +++ b/src/meter_multical302.cc @@ -63,32 +63,32 @@ MeterMultical302::MeterMultical302(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption", Quantity::Power, [&](Unit u){ return currentPowerConsumption(u); }, "Current power consumption.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_volume", Quantity::Volume, [&](Unit u){ return totalVolume(u); }, "Total volume of heat media.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("at_date", Quantity::Text, [&](){ return target_date_; }, "Date when total energy consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("total_energy_consumption_at_date", Quantity::Energy, [&](Unit u){ return targetEnergyConsumption(u); }, "The total energy consumption recorded at the target date.", - false, true); + PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createMultical302(MeterInfo &mi) { diff --git a/src/meter_multical403.cc b/src/meter_multical403.cc index e211b8a..8d8126b 100644 --- a/src/meter_multical403.cc +++ b/src/meter_multical403.cc @@ -72,37 +72,37 @@ MeterMultical403::MeterMultical403(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_volume", Quantity::Volume, [&](Unit u){ return totalVolume(u); }, "Total volume of media.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("volume_flow", Quantity::Flow, [&](Unit u){ return volumeFlow(u); }, "The current flow.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t1_temperature", Quantity::Temperature, [&](Unit u){ return t1Temperature(u); }, "The T1 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t2_temperature", Quantity::Temperature, [&](Unit u){ return t2Temperature(u); }, "The T2 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("at_date", Quantity::Text, [&](){ return target_date_; }, "Date when total energy consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createMultical403(MeterInfo &mi) { diff --git a/src/meter_multical602.cc b/src/meter_multical602.cc index e5225aa..6f9aaf5 100644 --- a/src/meter_multical602.cc +++ b/src/meter_multical602.cc @@ -75,47 +75,47 @@ MeterMultical602::MeterMultical602(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_volume", Quantity::Volume, [&](Unit u){ return totalVolume(u); }, "Total volume of media.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("volume_flow", Quantity::Flow, [&](Unit u){ return volumeFlow(u); }, "The current flow.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t1_temperature", Quantity::Temperature, [&](Unit u){ return t1Temperature(u); }, "The T1 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t2_temperature", Quantity::Temperature, [&](Unit u){ return t2Temperature(u); }, "The T2 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("at_date", Quantity::Text, [&](){ return target_date_; }, "Date when total energy consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("energy_forward", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(energy_forward_kwh_, Unit::KWH, u); }, "Energy forward.", - false, true); + PrintProperty::JSON); addPrint("energy_returned", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(energy_returned_kwh_, Unit::KWH, u); }, "Energy returned.", - false, true); + PrintProperty::JSON); } shared_ptr createMultical602(MeterInfo &mi) { diff --git a/src/meter_multical603.cc b/src/meter_multical603.cc index 75e9610..0649d41 100644 --- a/src/meter_multical603.cc +++ b/src/meter_multical603.cc @@ -75,47 +75,47 @@ MeterMultical603::MeterMultical603(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_volume", Quantity::Volume, [&](Unit u){ return totalVolume(u); }, "Total volume of media.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("volume_flow", Quantity::Flow, [&](Unit u){ return volumeFlow(u); }, "The current flow.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t1_temperature", Quantity::Temperature, [&](Unit u){ return t1Temperature(u); }, "The T1 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t2_temperature", Quantity::Temperature, [&](Unit u){ return t2Temperature(u); }, "The T2 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("at_date", Quantity::Text, [&](){ return target_date_; }, "Date when total energy consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("energy_forward", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(energy_forward_kwh_, Unit::KWH, u); }, "Energy forward.", - false, true); + PrintProperty::JSON); addPrint("energy_returned", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(energy_returned_kwh_, Unit::KWH, u); }, "Energy returned.", - false, true); + PrintProperty::JSON); } shared_ptr createMultical603(MeterInfo &mi) { diff --git a/src/meter_multical803.cc b/src/meter_multical803.cc index d789de1..66a253d 100644 --- a/src/meter_multical803.cc +++ b/src/meter_multical803.cc @@ -74,47 +74,47 @@ MeterMultical803::MeterMultical803(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_volume", Quantity::Volume, [&](Unit u){ return totalVolume(u); }, "Total volume of media.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("volume_flow", Quantity::Flow, [&](Unit u){ return volumeFlow(u); }, "The current flow.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t1_temperature", Quantity::Temperature, [&](Unit u){ return t1Temperature(u); }, "The T1 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("t2_temperature", Quantity::Temperature, [&](Unit u){ return t2Temperature(u); }, "The T2 temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("at_date", Quantity::Text, [&](){ return target_date_; }, "Date when total energy consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("energy_forward", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(energy_forward_mj_, Unit::MJ, u); }, "Energy forward.", - false, true); + PrintProperty::JSON); addPrint("energy_returned", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(energy_returned_mj_, Unit::MJ, u); }, "Energy returned.", - false, true); + PrintProperty::JSON); } shared_ptr createMultical803(MeterInfo &mi) { diff --git a/src/meter_munia.cc b/src/meter_munia.cc index 5e7646b..bfdcc83 100644 --- a/src/meter_munia.cc +++ b/src/meter_munia.cc @@ -47,12 +47,12 @@ MeterMunia::MeterMunia(MeterInfo &mi) : addPrint("current_temperature", Quantity::Temperature, [&](Unit u){ return currentTemperature(u); }, "The current temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_relative_humidity", Quantity::RelativeHumidity, [&](Unit u){ return currentRelativeHumidity(); }, "The current relative humidity.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } diff --git a/src/meter_omnipower.cc b/src/meter_omnipower.cc index 6277744..9b151fc 100644 --- a/src/meter_omnipower.cc +++ b/src/meter_omnipower.cc @@ -83,22 +83,22 @@ MeterOmnipower::MeterOmnipower(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_energy_production", Quantity::Energy, [&](Unit u){ return totalEnergyBackward(u); }, "The total energy backward (production) recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_consumption", Quantity::Power, [&](Unit u){ return powerConsumption(u); }, "The current power consumption on this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_power_production", Quantity::Power, [&](Unit u){ return powerBackward(u); }, "The current power backward on this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } double MeterOmnipower::totalEnergyConsumption(Unit u) diff --git a/src/meter_q400.cc b/src/meter_q400.cc index e1699ef..c88e24b 100644 --- a/src/meter_q400.cc +++ b/src/meter_q400.cc @@ -70,53 +70,52 @@ MeterQ400::MeterQ400(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::Volume, [&](Unit u){ return consumptionAtSetDate(u); }, "The total water consumption at the most recent billing period date.", - false, true); + PrintProperty::JSON); addPrint("meter_datetime", Quantity::Text, [&](){ return meter_datetime_; }, "Meter timestamp for measurement.", - false, true); + PrintProperty::JSON); addPrint("flow", Quantity::Flow, [&](Unit u){ assertQuantity(u, Quantity::Flow); return convert(flow_m3h_, Unit::M3H, u); }, "Water flow?", - false, true); + PrintProperty::JSON); addPrint("forward_flow", Quantity::Flow, [&](Unit u){ assertQuantity(u, Quantity::Flow); return convert(forward_flow_m3h_, Unit::M3H, u); }, "Forward flow.", - false, true); + PrintProperty::JSON); addPrint("backward_flow", Quantity::Flow, [&](Unit u){ assertQuantity(u, Quantity::Flow); return convert(backward_flow_m3h_, Unit::M3H, u); }, "Backward flow.", - false, true); + PrintProperty::JSON); addPrint("flow_temperature", Quantity::Temperature, [&](Unit u){ assertQuantity(u, Quantity::Temperature); return convert(flow_temperature_c_, Unit::C, u); }, "The water temperature.", - false, true); + PrintProperty::JSON); addPrint("set_forward_flow", Quantity::Flow, [&](Unit u){ assertQuantity(u, Quantity::Flow); return convert(set_forward_flow_m3h_, Unit::M3H, u); }, "Historical forward flow.", - false, true); + PrintProperty::JSON); addPrint("set_backward_flow", Quantity::Flow, [&](Unit u){ assertQuantity(u, Quantity::Flow); return convert(set_backward_flow_m3h_, Unit::M3H, u); }, "Historical backward flow.", - false, true); - + PrintProperty::JSON); } void MeterQ400::processContent(Telegram *t) diff --git a/src/meter_qcaloric.cc b/src/meter_qcaloric.cc index e6fca38..f2e9f35 100644 --- a/src/meter_qcaloric.cc +++ b/src/meter_qcaloric.cc @@ -57,47 +57,47 @@ MeterQCaloric::MeterQCaloric(MeterInfo &mi) : addPrint("current_consumption", Quantity::HCA, [&](Unit u){ return currentConsumption(u); }, "The current heat cost allocation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date_1", Quantity::Text, [&](){ return setDate(); }, "The 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date_1", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("set_date_17", Quantity::Text, [&](){ return set_date_17_; }, "The 17 billing period date.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date_17", Quantity::HCA, [&](Unit u){ return consumption_at_set_date_17_hca_; }, "Heat cost allocation at the 17 billing period date.", - false, true); + PrintProperty::JSON); addPrint("error_date", Quantity::Text, [&](){ return error_date_; }, "Error date.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); } shared_ptr createQCaloric(MeterInfo &mi) diff --git a/src/meter_qheat.cc b/src/meter_qheat.cc index 74a24a8..2652f2a 100644 --- a/src/meter_qheat.cc +++ b/src/meter_qheat.cc @@ -60,37 +60,37 @@ MeterQHeat::MeterQHeat(MeterInfo &mi) : addPrint("total_energy_consumption", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("last_month_date", Quantity::Text, [&](){ return last_month_date_; }, "Last day previous month when total energy consumption was recorded.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("last_month_energy_consumption", Quantity::Energy, [&](Unit u){ return targetEnergyConsumption(u); }, "The total energy consumption recorded at the last day of the previous month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("last_year_date", Quantity::Text, [&](){ return last_year_date_; }, "Last day previous year when total energy consumption was recorded.", - false, true); + PrintProperty::JSON); addPrint("last_year_energy_consumption", Quantity::Energy, [&](Unit u){ assertQuantity(u, Quantity::Energy); return convert(last_year_energy_kwh_, Unit::KWH, u); }, "The total energy consumption recorded at the last day of the previous year.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); addPrint("device_error_date", Quantity::Text, [&](){ return device_error_date_; }, "Device error date.", - false, true); + PrintProperty::JSON); } diff --git a/src/meter_qsmoke.cc b/src/meter_qsmoke.cc index a623e8d..0fb2c74 100644 --- a/src/meter_qsmoke.cc +++ b/src/meter_qsmoke.cc @@ -62,17 +62,17 @@ MeterQSmoke::MeterQSmoke(MeterInfo &mi) : addPrint("status", Quantity::Text, [&](){ return status(); }, "The current status: OK, SMOKE or ERROR.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("counter", Quantity::Counter, [&](Unit u){ return counter_; }, "Transmission counter.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); } diff --git a/src/meter_rfmamb.cc b/src/meter_rfmamb.cc index b8666a8..5391464 100644 --- a/src/meter_rfmamb.cc +++ b/src/meter_rfmamb.cc @@ -70,77 +70,77 @@ MeterRfmAmb::MeterRfmAmb(MeterInfo &mi) : addPrint("current_temperature", Quantity::Temperature, [&](Unit u){ return currentTemperature(u); }, "The current temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("average_temperature_1h", Quantity::Temperature, [this](Unit u){ return convert(average_temperature_1h_c_, Unit::C, u); }, "The average temperature for the last hour.", - false, true); + PrintProperty::JSON); addPrint("average_temperature_24h", Quantity::Temperature, [this](Unit u){ return convert(average_temperature_24h_c_, Unit::C, u); }, "The average temperature for the last 24 hours", - false, true); + PrintProperty::JSON); addPrint("maximum_temperature_1h", Quantity::Temperature, [&](Unit u){ return maximumTemperature(u); }, "The maximum temperature.", - false, true); + PrintProperty::JSON); addPrint("minimum_temperature_1h", Quantity::Temperature, [&](Unit u){ return minimumTemperature(u); }, "The minimum temperature.", - false, true); + PrintProperty::JSON); addPrint("maximum_temperature_24h", Quantity::Temperature, [&](Unit u){ return maximumTemperatureAtSetDate1(u); }, "The maximum temperature at set date 1.", - false, true); + PrintProperty::JSON); addPrint("minimum_temperature_24h", Quantity::Temperature, [&](Unit u){ return minimumTemperatureAtSetDate1(u); }, "The minimum temperature at set date 1.", - false, true); + PrintProperty::JSON); addPrint("current_relative_humidity", Quantity::RelativeHumidity, [&](Unit u){ return currentRelativeHumidity(); }, "The current relative humidity.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("average_relative_humidity_1h", Quantity::RelativeHumidity, [this](Unit u){ return convert(average_relative_humidity_1h_rh_, Unit::RH, u); }, "The averate relative humidity for the last hours.", - false, true); + PrintProperty::JSON); addPrint("average_relative_humidity_24h", Quantity::RelativeHumidity, [this](Unit u){ return convert(average_relative_humidity_24h_rh_, Unit::RH, u); }, "The average relative humidity for the last 24 hours.", - false, true); + PrintProperty::JSON); addPrint("minimum_relative_humidity_1h", Quantity::RelativeHumidity, [&](Unit u){ return minimumRelativeHumidity(); }, "The minimum relative humidity.", - false, true); + PrintProperty::JSON); addPrint("maximum_relative_humidity_1h", Quantity::RelativeHumidity, [&](Unit u){ return maximumRelativeHumidity(); }, "The maximum relative humidity.", - false, true); + PrintProperty::JSON); addPrint("maximum_relative_humidity_24h", Quantity::RelativeHumidity, [&](Unit u){ return maximumRelativeHumidityAtSetDate1(); }, "The maximum relative humidity at set date 1.", - false, true); + PrintProperty::JSON); addPrint("minimum_relative_humidity_24h", Quantity::RelativeHumidity, [&](Unit u){ return minimumRelativeHumidityAtSetDate1(); }, "The minimum relative humidity at set date 1.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); } shared_ptr createRfmAmb(MeterInfo &mi) diff --git a/src/meter_rfmtx1.cc b/src/meter_rfmtx1.cc index fe6190b..e6b74df 100644 --- a/src/meter_rfmtx1.cc +++ b/src/meter_rfmtx1.cc @@ -55,12 +55,12 @@ MeterRfmTX1::MeterRfmTX1(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("meter_datetime", Quantity::Text, [&](){ return meter_datetime_; }, "A date.....", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } uchar decode_vectors_[16][6] = { { 117, 150, 122, 16, 26, 10 }, { 91, 127, 112, 19, 34, 19 }, { 179, 24, 185, 11, 142, 153 }, { 142, 125, 121, 7, 74, 22 }, { 181, 145, 7, 154, 203, 105 }, { 184, 163, 50, 161, 57, 14 }, { 189, 128, 156, 126, 96, 153 }, { 39, 92, 180, 196, 128, 163 }, { 48, 208, 10, 206, 25, 3 }, { 194, 76, 240, 5, 165, 134 }, { 84, 75, 22, 152, 17, 94 }, { 75, 238, 12, 201, 125, 162 }, { 135, 202, 74, 72, 228, 31 }, { 196, 135, 119, 46, 138, 232 }, { 227, 48, 189, 120, 87, 140 }, { 164, 154, 57, 111, 40, 5 } }; diff --git a/src/meter_sensostar.cc b/src/meter_sensostar.cc index 5b9e8ac..371844a 100644 --- a/src/meter_sensostar.cc +++ b/src/meter_sensostar.cc @@ -58,22 +58,22 @@ MeterSensostar::MeterSensostar(MeterInfo &mi) : addPrint("meter_timestamp", Quantity::Text, [&](){ return meter_timestamp_; }, "Date time for this reading.", - false, true); + PrintProperty::JSON); addPrint("total", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_water", Quantity::Volume, [&](Unit u){ return totalWater(u); }, "The total amount of water running through meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } void MeterSensostar::processContent(Telegram *t) diff --git a/src/meter_sontex868.cc b/src/meter_sontex868.cc index 5973420..338d24b 100644 --- a/src/meter_sontex868.cc +++ b/src/meter_sontex868.cc @@ -65,42 +65,42 @@ MeterSontex868::MeterSontex868(MeterInfo &mi) : addPrint("current_consumption", Quantity::HCA, [&](Unit u){ return currentConsumption(u); }, "The current heat cost allocation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_temp", Quantity::Temperature, [&](Unit u){ return currentTemp(u); }, "The current temperature of the heating element.", - false, true); + PrintProperty::JSON); addPrint("current_room_temp", Quantity::Temperature, [&](Unit u){ return currentRoomTemp(u); }, "The current room temperature.", - false, true); + PrintProperty::JSON); addPrint("max_temp", Quantity::Temperature, [&](Unit u){ return maxTemp(u); }, "The maximum temperature so far during this billing period.", - false, true); + PrintProperty::JSON); addPrint("max_temp_previous_period", Quantity::Temperature, [&](Unit u){ return maxTempPreviousPeriod(u); }, "The maximum temperature during the previous billing period.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); } shared_ptr createSontex868(MeterInfo &mi) diff --git a/src/meter_topaseskr.cc b/src/meter_topaseskr.cc index 6749e57..b87ff74 100644 --- a/src/meter_topaseskr.cc +++ b/src/meter_topaseskr.cc @@ -86,39 +86,39 @@ MeterTopasEsKr::MeterTopasEsKr(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("temperature", Quantity::Temperature, [&](Unit u){ return flowTemperature(u); }, "Current water temperature recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_flow", Quantity::Flow, [&](Unit u){ return current_flow_m3h_; }, "Current flow.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("battery_life_days_remaining_remaining", Quantity::Text, [&](){ return battery_life_days_remaining_; }, "Battery life [days remaining].", - false, true); + PrintProperty::JSON); addPrint("volume_year_period", Quantity::Volume, [&](Unit u){ return volume_year_period_m3_; }, "Volume up to end of last year-period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("reverse_volume_year_period", Quantity::Volume, [&](Unit u){ return reverse_volume_year_period_m3_; }, "Reverse volume in this year-period (?).", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("meter_year_period_start_date", Quantity::Text, [&](){ return meter_yearly_period_date_; }, "Meter date for year-period start.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("volume_month_period", Quantity::Volume, [&](Unit u){ return volume_month_period_m3_; }, "Volume up to end of last month-period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("meter_month_period_start_datetime", Quantity::Text, [&](){ return meter_month_period_datetime_; }, "Meter timestamp for month-period start.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } diff --git a/src/meter_tsd2.cc b/src/meter_tsd2.cc index c066e67..f265a0a 100644 --- a/src/meter_tsd2.cc +++ b/src/meter_tsd2.cc @@ -54,12 +54,12 @@ MeterTSD2::MeterTSD2(MeterInfo &mi) : addPrint("status", Quantity::Text, [&](){ return status(); }, "The current status: OK, SMOKE or ERROR.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("prev_date", Quantity::Text, [&](){ return previousDate(); }, "Date of previous billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } shared_ptr createTSD2(MeterInfo &mi) diff --git a/src/meter_ultrimis.cc b/src/meter_ultrimis.cc index 86f5b37..29d62aa 100644 --- a/src/meter_ultrimis.cc +++ b/src/meter_ultrimis.cc @@ -61,22 +61,22 @@ MeterUltrimis::MeterUltrimis(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetWaterConsumption(u); }, "The total water consumption recorded at the beginning of this month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status(); }, "Status of meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_backward_flow", Quantity::Volume, [&](Unit u){ return totalBackwardFlow(u); }, "The total water backward flow.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } diff --git a/src/meter_unismart.cc b/src/meter_unismart.cc index 1c15674..4cea728 100644 --- a/src/meter_unismart.cc +++ b/src/meter_unismart.cc @@ -69,57 +69,57 @@ MeterUnismart::MeterUnismart(MeterInfo &mi) : addPrint("fabrication_no", Quantity::Text, [&](){ return fabrication_no_; }, "Static fabrication no information.", - false, true); + PrintProperty::JSON); addPrint("total_date_time", Quantity::Text, [&](){ return total_date_time_; }, "Timestamp for this total measurement.", - false, true); + PrintProperty::JSON); addPrint("total", Quantity::Volume, [&](Unit u){ return totalGasConsumption(u); }, "The total gas consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("target_date_time", Quantity::Text, [&](){ return target_date_time_; }, "Timestamp for gas consumption recorded at the beginning of this month.", - false, true); + PrintProperty::JSON); addPrint("target", Quantity::Volume, [&](Unit u){ return targetGasConsumption(u); }, "The total gas consumption recorded by this meter at the beginning of this month.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("version", Quantity::Text, [&](){ return version_; }, "Model/version a reported by meter.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time? Seems to be the same as total date time.", - false, true); + PrintProperty::JSON); addPrint("suppler_info", Quantity::Text, [&](){ return supplier_info_; }, "?", - false, true); + PrintProperty::JSON); addPrint("status", Quantity::Text, [&](){ return status_; }, "?", - false, true); + PrintProperty::JSON); addPrint("parameter_set", Quantity::Text, [&](){ return parameter_set_; }, "?", - false, true); + PrintProperty::JSON); addPrint("other", Quantity::Counter, [&](Unit u){ return other_; }, "?", - false, true); + PrintProperty::JSON); } diff --git a/src/meter_vario451.cc b/src/meter_vario451.cc index 1b5adc9..dd6c87d 100644 --- a/src/meter_vario451.cc +++ b/src/meter_vario451.cc @@ -59,17 +59,17 @@ MeterVario451::MeterVario451(MeterInfo &mi) : addPrint("total", Quantity::Energy, [&](Unit u){ return totalEnergyConsumption(u); }, "The total energy consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current", Quantity::Energy, [&](Unit u){ return currentPeriodEnergyConsumption(u); }, "Energy consumption so far in this billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("previous", Quantity::Energy, [&](Unit u){ return previousPeriodEnergyConsumption(u); }, "Energy consumption in previous billing period.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } double MeterVario451::totalEnergyConsumption(Unit u) diff --git a/src/meter_waterstarm.cc b/src/meter_waterstarm.cc index 95bddfd..1bc563f 100644 --- a/src/meter_waterstarm.cc +++ b/src/meter_waterstarm.cc @@ -76,32 +76,32 @@ MeterWaterstarM::MeterWaterstarM(MeterInfo &mi) : addPrint("meter_timestamp", Quantity::Text, [&](){ return meter_timestamp_; }, "Date time for this reading.", - false, true); + PrintProperty::JSON); addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("total_backwards", Quantity::Volume, [&](Unit u){ return totalWaterBackwards(u); }, "The total amount of water running backwards through meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("current_status", Quantity::Text, [&](){ return status_; }, "The status is OK or some error condition.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("meter_version", Quantity::Text, [&](){ return meter_version_; }, "Meter version.", - false, true); + PrintProperty::JSON); addPrint("parameter_set", Quantity::Text, [&](){ return parameter_set_; }, "Parameter set.", - false, true); + PrintProperty::JSON); } void MeterWaterstarM::processContent(Telegram *t) diff --git a/src/meter_weh_07.cc b/src/meter_weh_07.cc index 64a6e16..a8b83bb 100644 --- a/src/meter_weh_07.cc +++ b/src/meter_weh_07.cc @@ -54,7 +54,7 @@ MeterWEH_07::MeterWEH_07(MeterInfo &mi) : addPrint("total", Quantity::Volume, [&](Unit u){ return totalWaterConsumption(u); }, "The total water consumption recorded by this meter.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } diff --git a/src/meter_whe46x.cc b/src/meter_whe46x.cc index 6494a0e..6b94085 100644 --- a/src/meter_whe46x.cc +++ b/src/meter_whe46x.cc @@ -61,47 +61,47 @@ MeterWhe46x::MeterWhe46x(MeterInfo &mi) : addPrint("current_consumption", Quantity::HCA, [&](Unit u){ return currentConsumption(u); }, "The current heat cost allocation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date_1", Quantity::Text, [&](){ return setDate(); }, "The 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date_1", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("flow_temperature", Quantity::Temperature, [&](Unit u){ return flowTemperature(u); }, "The water temperature.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("error_date", Quantity::Text, [&](){ return error_date_; }, "Error date.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); addPrint("unknown", Quantity::Text, [&](){ return vendor_data_; }, "Not yet understood information.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); } diff --git a/src/meter_whe5x.cc b/src/meter_whe5x.cc index f1f41b9..9340b9e 100644 --- a/src/meter_whe5x.cc +++ b/src/meter_whe5x.cc @@ -53,37 +53,37 @@ MeterWhe5x::MeterWhe5x(MeterInfo &mi) : addPrint("current_consumption", Quantity::HCA, [&](Unit u){ return currentConsumption(u); }, "The current heat cost allocation.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date", Quantity::Text, [&](){ return setDate(); }, "The most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("consumption_at_set_date", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the most recent billing period date.", - true, true); + PrintProperty::FIELD | PrintProperty::JSON); addPrint("set_date_1", Quantity::Text, [&](){ return setDate(); }, "The 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("consumption_at_set_date_1", Quantity::HCA, [&](Unit u){ return consumptionAtSetDate(u); }, "Heat cost allocation at the 1 billing period date.", - false, true); + PrintProperty::JSON); addPrint("error_date", Quantity::Text, [&](){ return error_date_; }, "Error date.", - false, true); + PrintProperty::JSON); addPrint("device_date_time", Quantity::Text, [&](){ return device_date_time_; }, "Device date time.", - false, true); + PrintProperty::JSON); } shared_ptr createWhe5x(MeterInfo &mi) diff --git a/src/meters.cc b/src/meters.cc index ae57f98..eb46a17 100644 --- a/src/meters.cc +++ b/src/meters.cc @@ -770,7 +770,7 @@ void MeterCommonImplementation::addLinkMode(LinkMode lm) } void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, - function getValueFunc, string help, bool field, bool json) + function getValueFunc, string help, PrintProperties pprops) { string default_unit = unitToStringLowerCase(defaultUnitForQuantity(vquantity)); string field_name = vname+"_"+default_unit; @@ -787,9 +787,7 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, AnyTariffNr, IndexNr(1), help, - field, - json, - false, + pprops, field_name, getValueFunc, NULL, @@ -802,7 +800,7 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, } void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, Unit unit, - function getValueFunc, string help, bool field, bool json) + function getValueFunc, string help, PrintProperties pprops) { string default_unit = unitToStringLowerCase(defaultUnitForQuantity(vquantity)); string field_name = vname+"_"+default_unit; @@ -819,9 +817,7 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, Unit AnyTariffNr, IndexNr(1), help, - field, - json, - false, + pprops, field_name, getValueFunc, NULL, @@ -835,7 +831,7 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, Unit void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, function getValueFunc, - string help, bool field, bool json) + string help, PrintProperties pprops) { prints_.push_back( FieldInfo(vname, @@ -849,9 +845,7 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, AnyTariffNr, IndexNr(1), help, - field, - json, - false, + pprops, vname, NULL, getValueFunc, @@ -873,7 +867,7 @@ void MeterCommonImplementation::addFieldWithExtractor( StorageNr s, TariffNr t, IndexNr i, - int print_properties, + PrintProperties print_properties, string help, function setValueFunc, function getValueFunc) @@ -939,9 +933,7 @@ void MeterCommonImplementation::addFieldWithExtractor( t, i, help, - (print_properties & PrintProperty::FIELD) != 0, - (print_properties & PrintProperty::JSON) != 0, - (print_properties & PrintProperty::IMPORTANT) != 0, + print_properties, field_name, getValueFunc, NULL, @@ -956,7 +948,7 @@ void MeterCommonImplementation::addFieldWithExtractor( void MeterCommonImplementation::addField( string vname, Quantity vquantity, - int print_properties, + PrintProperties print_properties, string help, function setValueFunc, function getValueFunc) @@ -977,9 +969,7 @@ void MeterCommonImplementation::addField( TariffNr(0), 0, help, - (print_properties & PrintProperty::FIELD) != 0, - (print_properties & PrintProperty::JSON) != 0, - (print_properties & PrintProperty::IMPORTANT) != 0, + print_properties, field_name, getValueFunc, NULL, @@ -1000,7 +990,7 @@ void MeterCommonImplementation::addStringFieldWithExtractor( StorageNr s, TariffNr t, IndexNr i, - int print_properties, + PrintProperties print_properties, string help, function setValueFunc, function getValueFunc) @@ -1077,9 +1067,7 @@ void MeterCommonImplementation::addStringFieldWithExtractor( t, i, help, - (print_properties & PrintProperty::FIELD) != 0, - (print_properties & PrintProperty::JSON) != 0, - (print_properties & PrintProperty::IMPORTANT) != 0, + print_properties, field_name, NULL, getValueFunc, @@ -1100,7 +1088,7 @@ void MeterCommonImplementation::addStringFieldWithExtractorAndLookup( StorageNr s, TariffNr t, IndexNr i, - int print_properties, + PrintProperties print_properties, string help, function setValueFunc, function getValueFunc, @@ -1152,9 +1140,7 @@ void MeterCommonImplementation::addStringFieldWithExtractorAndLookup( t, i, help, - (print_properties & PrintProperty::FIELD) != 0, - (print_properties & PrintProperty::JSON) != 0, - (print_properties & PrintProperty::IMPORTANT) != 0, + print_properties, field_name, NULL, getValueFunc, @@ -1430,7 +1416,7 @@ string concatAllFields(Meter *m, Telegram *t, char c, vector &prints, } for (FieldInfo p : prints) { - if (p.field()) + if (p.printProperties().hasFIELD()) { if (p.hasGetValueDouble()) { @@ -1789,7 +1775,7 @@ void MeterCommonImplementation::printMeter(Telegram *t, } for (FieldInfo& p : prints_) { - if (p.json()) + if (p.printProperties().hasJSON()) { s += indent+p.renderJson(&conversions())+","+newline; } @@ -1840,7 +1826,7 @@ void MeterCommonImplementation::printMeter(Telegram *t, for (FieldInfo p : prints_) { - if (p.json()) + if (p.printProperties().hasJSON()) { string default_unit = unitToStringUpperCase(p.defaultUnit()); string var = p.vname(); diff --git a/src/meters.h b/src/meters.h index dedfbff..5c70ea3 100644 --- a/src/meters.h +++ b/src/meters.h @@ -24,11 +24,13 @@ #include"translatebits.h" #include"wmbus.h" +#include #include #include #include #include + #define LIST_OF_METER_TYPES \ X(AutoMeter) \ X(UnknownMeter) \ @@ -280,6 +282,31 @@ enum class VifScaling AutoSigned // Scale and assume the value is signed. }; +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, do include this field in the json output. +}; + +struct PrintProperties +{ + PrintProperties(int x) + { + props_ = x; + assert(x >=0 && x<=16); // No bits outside of possible PrintProperty values. + } + + bool hasJSON() { return props_ & PrintProperty::JSON; } + bool hasFIELD() { return props_ & PrintProperty::FIELD; } + bool hasIMPORTANT() { return props_ & PrintProperty::IMPORTANT; } + bool hasOPTIONAL() { return props_ & PrintProperty::OPTIONAL; } + + private: + int props_; +}; + struct FieldInfo { FieldInfo(string vname, @@ -293,9 +320,7 @@ struct FieldInfo TariffNr tariff_nr, IndexNr index_nr, string help, - bool field, - bool json, - bool important, + PrintProperties print_properties, string field_name, function get_value_double, function get_value_string, @@ -316,9 +341,7 @@ struct FieldInfo tariff_nr_(tariff_nr), index_nr_(index_nr), help_(help), - field_(field), - json_(json), - important_(important), + print_properties_(print_properties), field_name_(field_name), get_value_double_(get_value_double), get_value_string_(get_value_string), @@ -340,9 +363,7 @@ struct FieldInfo TariffNr tariffNr() { return tariff_nr_; } IndexNr indexNr() { return index_nr_; } string help() { return help_; } - bool field() { return field_; } - bool json() { return json_; } - bool important() { return important_; } + PrintProperties printProperties() { return print_properties_; } string fieldName() { return field_name_; } double getValueDouble(Unit u) { if (get_value_double_) return get_value_double_(u); else return -12345678; } @@ -374,9 +395,7 @@ private: TariffNr tariff_nr_; IndexNr index_nr_; string help_; // Helpful information on this meters use of this value. - bool field_; // If true, print in hr/fields output. - bool json_; // If true, print in json and shell env variables. - bool important_; // If true, then print this for --format=hr and in the summary when listening to all. + PrintProperties print_properties_; string field_name_; // Field name for default unit. function get_value_double_; // Callback to fetch the value from the meter. diff --git a/src/meters_common_implementation.h b/src/meters_common_implementation.h index 8968674..977fb7a 100644 --- a/src/meters_common_implementation.h +++ b/src/meters_common_implementation.h @@ -25,13 +25,6 @@ #include #include -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. -}; - struct MeterCommonImplementation : public virtual Meter { int index(); @@ -80,16 +73,27 @@ protected: void addLinkMode(LinkMode lm); // Print with the default unit for this quantity. void addPrint(string vname, Quantity vquantity, - function getValueFunc, string help, bool field, bool json); + function getValueFunc, string help, PrintProperties pprops); // Print with exactly this unit for this quantity. void addPrint(string vname, Quantity vquantity, Unit unit, - function getValueFunc, string help, bool field, bool json); + function getValueFunc, string help, PrintProperties pprops); // Print the dimensionless Text quantity, no unit is needed. void addPrint(string vname, Quantity vquantity, - function getValueFunc, string help, bool field, bool json); + function getValueFunc, string help, PrintProperties pprops); #define SET_FUNC(varname,to_unit) {[=](Unit from_unit, double d){varname = convert(d, from_unit, to_unit);}} #define GET_FUNC(varname,from_unit) {[=](Unit to_unit){return convert(varname, from_unit, to_unit);}} +#define LOOKUP_FIELD(DVKEY) NoDifVifKey,VifScaling::Auto,MeasurementType::Unknown,ValueInformation::Any,AnyStorageNr,AnyTariffNr,IndexNr(1) +#define FIND_FIELD(TYPE,INFO) NoDifVifKey,VifScaling::Auto,TYPE,INFO,StorageNr(0),TariffNr(0),IndexNr(1) +#define FIND_FIELD_S(TYPE,INFO,STORAGE) NoDifVifKey,VifScaling::Auto,TYPE,INFO,STORAGE,TariffNr(0),IndexNr(1) +#define FIND_FIELD_ST(TYPE,INFO,STORAGE,TARIFF) NoDifVifKey,VifScaling::Auto,,TYPE,INFO,STORAGE,TARIFF,IndexNr(1) +#define FIND_FIELD_STI(TYPE,INFO,STORAGE,TARIFF,INDEX) NoDifVifKey,VifScaling::Auto,TYPE,INFO,STORAGE,TARIFF,INDEX + +#define FIND_SFIELD(TYPE,INFO) NoDifVifKey,TYPE,INFO,StorageNr(0),TariffNr(0),IndexNr(1) +#define FIND_SFIELD_S(TYPE,INFO,STORAGE) NoDifVifKey,TYPE,INFO,STORAGE,TariffNr(0),IndexNr(1) +#define FIND_SFIELD_ST(TYPE,INFO,STORAGE,TARIFF) NoDifVifKey,TYPE,INFO,STORAGE,TARIFF,IndexNr(1) +#define FIND_SFIELD_STI(TYPE,INFO,STORAGE,TARIFF,INDEX) NoDifVifKey,TYPE,INFO,STORAGE,TARIFF,INDEX + void addFieldWithExtractor( string vname, // Name of value without unit, eg total @@ -101,7 +105,7 @@ protected: StorageNr s, TariffNr t, IndexNr i, - int print_properties, // Should this be printed by default in fields,json and hr. + PrintProperties print_properties, // Should this be printed by default in fields,json and hr. string help, function setValueFunc, // Use the SET macro above. function getValueFunc); // Use the GET macro above. @@ -109,7 +113,7 @@ protected: void addField( string vname, // Name of value without unit, eg total Quantity vquantity, // Value belongs to this quantity. - int print_properties, // Should this be printed by default in fields,json and hr. + PrintProperties print_properties, // Should this be printed by default in fields,json and hr. string help, function setValueFunc, // Use the SET macro above. function getValueFunc); // Use the GET macro above. @@ -126,7 +130,7 @@ protected: StorageNr s, TariffNr t, IndexNr i, - int print_properties, // Should this be printed by default in fields,json and hr. + PrintProperties print_properties, // Should this be printed by default in fields,json and hr. string help, function setValueFunc, // Use the SET_STRING macro above. function getValueFunc); // Use the GET_STRING macro above. @@ -140,7 +144,7 @@ protected: StorageNr s, TariffNr t, IndexNr i, - int print_properties, // Should this be printed by default in fields,json and hr. + PrintProperties print_properties, // Should this be printed by default in fields,json and hr. string help, function setValueFunc, // Use the SET_STRING macro above. function getValueFunc, // Use the GET_STRING macro above. diff --git a/tests/test_drivers.sh b/tests/test_drivers.sh index 837401d..aa8f44b 100755 --- a/tests/test_drivers.sh +++ b/tests/test_drivers.sh @@ -1,6 +1,7 @@ #!/bin/sh PROG="$1" +DRIVERS="$2" mkdir -p testoutput TEST=testoutput @@ -11,15 +12,17 @@ TESTNAME="Test driver tests" TESTRESULT="ERROR" ALL_DRIVERS=$(cd src; echo driver_*cc) -DRIVERS= -for i in $ALL_DRIVERS -do - if grep -q '// Test:' src/$i - then - DRIVERS="$DRIVERS $i" - fi -done +if [ "$DRIVERS" = "" ] +then + for i in $ALL_DRIVERS + do + if grep -q '// Test:' src/$i + then + DRIVERS="$DRIVERS $i" + fi + done +fi for i in $DRIVERS do