diff --git a/CHANGES b/CHANGES index 2d25991..3048b0e 100644 --- a/CHANGES +++ b/CHANGES @@ -2,8 +2,6 @@ ATTENTION! Counter suffix _int is changed to _counter. New fields are added to lansendw, lansenpu, qsmoke drivers. Eventually the old fields will go away in drivers. -Duration tariff added properly this causes a change in the -ei6500 driver json. ATTENTION! When a field is not optional in the driver description, but alas, no data has arrived in the telegram, then the json now @@ -14,6 +12,7 @@ from /var/log/wmbusmeters/meter_readings to /var/lib/wmbusmeters/meter_readings This only affects new installations. Existing conf files will use the old location as specified int the conf file. +Added ei6500 smoke detector. Added kampress pressure sensor. Added hydroclima HCA. diff --git a/README.md b/README.md index 21a15b2..37f4716 100644 --- a/README.md +++ b/README.md @@ -483,7 +483,7 @@ PiiGAB Thermometer/Hygrometer (piigth) wired Supported smoke detectors: Lansen Smoke Detector (lansensm) -Ei Electronics Smoke Detector ei6500-oms (ei6500) (work in progress) +EI Electronics Smoke Detector ei6500-oms (ei6500) Supported door/window detectors: Lansen Door/Window Detector (lansendw) diff --git a/src/driver_ei6500.cc b/src/driver_ei6500.cc index 48444bd..37b711b 100644 --- a/src/driver_ei6500.cc +++ b/src/driver_ei6500.cc @@ -51,7 +51,7 @@ namespace { addStringFieldWithExtractorAndLookup( "status", - "Status and error flags.", + "Meter error flags. IMPORTANT! Smoke alarm is NOT reported here! You MUST check last alarm date and counter!", PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT | PrintProperty::STATUS | PrintProperty::JOIN_TPL_STATUS, FieldMatcher::build() @@ -338,7 +338,6 @@ namespace // {"media":"smoke detector","meter":"ei6500","name":"Smokey","id":"01097274","status":"OK","last_alarm_date":"2000-01-01","alarm_counter":0,"software_version":"010107","message_datetime":"2022-05-24 06:42","duration_removed_h":0,"last_remove_date":"2000-01-01","removed_counter":0,"test_button_last_date":"2000-01-01","test_button_counter":0,"installation_date":"2022-05-24","last_sound_check_date":"2022-03-16","dust_level":"DUST_0","battery_level":"3.00V","obstacle_distance":"","timestamp":"1111-11-11T11:11:11Z"} // |Smokey;01097274;OK;2000-01-01;0.000000;1111-11-11 11:11.11 - // telegram=|58442515747209010C1A7A8D0000000BFD0F070101046D2E06D82502FD17000082206CD825426CD0238440FF2C000F11008250FD61000082506C01018260FD6100008360FD3100000082606C01018270FD61020082706CD825| // {"media":"smoke detector","meter":"ei6500","name":"Smokey","id":"01097274","status":"OK","last_alarm_date":"2000-01-01","alarm_counter":0,"software_version":"010107","message_datetime":"2022-05-24 06:46","duration_removed_h":0,"last_remove_date":"2000-01-01","removed_counter":0,"test_button_last_date":"2022-05-24","test_button_counter":2,"installation_date":"2022-05-24","last_sound_check_date":"2022-03-16","dust_level":"DUST_0","battery_level":"3.00V","obstacle_distance":"","timestamp":"1111-11-11T11:11:11Z"} // |Smokey;01097274;OK;2000-01-01;0.000000;1111-11-11 11:11.11 diff --git a/src/driver_kampress.cc b/src/driver_kampress.cc index 69aa58f..27a9cfc 100644 --- a/src/driver_kampress.cc +++ b/src/driver_kampress.cc @@ -35,6 +35,31 @@ namespace Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di) { + addStringFieldWithExtractorAndLookup( + "status", + "Status and error flags.", + PrintProperty::JSON | PrintProperty::FIELD | JOIN_TPL_STATUS, + FieldMatcher::build() + .set(VIFRange::ErrorFlags), + { + { + { + "ERROR_FLAGS", + Translate::Type::BitToString, + 0xffff, + "OK", + { + { 0x01, "DROP" }, // Unexpected drop in pressure in relation to average pressure. + { 0x02, "SURGE" }, // Unexpected increase in pressure in relation to average pressure. + { 0x04, "HIGH" }, // Average pressure has reached configurable limit. Default 15 bar + { 0x08, "LOW" }, // Average pressure has reached configurable limit. Default 1.5 bar + { 0x10, "TRANSIENT" }, // Pressure changes quickly over short timeperiods. Average is fluctuating. + { 0x20, "COMM_ERROR" } // Cannot measure properly or bad internal communication. + } + }, + }, + }); + addNumericFieldWithExtractor( "pressure", "The measured pressure.", @@ -68,34 +93,37 @@ namespace .set(VIFRange::Pressure) ); - addStringFieldWithExtractorAndLookup( - "status", - "Status and error flags.", - PrintProperty::JSON | PrintProperty::FIELD | JOIN_TPL_STATUS, + addNumericFieldWithExtractor( + "alfa", + "We do not know what this is.", + PrintProperty::JSON, + Quantity::Counter, + VifScaling::None, FieldMatcher::build() - .set(VIFRange::ErrorFlags), - { - { - { - "ERROR_FLAGS", - Translate::Type::BitToString, - 0xffff, - "OK", - { -// { 0x01, "?" }, - } - }, - }, - }); + .set(DifVifKey("05FF09")) + ); + + addNumericFieldWithExtractor( + "beta", + "We do not know what this is.", + PrintProperty::JSON, + Quantity::Counter, + VifScaling::None, + FieldMatcher::build() + .set(DifVifKey("05FF0A")) + ); } } // Test: Pressing kampress 77000317 NOKEY // telegram=|32442D2C1703007701188D280080E39322DB8F78_22696600126967000269660005FF091954A33A05FF0A99BD823A02FD170800| -// {"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","pressure_bar":1.02,"max_pressure_bar":1.03,"min_pressure_bar":1.02,"status":"ERROR_FLAGS_8","timestamp":"1111-11-11T11:11:11Z"} -// |Pressing;77000317;1.020000;1.030000;1.020000;ERROR_FLAGS_8;1111-11-11 11:11.11 - +// {"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","status":"LOW","pressure_bar":1.02,"max_pressure_bar":1.03,"min_pressure_bar":1.02,"alfa_counter":0.001246,"beta_counter":0.000997,"timestamp":"1111-11-11T11:11:11Z"} +// |Pressing;77000317;LOW;1.020000;1.030000;1.020000;1111-11-11 11:11.11 // telegram=|27442D2C1703007701188D280194E393226EC679DE735657_660067006600962B913A21B9423A0800| -// {"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","pressure_bar":1.02,"max_pressure_bar":1.03,"min_pressure_bar":1.02,"status":"ERROR_FLAGS_8","timestamp":"1111-11-11T11:11:11Z"} -// |Pressing;77000317;1.020000;1.030000;1.020000;ERROR_FLAGS_8;1111-11-11 11:11.11 +// {"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","status":"LOW","pressure_bar":1.02,"max_pressure_bar":1.03,"min_pressure_bar":1.02,"alfa_counter":0.001108,"beta_counter":0.000743,"timestamp":"1111-11-11T11:11:11Z"} +// |Pressing;77000317;LOW;1.020000;1.030000;1.020000;1111-11-11 11:11.11 + +// telegram=|27442D2C1703007701188D289554F295224ED579DE73188A_650066006600E80EA43A6B97A3BA0800| +// {"media":"pressure","meter":"kampress","name":"Pressing","id":"77000317","status":"LOW","pressure_bar":1.02,"max_pressure_bar":1.02,"min_pressure_bar":1.01,"alfa_counter":0.001252,"beta_counter":-0.001248,"timestamp":"1111-11-11T11:11:11Z"} +// |Pressing;77000317;LOW;1.020000;1.020000;1.010000;1111-11-11 11:11.11 diff --git a/src/dvparser.cc b/src/dvparser.cc index 1300465..0307206 100644 --- a/src/dvparser.cc +++ b/src/dvparser.cc @@ -30,6 +30,12 @@ using namespace std; +union RealConversion +{ + uint32_t i; + float f; +}; + const char *toString(VIFRange v) { switch (v) { @@ -785,6 +791,24 @@ bool DVEntry::extractDouble(double *out, bool auto_scale, bool assume_signed) *out = (draw) / scale; } else + if (t == 0x5) // 32 Bit Real + { + vector v; + hex2bin(value, &v); + assert(v.size() == 4); + RealConversion rc; + rc.i = v[3]<<24 | v[2]<<16 | v[1]<<8 | v[0]; + + // Assumes float uses the standard IEEE 754 bit set. + // 1 bit sign, 8 bit exp, 23 bit mantissa + // RealConversion is tested on an amd64 platform. How about + // other platsforms with different byte ordering? + double draw = rc.f; + double scale = 1.0; + if (auto_scale) scale = vifScale(dif_vif_key.vif()); + *out = (draw) / scale; + } + else { printf("Unsupported dif format for extraction to double! dif=%02x\n", dif_vif_key.dif()); assert(false); diff --git a/src/dvparser.h b/src/dvparser.h index f4a9be4..065c3f9 100644 --- a/src/dvparser.h +++ b/src/dvparser.h @@ -51,8 +51,10 @@ X(SoftwareVersion,0x7D0F,0x7D0F, Quantity::Text, Unit::TXT) \ X(ErrorFlags,0x7D17,0x7D17, Quantity::Text, Unit::TXT) \ X(DurationOfTariff,0x7D31,0x7D33, Quantity::Time, Unit::Hour) \ + X(Dimensionless,0x7D3A,0x7D3A, Quantity::Time, Unit::Hour) \ X(Voltage,0x7D40,0x7D4F, Quantity::Voltage, Unit::Volt) \ X(Current,0x7D50,0x7D5F, Quantity::Current, Unit::Ampere) \ + X(ResetCounter,0x7D60,0x7D60, Quantity::Counter, Unit::COUNTER) \ X(CumulationCounter,0x7D61,0x7D61, Quantity::Counter, Unit::COUNTER) \ X(AnyVolumeVIF,0x00,0x00, Quantity::Volume, Unit::Unknown) \ X(AnyEnergyVIF,0x00,0x00, Quantity::Energy, Unit::Unknown) \