kopia lustrzana https://github.com/weetmuts/wmbusmeters
				
				
				
			Fix waterstarm and hydrocalm3.
							rodzic
							
								
									aa0b492af2
								
							
						
					
					
						commit
						3a775977b1
					
				
							
								
								
									
										6
									
								
								CHANGES
								
								
								
								
							
							
						
						
									
										6
									
								
								CHANGES
								
								
								
								
							|  | @ -1,3 +1,9 @@ | |||
| 
 | ||||
| A bug in the hydrocalm3 driver was found. When total_cooling_kwh | ||||
| and other similar values were used as text fields (not a json fields) | ||||
| they were replaced with dates instead. This was due to a bug in the new | ||||
| code handling Quantity::PointInTime. | ||||
| 
 | ||||
| Version 1.11.0 2022-12-29 | ||||
| 
 | ||||
| Version 1.11.0-RC2 2022-12-29 | ||||
|  |  | |||
|  | @ -193,7 +193,7 @@ telegram=|4644B4097172737405077AA5000610_1115F78184AB0F1D1E200000005904103103208 | |||
| # Test waterstarm | ||||
| 
 | ||||
| telegram=|3944FA122162092002067A3600202567C94D48D00DC47B11213E23383DB51968A705AAFA60C60E263D50CD259D7C9A03FD0C08000002FD0B0011| | ||||
| {"media":"warm water","meter":"waterstarm","name":"Woter","id":"20096221","meter_timestamp":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"OK","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"} | ||||
| {"media":"warm water","meter":"waterstarm","name":"Woter","id":"20096221","meter_datetime":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"OK","status":"OK","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"} | ||||
| |Woter;20096221;0.106;0;OK;1111-11-11 11:11.11 | ||||
| 
 | ||||
| # Test topaseskr water meter | ||||
|  | @ -296,7 +296,7 @@ telegram=|6044B8059430040001037A1D005085E2B670BCF1A5C87E0C1A51DA18924EF984613DA2 | |||
| # Test Hydrocal M3 heat/cooling meter | ||||
| telegram=|8E44B409747372710B0D7A798080052F2F_0C0E59600100046D1D36B9290C13679947000C0E000000000C13590000000C13000000000C13000000000A5A18020A5E11020F823D06003D06003D06003D0600140600620500480400E402001601000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002F2F| | ||||
| {"media":"heat/cooling load","meter":"hydrocalm3","name":"HeatCool","id":"71727374","status": "SABOTAGE_ENCLOSURE","total_heating_kwh":4460.833333,"total_cooling_kwh":0,"device_datetime":"2021-09-25 22:29","total_heating_m3":479.967,"total_cooling_m3":0.059,"c1_volume_m3":0,"c2_volume_m3":0,"supply_temperature_c":21.8,"return_temperature_c":21.1,"timestamp":"1111-11-11T11:11:11Z"} | ||||
| |HeatCool;71727374;4460.833333;2021-09-25 22:29;1111-11-11 11:11.11 | ||||
| |HeatCool;71727374;4460.833333;0;1111-11-11 11:11.11 | ||||
| 
 | ||||
| # Test Weptech Munia temperature hygrometer | ||||
| telegram=|2E44B05C82340100021B7A460000002F2F0A6601020AFB1A570602FD971D00002F2F2F2F2F2F2F2F2F2F2F2F2F2F2F| | ||||
|  |  | |||
|  | @ -161,4 +161,4 @@ namespace | |||
| // Test:HeatCool hydrocalm3 71727374 NOKEY
 | ||||
| // telegram=|8E44B409747372710B0D7A798080052F2F_0C0E59600100046D1D36B9290C13679947000C0E000000000C13590000000C13000000000C13000000000A5A18020A5E11020F823D06003D06003D06003D0600140600620500480400E402001601000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002F2F|
 | ||||
