kopia lustrzana https://github.com/weetmuts/wmbusmeters
Add pressure meter driver kampress.
rodzic
5f42914427
commit
28d1b6798e
1
CHANGES
1
CHANGES
|
@ -14,6 +14,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 kampress pressure sensor.
|
||||
Added hydroclima HCA.
|
||||
|
||||
Add detection of bad CUL firmware.
|
||||
|
|
|
@ -500,9 +500,13 @@ Gavazzi EM24 (em24)
|
|||
Gransystems 301 and 303 (gransystems)
|
||||
Kamstrup Omnipower (omnipower)
|
||||
|
||||
Support gas meters:
|
||||
Supported gas meters:
|
||||
uniSMART (unismart)
|
||||
|
||||
Supported pressure sensors:
|
||||
Kamstrup Pressure Sensor (kampress)
|
||||
|
||||
|
||||
```
|
||||
|
||||
The wmbus dongle im871a can listen to either s1, c1 or t1.
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include"meters_common_implementation.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct Driver : public virtual MeterCommonImplementation
|
||||
{
|
||||
Driver(MeterInfo &mi, DriverInfo &di);
|
||||
};
|
||||
|
||||
static bool ok = registerDriver([](DriverInfo&di)
|
||||
{
|
||||
di.setName("kampress");
|
||||
di.setMeterType(MeterType::PressureSensor);
|
||||
di.addLinkMode(LinkMode::C1);
|
||||
di.addDetection(MANUFACTURER_KAM, 0x18, 0x01);
|
||||
di.setConstructor([](MeterInfo& mi, DriverInfo& di){ return shared_ptr<Meter>(new Driver(mi, di)); });
|
||||
});
|
||||
|
||||
Driver::Driver(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||
{
|
||||
addNumericFieldWithExtractor(
|
||||
"pressure",
|
||||
"The measured pressure.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||
Quantity::Pressure,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Instantaneous)
|
||||
.set(VIFRange::Pressure)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"max_pressure",
|
||||
"The maximum pressure measured during ?.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||
Quantity::Pressure,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Maximum)
|
||||
.set(VIFRange::Pressure)
|
||||
);
|
||||
|
||||
addNumericFieldWithExtractor(
|
||||
"min_pressure",
|
||||
"The minumum pressure measured during ?.",
|
||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||
Quantity::Pressure,
|
||||
VifScaling::Auto,
|
||||
FieldMatcher::build()
|
||||
.set(MeasurementType::Minimum)
|
||||
.set(VIFRange::Pressure)
|
||||
);
|
||||
|
||||
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, "?" },
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 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":"UNKNOWN_ERROR_FLAGS(0x8)","timestamp":"1111-11-11T11:11:11Z"}
|
||||
// |Pressing;77000317;1.020000;1.030000;1.020000;UNKNOWN_ERROR_FLAGS(0x8);1111-11-11 11:11.11
|
|
@ -36,6 +36,7 @@
|
|||
X(ReturnTemperature,0x5C,0x5F, Quantity::Temperature, Unit::C) \
|
||||
X(TemperatureDifference,0x60,0x63, Quantity::Temperature, Unit::C) \
|
||||
X(ExternalTemperature,0x64,0x67, Quantity::Temperature, Unit::C) \
|
||||
X(Pressure,0x68,0x6B, Quantity::Pressure, Unit::BAR) \
|
||||
X(HeatCostAllocation,0x6E,0x6E, Quantity::HCA, Unit::HCA) \
|
||||
X(Date,0x6C,0x6C, Quantity::PointInTime, Unit::DateTimeLT) \
|
||||
X(DateTime,0x6D,0x6D, Quantity::PointInTime, Unit::DateTimeLT) \
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
X(SmokeDetector) \
|
||||
X(TempHygroMeter) \
|
||||
X(WaterMeter) \
|
||||
X(PressureSensor) \
|
||||
|
||||
enum class MeterType {
|
||||
#define X(name) name,
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
X(PointInTime,DateTimeLT) \
|
||||
X(Voltage,Volt) \
|
||||
X(Current,Ampere) \
|
||||
X(Frequency,Hz)
|
||||
X(Frequency,Hz) \
|
||||
X(Pressure,BAR)
|
||||
|
||||
#define LIST_OF_UNITS \
|
||||
X(KWH,kwh,"kWh",Energy,"kilo Watt hour") \
|
||||
|
@ -67,7 +68,8 @@
|
|||
X(DateTimeLT,lt,"lt",PointInTime,"local time") \
|
||||
X(Volt,v,"V",Voltage,"volt") \
|
||||
X(Ampere,a,"A",Current,"ampere") \
|
||||
X(Hz,hz,"Hz",Frequency,"hz")
|
||||
X(Hz,hz,"Hz",Frequency,"hz") \
|
||||
X(BAR,bar,"bar",Pressure,"bar")
|
||||
|
||||
enum class Unit
|
||||
{
|
||||
|
|
|
@ -2577,7 +2577,7 @@ string vifType(int vif)
|
|||
|
||||
case 0x68: return "Pressure mbar";
|
||||
case 0x69: return "Pressure 10⁻² bar";
|
||||
case 0x6A: return "Pressure 10⁻1 bar";
|
||||
case 0x6A: return "Pressure 10⁻¹ bar";
|
||||
case 0x6B: return "Pressure bar";
|
||||
|
||||
case 0x6C: return "Date type G";
|
||||
|
@ -2753,7 +2753,7 @@ double vifScale(int vif)
|
|||
// wmbusmeters always returns pressure in bar
|
||||
case 0x68: return 1000.0; // Pressure mbar
|
||||
case 0x69: return 100.0; // Pressure 10⁻² bar
|
||||
case 0x6A: return 10.0; // Pressure 10⁻1 bar
|
||||
case 0x6A: return 10.0; // Pressure 10⁻¹ bar
|
||||
case 0x6B: return 1.0; // Pressure bar
|
||||
|
||||
case 0x6C: warning("(wmbus) warning: do not scale a date type!\n"); return -1.0; // Date type G
|
||||
|
|
Ładowanie…
Reference in New Issue