diff --git a/simulations/simulation_mbus.txt b/simulations/simulation_mbus.txt index 73a00a4..98b6426 100644 --- a/simulations/simulation_mbus.txt +++ b/simulations/simulation_mbus.txt @@ -8,7 +8,8 @@ telegram=|6893936808007275404810C514000431270000#04786BF99F00046D040F632B0415E02 # Test ultraheat heat meter sent over mbus. telegram=|68F8F86808007200464470A7320404270000000974040970040C0E082303000C14079519000B2D0500000B3B0808000A5B52000A5F51000A6206004C14061818004C0E490603000C7800464470891071609B102D020100DB102D0201009B103B6009009A105B78009A105F74000C22726701003C22000000007C2200000000426C01018C2006000000008C3006000000008C80100600000000CC200600000000CC300600000000CC801006000000009A115B64009A115F63009B113B5208009B112D020100BC0122000000008C010E490603008C2106000000008C3106000000008C811006000000008C011406181800046D310ACA210F21040010A0C116| -{"media":"heat","meter":"ultraheat","name":"MyUltra","id":"70444600","heat_kwh":8974.444444,"volume_m3":1995.07,"power_kw":0.5,"flow_m3h":0.808,"flow_c":52,"return_c":51,"timestamp":"1111-11-11T11:11:11Z"} +{"media":"heat","meter":"ultraheat","name":"MyUltra","id":"70444600","heat_kwh":8974.444444,"volume_m3":1995.07,"power_kw":0.5,"flow_m3h":0.808,"flow_c":52,"return_c":51,"fabrication_no":"70444600","meter_datetime":"2022-01-10 10:49","status":"OK","timestamp":"1111-11-11T11:11:11Z"} + # Test multical 403 heat meter sent over mbus. diff --git a/src/driver_ultraheat.cc b/src/driver_ultraheat.cc index da79a4b..4678373 100644 --- a/src/driver_ultraheat.cc +++ b/src/driver_ultraheat.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2022 Fredrik Öhrström (gpl-3.0-or-later) + Copyright (C) 2022-2023 Fredrik Öhrström (gpl-3.0-or-later) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,6 +35,8 @@ namespace Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) { + addOptionalCommonFields("meter_datetime,fabrication_no"); + addNumericFieldWithExtractor( "heat", "The total heat energy consumption recorded by this meter.", @@ -100,10 +102,37 @@ namespace .set(MeasurementType::Instantaneous) .set(VIFRange::ReturnTemperature) ); + + addStringFieldWithExtractorAndLookup( + "status", + "Meter status.", + PrintProperty::STATUS | PrintProperty::INCLUDE_TPL_STATUS, + FieldMatcher::build() + .set(VIFRange::ErrorFlags), + Translate::Lookup( + { + { + { + "ERROR_FLAGS", + Translate::Type::BitToString, + AlwaysTrigger, MaskBits(0xffff), + "OK", + { + /* TODO */ + } + }, + }, + })); + } } // Test: MyUltra ultraheat 70444600 NOKEY // telegram=|68F8F86808007200464470A7320404270000000974040970040C0E082303000C14079519000B2D0500000B3B0808000A5B52000A5F51000A6206004C14061818004C0E490603000C7800464470891071609B102D020100DB102D0201009B103B6009009A105B78009A105F74000C22726701003C22000000007C2200000000426C01018C2006000000008C3006000000008C80100600000000CC200600000000CC300600000000CC801006000000009A115B64009A115F63009B113B5208009B112D020100BC0122000000008C010E490603008C2106000000008C3106000000008C811006000000008C011406181800046D310ACA210F21040010A0C116| -// {"media":"heat","meter":"ultraheat","name":"MyUltra","id":"70444600","heat_kwh":8974.444444,"volume_m3":1995.07,"power_kw":0.5,"flow_m3h":0.808,"flow_c":52,"return_c":51,"timestamp":"1111-11-11T11:11:11Z"} +// {"media":"heat","status":"OK","meter":"ultraheat","meter_datetime": "2022-01-10 10:49", "name":"MyUltra","id":"70444600","heat_kwh":8974.444444,"volume_m3":1995.07,"power_kw":0.5,"flow_m3h":0.808,"flow_c":52,"return_c":51,"fabrication_no": "70444600","timestamp":"1111-11-11T11:11:11Z"} // |MyUltra;70444600;8974.444444;1111-11-11 11:11.11 + +// Test: MyUltra2 ultraheat 71635605 NOKEY +// telegram=|3b44a7320556637104047afa2000202f2f0c06774202000c14399956000b2d0200f00b3b3018000a5a51030a5e520302fd170000066d0c080af42500| +// {"flow_c": 35.1,"flow_m3h": 1.83,"heat_kwh": 24277,"id": "71635605","media": "heat","meter": "ultraheat","meter_datetime": "2023-05-20 10:08:12","name": "MyUltra2","power_kw": -0.2,"return_c": 35.2,"status": "UNKNOWN_20","timestamp": "1111-11-11T11:11:11Z","volume_m3": 5699.39} +// |MyUltra2;71635605;24277;1111-11-11 11:11.11