| // {"media":"heat/cooling load","meter":"hydrocalm3","name":"HeatCool","id":"71727374","status": "SABOTAGE_ENCLOSURE","total_heating_kwh":4460.833333,"total_cooling_kwh":0,"device_datetime":"2021-09-25 22:29","total_heating_m3":479.967,"total_cooling_m3":0.059,"c1_volume_m3":0,"c2_volume_m3":0,"supply_temperature_c":21.8,"return_temperature_c":21.1,"timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // |HeatCool;71727374;4460.833333;2021-09-25 22:29;1111-11-11 11:11.11
 | ||||
| // |HeatCool;71727374;4460.833333;0;1111-11-11 11:11.11
 | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ namespace | |||
|     static bool ok = registerDriver([](DriverInfo&di) | ||||
|     { | ||||
|         di.setName("waterstarm"); | ||||
|         di.setDefaultFields("name,id,total_m3,total_backwards_m3,current_status,timestamp"); | ||||
|         di.setDefaultFields("name,id,total_m3,total_backwards_m3,status,timestamp"); | ||||
|         di.setMeterType(MeterType::WaterMeter); | ||||
|         di.addLinkMode(LinkMode::T1); | ||||
|         di.addLinkMode(LinkMode::C1); | ||||
|  | @ -42,8 +42,36 @@ namespace | |||
| 
 | ||||
|     Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) | ||||
|     { | ||||
|         addStringFieldWithExtractorAndLookup( | ||||
|             "status", | ||||
|             "Status and error flags.", | ||||
|             PrintProperty::JSON | PrintProperty::JOIN_TPL_STATUS | PrintProperty::STATUS, | ||||
|             FieldMatcher::build() | ||||
|             .set(VIFRange::ErrorFlags), | ||||
|             { | ||||
|                 { | ||||
|                     { | ||||
|                         "ERROR_FLAGS", | ||||
|                         Translate::Type::BitToString, | ||||
|                         AlwaysTrigger, MaskBits(0xffff), | ||||
|                         "OK", | ||||
|                         { | ||||
|                             { 0x01, "SW_ERROR" }, | ||||
|                             { 0x02, "CRC_ERROR" }, | ||||
|                             { 0x04, "SENSOR_ERROR" }, | ||||
|                             { 0x08, "MEASUREMENT_ERROR" }, | ||||
|                             { 0x10, "BATTERY_VOLTAGE_ERROR" }, | ||||
|                             { 0x20, "MANIPULATION" }, | ||||
|                             { 0x40, "LEAKAGE_OR_NO_USAGE" }, | ||||
|                             { 0x80, "REVERSE_FLOW" }, | ||||
|                             { 0x100, "OVERLOAD" }, | ||||
|                         } | ||||
|                     }, | ||||
|                 }, | ||||
|             }); | ||||
| 
 | ||||
|         addNumericFieldWithExtractor( | ||||
|             "meter_timestamp", | ||||
|             "meter", | ||||
|             "Device date time.", | ||||
|             PrintProperty::JSON | PrintProperty::OPTIONAL, | ||||
|             Quantity::PointInTime, | ||||
|  | @ -78,8 +106,8 @@ namespace | |||
| 
 | ||||
|         addStringFieldWithExtractorAndLookup( | ||||
|             "current_status", | ||||
|             "Status and error flags.", | ||||
|             PrintProperty::JSON | PrintProperty::OPTIONAL | PrintProperty::JOIN_TPL_STATUS, | ||||
|             "Status and error flags. (Deprecated use status instead.)", | ||||
|             PrintProperty::JSON | PrintProperty::JOIN_TPL_STATUS | PrintProperty::STATUS | PrintProperty::DEPRECATED, | ||||
|             FieldMatcher::build() | ||||
|             .set(VIFRange::ErrorFlags), | ||||
|             { | ||||
|  | @ -134,7 +162,7 @@ namespace | |||
|             ); | ||||
| 
 | ||||
|         addNumericFieldWithExtractor( | ||||
|             "set_date", | ||||
|             "set", | ||||
|             "The most recent billing period date.", | ||||
|             PrintProperty::JSON | PrintProperty::OPTIONAL, | ||||
|             Quantity::PointInTime, | ||||
|  | @ -172,10 +200,10 @@ namespace | |||
| 
 | ||||
|         addNumericFieldWithCalculatorAndMatcher( | ||||
|             "history_{storage_counter - 1 counter}", | ||||
|             "The historic date #.", | ||||
|             "The historic date.", | ||||
|             PrintProperty::JSON | PrintProperty::OPTIONAL, | ||||
|             Quantity::PointInTime, | ||||
|             "meter_timestamp_date - ((storage_counter-1counter) * 1 month)", | ||||
|             "meter_datetime - ((storage_counter-1counter) * 1 month)", | ||||
|             FieldMatcher::build() | ||||
|             .set(MeasurementType::Instantaneous) | ||||
|             .set(VIFRange::Volume) | ||||
|  | @ -187,31 +215,31 @@ namespace | |||
| 
 | ||||
| // Test: Woter waterstarm 20096221 BEDB81B52C29B5C143388CBB0D15A051
 | ||||
| // telegram=|3944FA122162092002067A3600202567C94D48D00DC47B11213E23383DB51968A705AAFA60C60E263D50CD259D7C9A03FD0C08000002FD0B0011|
 | ||||
| // {"media":"warm water","meter":"waterstarm","name":"Woter","id":"20096221","meter_timestamp":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"OK","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // {"media":"warm water","meter":"waterstarm","name":"Woter","id":"20096221","meter_datetime":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"OK","status":"OK","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // |Woter;20096221;0.106;0;OK;1111-11-11 11:11.11
 | ||||
| 
 | ||||
| // telegram=|3944FA122162092002067A3604202567C94D48D00DC47B11213E23383DB51968A705AAFA60C60E263D50CD259D7C9A03FD0C08000002FD0B0011|
 | ||||
| // {"media":"warm water","meter":"waterstarm","name":"Woter","id":"20096221","meter_timestamp":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"POWER_LOW","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // {"media":"warm water","meter":"waterstarm","name":"Woter","id":"20096221","meter_datetime":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"POWER_LOW","status":"POWER_LOW","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // |Woter;20096221;0.106;0;POWER_LOW;1111-11-11 11:11.11
 | ||||
| 
 | ||||
| // Test: Water waterstarm 22996221 NOKEY
 | ||||
| // telegram=|3944FA122162992202067A360420252F2F_046D282A9E2704136A00000002FD17400004933C000000002F2F2F2F2F2F03FD0C08000002FD0B0011|
 | ||||
| // {"media":"warm water","meter":"waterstarm","name":"Water","id":"22996221","meter_timestamp":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"LEAKAGE_OR_NO_USAGE POWER_LOW","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // {"media":"warm water","meter":"waterstarm","name":"Water","id":"22996221","meter_datetime":"2020-07-30 10:40","total_m3":0.106,"total_backwards_m3":0,"current_status":"LEAKAGE_OR_NO_USAGE POWER_LOW","status":"LEAKAGE_OR_NO_USAGE POWER_LOW","meter_version":"000008","parameter_set":"1100","timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // |Water;22996221;0.106;0;LEAKAGE_OR_NO_USAGE POWER_LOW;1111-11-11 11:11.11
 | ||||
| 
 | ||||
| 
 | ||||
| // Test: Water waterstarm 11559999 NOKEY
 | ||||
| // telegram=|2E44FA129999551100077A070020252F2F_046D0F28C22404139540000002FD17000001FD481D2F2F2F2F2F2F2F2F2F|
 | ||||
| // {"media":"water","meter":"waterstarm","name":"Water","id":"11559999","meter_timestamp":"2022-04-02 08:15","total_m3":16.533,"current_status":"OK","battery_v":2.9,"timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // {"media":"water","meter":"waterstarm","name":"Water","id":"11559999","meter_datetime":"2022-04-02 08:15","total_m3":16.533,"current_status":"OK","status":"OK","battery_v":2.9,"timestamp":"1111-11-11T11:11:11Z"}
 | ||||
| // |Water;11559999;16.533;null;OK;1111-11-11 11:11.11
 | ||||
| 
 | ||||
| // Test: WarmLorenz waterstarm 20050666 NOKEY
 | ||||
| // telegram=|9644FA126606052000067A1E000020_046D3B2ED729041340D8000002FD17000001FD481D426CBF2C4413026C000084011348D20000C40113F3CB0000840213DCC40000C40213B8B60000840313849B0000C403138B8C0000840413E3800000C4041337770000840513026C0000C40513D65F00008406134F560000C40613604700008407139D370000C407137F3300008408135B2C0000|
 | ||||
| // {"battery_v": 2.9,"consumption_at_history_10_m3": 27.65,"consumption_at_history_11_m3": 24.534,"consumption_at_history_12_m3": 22.095,"consumption_at_history_13_m3": 18.272,"consumption_at_history_14_m3": 14.237,"consumption_at_history_15_m3": 13.183,"consumption_at_history_16_m3": 11.355,"consumption_at_history_1_m3": 27.65,"consumption_at_history_2_m3": 53.832,"consumption_at_history_3_m3": 52.211,"consumption_at_history_4_m3": 50.396,"consumption_at_history_5_m3": 46.776,"consumption_at_history_6_m3": 39.812,"consumption_at_history_7_m3": 35.979,"consumption_at_history_8_m3": 32.995,"consumption_at_history_9_m3": 30.519,"current_status": "OK","history_10_date": "2021-03-31","history_11_date": "2021-02-28","history_12_date": "2021-01-31","history_13_date": "2020-12-31","history_14_date": "2020-11-30","history_15_date": "2020-10-31","history_16_date": "2020-09-30","history_1_date": "2021-12-31","history_2_date": "2021-11-30","history_3_date": "2021-10-31","history_4_date": "2021-09-30","history_5_date": "2021-08-31","history_6_date": "2021-07-31","history_7_date": "2021-06-30","history_8_date": "2021-05-31","history_9_date": "2021-04-30","history_reference_date": "2021-12-31","id": "20050666","media": "warm water","meter": "waterstarm","meter_timestamp": "2022-09-23 14:59","name": "WarmLorenz","timestamp": "1111-11-11T11:11:11Z","total_m3": 55.36}
 | ||||
| // {"battery_v":2.9,"consumption_at_history_10_m3":24.534,"consumption_at_history_11_m3":22.095,"consumption_at_history_12_m3":18.272,"consumption_at_history_13_m3":14.237,"consumption_at_history_14_m3":13.183,"consumption_at_history_15_m3":11.355,"consumption_at_history_1_m3":53.832,"consumption_at_history_2_m3":52.211,"consumption_at_history_3_m3":50.396,"consumption_at_history_4_m3":46.776,"consumption_at_history_5_m3":39.812,"consumption_at_history_6_m3":35.979,"consumption_at_history_7_m3":32.995,"consumption_at_history_8_m3":30.519,"consumption_at_history_9_m3":27.65,"consumption_at_set_date_m3":27.65,"current_status":"OK","status":"OK","history_10_date":"2021-11-23","history_11_date":"2021-10-23","history_12_date":"2021-09-23","history_13_date":"2021-08-23","history_14_date":"2021-07-23","history_15_date":"2021-06-23","history_1_date":"2022-08-23","history_2_date":"2022-07-23","history_3_date":"2022-06-23","history_4_date":"2022-05-23","history_5_date":"2022-04-23","history_6_date":"2022-03-23","history_7_date":"2022-02-23","history_8_date":"2022-01-23","history_9_date":"2021-12-23","id":"20050666","media":"warm water","meter":"waterstarm","meter_datetime":"2022-09-23 14:59","name":"WarmLorenz","set_date":"2021-12-31","timestamp":"1111-11-11T11:11:11Z","total_m3":55.36}
 | ||||
| // |WarmLorenz;20050666;55.36;null;OK;1111-11-11 11:11.11
 | ||||
| 
 | ||||
| 
 | ||||
| // Test: ColdLorenz waterstarm 20065160 NOKEY
 | ||||
| // telegram=|9644FA126051062000077A78000020_046D392DD7290413901A000002FD17000001FD481D426CBF2C4413D312000084011399190000C40113841800008402130C180000C40213EC16000084031395150000C40313E3140000840413BD130000C404134C130000840513D3120000C4051322120000840613AF110000C4061397100000840713D00F0000C40713890E0000840813980C0000|
 | ||||
| // {"battery_v": 2.9,"consumption_at_history_10_m3": 4.819,"consumption_at_history_11_m3": 4.642,"consumption_at_history_12_m3": 4.527,"consumption_at_history_13_m3": 4.247,"consumption_at_history_14_m3": 4.048,"consumption_at_history_15_m3": 3.721,"consumption_at_history_16_m3": 3.224,"consumption_at_history_1_m3": 4.819,"consumption_at_history_2_m3": 6.553,"consumption_at_history_3_m3": 6.276,"consumption_at_history_4_m3": 6.156,"consumption_at_history_5_m3": 5.868,"consumption_at_history_6_m3": 5.525,"consumption_at_history_7_m3": 5.347,"consumption_at_history_8_m3": 5.053,"consumption_at_history_9_m3": 4.94,"current_status": "OK","history_10_date": "2021-03-31","history_11_date": "2021-02-28","history_12_date": "2021-01-31","history_13_date": "2020-12-31","history_14_date": "2020-11-30","history_15_date": "2020-10-31","history_16_date": "2020-09-30","history_1_date": "2021-12-31","history_2_date": "2021-11-30","history_3_date": "2021-10-31","history_4_date": "2021-09-30","history_5_date": "2021-08-31","history_6_date": "2021-07-31","history_7_date": "2021-06-30","history_8_date": "2021-05-31","history_9_date": "2021-04-30","history_reference_date": "2021-12-31","id": "20065160","media": "water","meter": "waterstarm","meter_timestamp": "2022-09-23 13:57","name": "ColdLorenz","timestamp": "1111-11-11T11:11:11Z","total_m3": 6.8}
 | ||||
| // {"battery_v":2.9,"consumption_at_history_10_m3":4.642,"consumption_at_history_11_m3":4.527,"consumption_at_history_12_m3":4.247,"consumption_at_history_13_m3":4.048,"consumption_at_history_14_m3":3.721,"consumption_at_history_15_m3":3.224,"consumption_at_history_1_m3":6.553,"consumption_at_history_2_m3":6.276,"consumption_at_history_3_m3":6.156,"consumption_at_history_4_m3":5.868,"consumption_at_history_5_m3":5.525,"consumption_at_history_6_m3":5.347,"consumption_at_history_7_m3":5.053,"consumption_at_history_8_m3":4.94,"consumption_at_history_9_m3":4.819,"consumption_at_set_date_m3":4.819,"current_status":"OK","status":"OK","history_10_date":"2021-11-23","history_11_date":"2021-10-23","history_12_date":"2021-09-23","history_13_date":"2021-08-23","history_14_date":"2021-07-23","history_15_date":"2021-06-23","history_1_date":"2022-08-23","history_2_date":"2022-07-23","history_3_date":"2022-06-23","history_4_date":"2022-05-23","history_5_date":"2022-04-23","history_6_date":"2022-03-23","history_7_date":"2022-02-23","history_8_date":"2022-01-23","history_9_date":"2021-12-23","id":"20065160","media":"water","meter":"waterstarm","meter_datetime":"2022-09-23 13:57","name":"ColdLorenz","set_date":"2021-12-31","timestamp":"1111-11-11T11:11:11Z","total_m3":6.8}
 | ||||
| // |ColdLorenz;20065160;6.8;null;OK;1111-11-11 11:11.11
 | ||||
|  |  | |||
|  | @ -1148,7 +1148,7 @@ bool checkCommonField(string *buf, string field, Meter *m, Telegram *t, char c, | |||
| } | ||||
| 
 | ||||
| // Is the desired field one of the meter printable fields?
 | ||||
| bool checkPrintableField(string *buf, string field, Meter *m, Telegram *t, char c, | ||||
| bool checkPrintableField(string *buf, string desired_field_name, Meter *m, Telegram *t, char c, | ||||
|                          vector<FieldInfo> &fields, bool human_readable) | ||||
| { | ||||
| 
 | ||||
|  | @ -1157,7 +1157,7 @@ bool checkPrintableField(string *buf, string field, Meter *m, Telegram *t, char | |||
|         if (fi.xuantity() == Quantity::Text) | ||||
|         { | ||||
|             // Strings are simply just print them.
 | ||||
|             if (field == fi.vname()) | ||||
|             if (desired_field_name == fi.vname()) | ||||
|             { | ||||
|                 *buf += m->getStringValue(&fi) + c; | ||||
|                 return true; | ||||
|  | @ -1165,6 +1165,11 @@ bool checkPrintableField(string *buf, string field, Meter *m, Telegram *t, char | |||
|         } | ||||
|         else | ||||
|         { | ||||
|             string display_unit_s = unitToStringLowerCase(fi.displayUnit()); | ||||
|             string var = fi.vname()+"_"+display_unit_s; | ||||
|             if (desired_field_name != var) continue; | ||||
| 
 | ||||
|             // We have the correc field.
 | ||||
|             if (fi.displayUnit() == Unit::DateLT) | ||||
|             { | ||||
|                 *buf += strdate(m->getNumericValue(&fi, Unit::DateLT)); | ||||
|  | @ -1179,21 +1184,15 @@ bool checkPrintableField(string *buf, string field, Meter *m, Telegram *t, char | |||
|             } | ||||
|             else | ||||
|             { | ||||
|                 // Doubles have to be converted into the proper unit.
 | ||||
|                 string display_unit_s = unitToStringLowerCase(fi.displayUnit()); | ||||
|                 string var = fi.vname()+"_"+display_unit_s; | ||||
|                 if (field == var) | ||||
|                 // Default unit.
 | ||||
|                 *buf += valueToString(m->getNumericValue(&fi, fi.displayUnit()), fi.displayUnit()); | ||||
|                 if (human_readable) | ||||
|                 { | ||||
|                     // Default unit.
 | ||||
|                     *buf += valueToString(m->getNumericValue(&fi, fi.displayUnit()), fi.displayUnit()); | ||||
|                     if (human_readable) | ||||
|                     { | ||||
|                         *buf += " "; | ||||
|                         *buf += unitToStringHR(fi.displayUnit()); | ||||
|                     } | ||||
|                     *buf += c; | ||||
|                     return true; | ||||
|                     *buf += " "; | ||||
|                     *buf += unitToStringHR(fi.displayUnit()); | ||||
|                 } | ||||
|                 *buf += c; | ||||
|                 return true; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  |  | |||
|  | @ -1099,7 +1099,7 @@ void padWithZeroesTo(vector<uchar> *content, size_t len, vector<uchar> *full_con | |||
|     } | ||||
| } | ||||
| 
 | ||||
| static string space = "                                                   "; | ||||
| static string space = "                                                                                                                                                               "; | ||||
| string padLeft(const string& input, int width) | ||||
| { | ||||
|     int w = width-input.size(); | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Fredrik Öhrström
						Fredrik Öhrström