kopia lustrzana https://github.com/weetmuts/wmbusmeters
Added sontex868 heat cost allocator.
rodzic
fe42750747
commit
3bd42bbc70
3
CHANGES
3
CHANGES
|
@ -1,3 +1,6 @@
|
|||
|
||||
Added support for the sontex868 heat cost allocator.
|
||||
|
||||
Version 1.0.1: 2020-10-26
|
||||
|
||||
Fix bug that prevented /dev/ttyUSB0:im871a:c1 to work.
|
||||
|
|
1
Makefile
1
Makefile
|
@ -143,6 +143,7 @@ METER_OBJS:=\
|
|||
$(BUILD)/meter_rfmamb.o \
|
||||
$(BUILD)/meter_rfmtx1.o \
|
||||
$(BUILD)/meter_supercom587.o \
|
||||
$(BUILD)/meter_sontex868.o \
|
||||
$(BUILD)/meter_topaseskr.o \
|
||||
$(BUILD)/meter_vario451.o \
|
||||
$(BUILD)/meter_waterstarm.o \
|
||||
|
|
50
README.md
50
README.md
|
@ -71,7 +71,7 @@ ignoreduplicates=false
|
|||
Then add a meter file in /etc/wmbusmeters.d/MyTapWater
|
||||
```
|
||||
name=MyTapWater
|
||||
type=multical21
|
||||
type=multical21:c1
|
||||
id=12345678
|
||||
key=00112233445566778899AABBCCDDEEFF
|
||||
```
|
||||
|
@ -253,6 +253,7 @@ Diehl/Sappel ACQUARIUS/IZAR R3 (izar3)
|
|||
Supported heat cost allocators:
|
||||
Innotas EurisII (eurisii)
|
||||
Qundis Q caloric (qcaloric)
|
||||
Sontex 868 (sontex868)
|
||||
Techem FHKV data II/III (fhkvdataiii)
|
||||
|
||||
Supported heat meter:
|
||||
|
@ -330,7 +331,7 @@ Example output:
|
|||
|
||||
Example format json output:
|
||||
|
||||
`wmbusmeters --format=json /dev/ttyUSB0:im871a MyTapWater multical21 12345678 00112233445566778899AABBCCDDEEFF MyHeater multical302 22222222 00112233445566778899AABBCCDDEEFF`
|
||||
`wmbusmeters --format=json /dev/ttyUSB0:im871a MyTapWater multical21:c1 12345678 00112233445566778899AABBCCDDEEFF MyHeater multical302 22222222 00112233445566778899AABBCCDDEEFF`
|
||||
|
||||
`{"media":"cold water","meter":"multical21","name":"MyTapWater","id":"12345678","total_m3":6.388,"target_m3":6.377,"max_flow_m3h":0.000,"flow_temperature":8,"external_temperature":23,"current_status":"DRY","time_dry":"22-31 days","time_reversed":"","time_leaking":"","time_bursting":"","timestamp":"2018-02-08T09:07:22Z","device":"im871a[1234567]","rssi_dbm":-40}`
|
||||
|
||||
|
@ -339,38 +340,48 @@ Example format json output:
|
|||
Example format fields output and use rtlsdr dongle with rtlwmbus tuned to 868.9MHz instead of the
|
||||
default 868.95MHz.
|
||||
|
||||
`wmbusmeters --format=fields rtlwmbus:868.9M GreenhouseWater multical21 33333333 NOKEY`
|
||||
`wmbusmeters --format=fields rtlwmbus:868.9M GreenhouseWater multical21:c1 33333333 NOKEY`
|
||||
|
||||
`GreenhouseTapWater;33333333;9999.099;77.712;0.000;11;31;;2018-03-05 12:10.24`
|
||||
|
||||
You can select a subset of all available fields:
|
||||
|
||||
`wmbusmeters --format=fields --selectfields=id,total_m3 /dev/ttyUSB0:im871a GreenhouseWater multical21 33333333 NOKEY`
|
||||
`wmbusmeters --format=fields --selectfields=id,total_m3 /dev/ttyUSB0:im871a GreenhouseWater multical21:c1 33333333 NOKEY`
|
||||
|
||||
`33333333;9999.099`
|
||||
|
||||
You can list all available fields for the meter by adding `--listfields` to the command line.
|
||||
You can list all available fields for a meter: `wmbusmeters --listfields=multical21`
|
||||
|
||||
You can list all meters: `wmbusmeters --listmeters`
|
||||
|
||||
You can search for meters: `wmbusmeters --listmeters=water` or `wmbusmteres --listmeters=q`
|
||||
|
||||
Eaxmple of using the shell command to publish to MQTT:
|
||||
|
||||
`wmbusmeters --shell='HOME=/home/you mosquitto_pub -h localhost -t water -m "$METER_JSON"' /dev/ttyUSB0:im871a GreenhouseWater multical21 33333333 NOKEY`
|
||||
`wmbusmeters --shell='HOME=/home/you mosquitto_pub -h localhost -t water -m "$METER_JSON"' /dev/ttyUSB0:im871a GreenhouseWater multical21:c1 33333333 NOKEY`
|
||||
|
||||
Eaxmple of using the shell command to inject data into postgresql database:
|
||||
|
||||
`wmbusmeters --shell="psql waterreadings -c \"insert into readings values ('\$METER_ID',\$METER_TOTAL_M3,'\$METER_TIMESTAMP') \" " /dev/ttyUSB0:amb8465 MyColdWater multical21 12345678 NOKEY`
|
||||
`wmbusmeters --shell="psql waterreadings -c \"insert into readings values ('\$METER_ID',\$METER_TOTAL_M3,'\$METER_TIMESTAMP') \" " /dev/ttyUSB0:amb8465 MyColdWater multical21:c1 12345678 NOKEY` (It is much easier to add shell commands in the conf file since you do not need to quote the quotes.)
|
||||
|
||||
You can have multiple shell commands and they will be executed in the order you gave them on the commandline.
|
||||
Note that to single quotes around the command is necessary to pass the env variable names into wmbusmeters.
|
||||
To list the shell env variables available for your meter, add --listenvs to the commandline:
|
||||
`wmbusmeters --listenvs /dev/ttyUSB1:cul Water iperl 12345678 NOKEY`
|
||||
which outputs:
|
||||
|
||||
To list the shell env variables available for a meter, run `wmbusmeters --listenvs=multical21` which outputs:
|
||||
```
|
||||
Environment variables provided to shell for meter iperl:
|
||||
METER_JSON
|
||||
METER_TYPE
|
||||
METER_NAME
|
||||
METER_ID
|
||||
METER_TOTAL_M3
|
||||
METER_TARGET_M3
|
||||
METER_MAX_FLOW_M3H
|
||||
METER_FLOW_TEMPERATURE_C
|
||||
METER_EXTERNAL_TEMPERATURE_C
|
||||
METER_CURRENT_STATUS
|
||||
METER_TIME_DRY
|
||||
METER_TIME_REVERSED
|
||||
METER_TIME_LEAKING
|
||||
METER_TIME_BURSTING
|
||||
METER_TIMESTAMP
|
||||
```
|
||||
(If you have supplied --json_floor=5 then you will also see METER_floor in the list)
|
||||
|
@ -385,13 +396,18 @@ You can use `--debug` to get both verbose output and the actual data bytes sent
|
|||
|
||||
If the meter does not use encryption of its meter data, then enter NOKEY on the command line.
|
||||
|
||||
`wmbusmeters --format=json --meterfiles /dev/ttyUSB0:im871a MyTapWater multical21 12345678 NOKEY`
|
||||
`wmbusmeters --format=json --meterfiles /dev/ttyUSB0:im871a:c1 MyTapWater multical21:c1 12345678 NOKEY`
|
||||
|
||||
If you have a Kamstrup meters and you have received a KEM file and its password from your supplier, then you can use [utils/kem-import.py](utils/kem-import.py) utility to extract meter information from that file (including the AES key) and to create corresponding meter files in wmbusmetrs' config directory.
|
||||
If you have a Kamstrup meters and you have received a KEM file and its
|
||||
password from your supplier, then you can use
|
||||
[utils/kem-import.py](utils/kem-import.py) utility to extract meter
|
||||
information from that file (including the AES key) and to create
|
||||
corresponding meter files in wmbusmetrs' config directory.
|
||||
|
||||
You can run wmbusmeters with --logtelegrams to get log output that can be placed in a simulation.txt
|
||||
file. You can then run wmbusmeter and instead of an usb device, you provide the simulationt.xt
|
||||
file as argument. See test.sh for more info.
|
||||
You can run wmbusmeters with --logtelegrams to get log output that can
|
||||
be placed in a simulation.txt file. You can then run wmbusmeter and
|
||||
instead of an usb device, you provide the simulationt.xt file as
|
||||
argument. See test.sh for more info.
|
||||
|
||||
If you do not specify any meters on the command line, then wmbusmeters
|
||||
will listen and print the header information of any telegram it hears.
|
||||
|
|
|
@ -8,6 +8,12 @@ telegram=|A244EE4D111111113C077AAC000000|0C1389490000426CE1F14C130000000082046C2
|
|||
{"media":"water","meter":"supercom587","name":"MyColdWater","id":"11111111","total_m3":4.989,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
|MyColdWater;11111111;4.989000;1111-11-11 11:11.11
|
||||
|
||||
# Test Sontex868 T1 telegram
|
||||
|
||||
telegram=|AF46EE4D2827282716087A80000000|046D040A9F2A036E000000426CE1F7436E000000525900008288016C61258388016E0000008D8801EE1E3533FE00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005FF2D0000803F8520FF2D0000803F0259AD0A0265D8041259AD0A8310FD3100000082106C01018110FD610082206C9F2A0BFD0F01030102FF2C000002FD66AC08|
|
||||
{"media":"heat cost allocation","meter":"sontex868","name":"MyHeatCoster","id":"27282728","current_consumption_hca":0,"set_date":"2127-07-01","consumption_at_set_date_hca":0,"current_temp_c":27.33,"current_room_temp_c":12.4,"max_temp_c":27.33,"max_temp_previous_period_c":0,"device_date_time":"2020-10-31 10:04","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|MyHeatCoster;27282728;0.000000;2127-07-01;0.000000;1111-11-11 11:11.11
|
||||
|
||||
# Test iPerl T1 telegram, after decryption, its got 2f2f markers.
|
||||
|
||||
telegram=|1E44AE4C9956341268077A36001000|2F2F0413181E0000023B00002F2F2F2F|
|
||||
|
|
|
@ -1133,7 +1133,7 @@ bool start(Configuration *config)
|
|||
t.parse(frame, &mk);
|
||||
t.print();
|
||||
t.explainParse("(wmbus)",0);
|
||||
logTelegram("(wmbus)", t.frame, 0, 0);
|
||||
logTelegram(t.frame, 0, 0);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
/*
|
||||
Copyright (C) 2020 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include"dvparser.h"
|
||||
#include"meters.h"
|
||||
#include"meters_common_implementation.h"
|
||||
#include"wmbus.h"
|
||||
#include"wmbus_utils.h"
|
||||
|
||||
struct MeterSontex868 : public virtual HeatCostMeter, public virtual MeterCommonImplementation {
|
||||
MeterSontex868(MeterInfo &mi);
|
||||
|
||||
double currentConsumption(Unit u);
|
||||
string setDate();
|
||||
double consumptionAtSetDate(Unit u);
|
||||
|
||||
double currentTemp(Unit u);
|
||||
double currentRoomTemp(Unit u);
|
||||
|
||||
double maxTemp(Unit u);
|
||||
double maxTempPreviousPeriod(Unit u);
|
||||
|
||||
private:
|
||||
|
||||
void processContent(Telegram *t);
|
||||
|
||||
// Telegram type 1
|
||||
double current_consumption_hca_ {};
|
||||
string set_date_;
|
||||
double consumption_at_set_date_hca_ {};
|
||||
string set_date_17_;
|
||||
|
||||
double curr_temp_c_ {};
|
||||
double curr_room_temp_c_ {};
|
||||
|
||||
double max_temp_c_ {};
|
||||
double max_temp_previous_period_c_ {};
|
||||
|
||||
string device_date_time_;
|
||||
};
|
||||
|
||||
MeterSontex868::MeterSontex868(MeterInfo &mi) :
|
||||
MeterCommonImplementation(mi, MeterType::SONTEX868)
|
||||
{
|
||||
setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV);
|
||||
|
||||
addLinkMode(LinkMode::C1);
|
||||
|
||||
addPrint("current_consumption", Quantity::HCA,
|
||||
[&](Unit u){ return currentConsumption(u); },
|
||||
"The current heat cost allocation.",
|
||||
true, true);
|
||||
|
||||
addPrint("set_date", Quantity::Text,
|
||||
[&](){ return setDate(); },
|
||||
"The most recent billing period date.",
|
||||
true, true);
|
||||
|
||||
addPrint("consumption_at_set_date", Quantity::HCA,
|
||||
[&](Unit u){ return consumptionAtSetDate(u); },
|
||||
"Heat cost allocation at the most recent billing period date.",
|
||||
true, true);
|
||||
|
||||
addPrint("current_temp", Quantity::Temperature,
|
||||
[&](Unit u){ return currentTemp(u); },
|
||||
"The current temperature of the heating element.",
|
||||
false, true);
|
||||
|
||||
addPrint("current_room_temp", Quantity::Temperature,
|
||||
[&](Unit u){ return currentRoomTemp(u); },
|
||||
"The current room temperature.",
|
||||
false, true);
|
||||
|
||||
addPrint("max_temp", Quantity::Temperature,
|
||||
[&](Unit u){ return maxTemp(u); },
|
||||
"The maximum temperature so far during this billing period.",
|
||||
false, true);
|
||||
|
||||
addPrint("max_temp_previous_period", Quantity::Temperature,
|
||||
[&](Unit u){ return maxTempPreviousPeriod(u); },
|
||||
"The maximum temperature during the previous billing period.",
|
||||
false, true);
|
||||
|
||||
addPrint("device_date_time", Quantity::Text,
|
||||
[&](){ return device_date_time_; },
|
||||
"Device date time.",
|
||||
false, true);
|
||||
}
|
||||
|
||||
shared_ptr<HeatCostMeter> createSontex868(MeterInfo &mi)
|
||||
{
|
||||
return shared_ptr<HeatCostMeter>(new MeterSontex868(mi));
|
||||
}
|
||||
|
||||
double MeterSontex868::currentConsumption(Unit u)
|
||||
{
|
||||
return current_consumption_hca_;
|
||||
}
|
||||
|
||||
string MeterSontex868::setDate()
|
||||
{
|
||||
return set_date_;
|
||||
}
|
||||
|
||||
double MeterSontex868::consumptionAtSetDate(Unit u)
|
||||
{
|
||||
return consumption_at_set_date_hca_;
|
||||
}
|
||||
|
||||
double MeterSontex868::currentTemp(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Temperature);
|
||||
return convert(curr_temp_c_, Unit::C, u);
|
||||
}
|
||||
|
||||
double MeterSontex868::currentRoomTemp(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Temperature);
|
||||
return convert(curr_room_temp_c_, Unit::C, u);
|
||||
}
|
||||
|
||||
double MeterSontex868::maxTemp(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Temperature);
|
||||
return convert(max_temp_c_, Unit::C, u);
|
||||
}
|
||||
|
||||
double MeterSontex868::maxTempPreviousPeriod(Unit u)
|
||||
{
|
||||
assertQuantity(u, Quantity::Temperature);
|
||||
return convert(max_temp_previous_period_c_, Unit::C, u);
|
||||
}
|
||||
|
||||
void MeterSontex868::processContent(Telegram *t)
|
||||
{
|
||||
/*
|
||||
(sontex868) 0f: 04 dif (32 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 10: 6D vif (Date and time type)
|
||||
(sontex868) 11: * 040A9F2A device datetime (2020-10-31 10:04)
|
||||
(sontex868) 15: 03 dif (24 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 16: 6E vif (Units for H.C.A.)
|
||||
(sontex868) 17: * 000000 current consumption (0.000000 hca)
|
||||
(sontex868) 1a: 42 dif (16 Bit Integer/Binary Instantaneous value storagenr=1)
|
||||
(sontex868) 1b: 6C vif (Date type G)
|
||||
(sontex868) 1c: * E1F7 set date (2127-07-01)
|
||||
(sontex868) 1e: 43 dif (24 Bit Integer/Binary Instantaneous value storagenr=1)
|
||||
(sontex868) 1f: 6E vif (Units for H.C.A.)
|
||||
(sontex868) 20: * 000000 consumption at set date (0.000000 hca)
|
||||
(sontex868) 23: 52 dif (16 Bit Integer/Binary Maximum value storagenr=1)
|
||||
(sontex868) 24: 59 vif (Flow temperature 10⁻² °C)
|
||||
(sontex868) 25: * 0000 max temperature previous period (0.000000 °C)
|
||||
(sontex868) 27: 82 dif (16 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 28: 88 dife (subunit=0 tariff=0 storagenr=16)
|
||||
(sontex868) 29: 01 dife (subunit=0 tariff=0 storagenr=48)
|
||||
(sontex868) 2a: 6C vif (Date type G)
|
||||
(sontex868) 2b: 6125
|
||||
(sontex868) 2d: 83 dif (24 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 2e: 88 dife (subunit=0 tariff=0 storagenr=16)
|
||||
(sontex868) 2f: 01 dife (subunit=0 tariff=0 storagenr=48)
|
||||
(sontex868) 30: 6E vif (Units for H.C.A.)
|
||||
(sontex868) 31: 000000
|
||||
(sontex868) 34: 8D dif (variable length Instantaneous value)
|
||||
(sontex868) 35: 88 dife (subunit=0 tariff=0 storagenr=16)
|
||||
(sontex868) 36: 01 dife (subunit=0 tariff=0 storagenr=48)
|
||||
(sontex868) 37: EE vif (Units for H.C.A.)
|
||||
(sontex868) 38: 1E vife (Compact profile with register)
|
||||
(sontex868) 39: 35 varlen=53
|
||||
(sontex868) 3a: 33FE000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
(sontex868) 6f: 05 dif (32 Bit Real Instantaneous value)
|
||||
(sontex868) 70: FF vif (Vendor extension)
|
||||
(sontex868) 71: 2D vife (per m3)
|
||||
(sontex868) 72: 0000803F
|
||||
(sontex868) 76: 85 dif (32 Bit Real Instantaneous value)
|
||||
(sontex868) 77: 20 dife (subunit=0 tariff=2 storagenr=0)
|
||||
(sontex868) 78: FF vif (Vendor extension)
|
||||
(sontex868) 79: 2D vife (per m3)
|
||||
(sontex868) 7a: 0000803F
|
||||
(sontex868) 7e: 02 dif (16 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 7f: 59 vif (Flow temperature 10⁻² °C)
|
||||
(sontex868) 80: * AD0A current temperature (27.330000 °C)
|
||||
(sontex868) 82: 02 dif (16 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 83: 65 vif (External temperature 10⁻² °C)
|
||||
(sontex868) 84: * D804 current room temperature (12.400000 °C)
|
||||
(sontex868) 86: 12 dif (16 Bit Integer/Binary Maximum value)
|
||||
(sontex868) 87: 59 vif (Flow temperature 10⁻² °C)
|
||||
(sontex868) 88: * AD0A max temperature current period (27.330000 °C)
|
||||
(sontex868) 8a: 83 dif (24 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 8b: 10 dife (subunit=0 tariff=1 storagenr=0)
|
||||
(sontex868) 8c: FD vif (Second extension of VIF-codes)
|
||||
(sontex868) 8d: 31 vife (Duration of tariff [minute(s)])
|
||||
(sontex868) 8e: 000000
|
||||
(sontex868) 91: 82 dif (16 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 92: 10 dife (subunit=0 tariff=1 storagenr=0)
|
||||
(sontex868) 93: 6C vif (Date type G)
|
||||
(sontex868) 94: 0101
|
||||
(sontex868) 96: 81 dif (8 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 97: 10 dife (subunit=0 tariff=1 storagenr=0)
|
||||
(sontex868) 98: FD vif (Second extension of VIF-codes)
|
||||
(sontex868) 99: 61 vife (Cumulation counter)
|
||||
(sontex868) 9a: 00
|
||||
(sontex868) 9b: 82 dif (16 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) 9c: 20 dife (subunit=0 tariff=2 storagenr=0)
|
||||
(sontex868) 9d: 6C vif (Date type G)
|
||||
(sontex868) 9e: 9F2A
|
||||
(sontex868) a0: 0B dif (6 digit BCD Instantaneous value)
|
||||
(sontex868) a1: FD vif (Second extension of VIF-codes)
|
||||
(sontex868) a2: 0F vife (Software version #)
|
||||
(sontex868) a3: 010301
|
||||
(sontex868) a6: 02 dif (16 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) a7: FF vif (Vendor extension)
|
||||
(sontex868) a8: 2C vife (per litre)
|
||||
(sontex868) a9: 0000
|
||||
(sontex868) ab: 02 dif (16 Bit Integer/Binary Instantaneous value)
|
||||
(sontex868) ac: FD vif (Second extension of VIF-codes)
|
||||
(sontex868) ad: 66 vife (State of parameter activation)
|
||||
(sontex868) ae: AC08
|
||||
*/
|
||||
|
||||
int offset;
|
||||
string key;
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::HeatCostAllocation, 0, 0, &key, &t->values)) {
|
||||
extractDVdouble(&t->values, key, &offset, ¤t_consumption_hca_);
|
||||
t->addMoreExplanation(offset, " current consumption (%f hca)", current_consumption_hca_);
|
||||
}
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::Date, 1, 0, &key, &t->values)) {
|
||||
struct tm date;
|
||||
extractDVdate(&t->values, key, &offset, &date);
|
||||
set_date_ = strdate(&date);
|
||||
t->addMoreExplanation(offset, " set date (%s)", set_date_.c_str());
|
||||
}
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::HeatCostAllocation, 1, 0, &key, &t->values)) {
|
||||
extractDVdouble(&t->values, key, &offset, &consumption_at_set_date_hca_);
|
||||
t->addMoreExplanation(offset, " consumption at set date (%f hca)", consumption_at_set_date_hca_);
|
||||
}
|
||||
|
||||
if(findKey(MeasurementType::Instantaneous, ValueInformation::FlowTemperature, 0, 0, &key, &t->values)) {
|
||||
extractDVdouble(&t->values, key, &offset, &curr_temp_c_);
|
||||
t->addMoreExplanation(offset, " current temperature (%f °C)", curr_temp_c_);
|
||||
}
|
||||
|
||||
if(findKey(MeasurementType::Instantaneous, ValueInformation::ExternalTemperature, 0, 0, &key, &t->values)) {
|
||||
extractDVdouble(&t->values, key, &offset, &curr_room_temp_c_);
|
||||
t->addMoreExplanation(offset, " current room temperature (%f °C)", curr_room_temp_c_);
|
||||
}
|
||||
|
||||
if(findKey(MeasurementType::Maximum, ValueInformation::FlowTemperature, 0, 0, &key, &t->values)) {
|
||||
extractDVdouble(&t->values, key, &offset, &max_temp_c_);
|
||||
t->addMoreExplanation(offset, " max temperature current period (%f °C)", max_temp_c_);
|
||||
}
|
||||
|
||||
if(findKey(MeasurementType::Maximum, ValueInformation::FlowTemperature, 1, 0, &key, &t->values)) {
|
||||
extractDVdouble(&t->values, key, &offset, &max_temp_previous_period_c_);
|
||||
t->addMoreExplanation(offset, " max temperature previous period (%f °C)", max_temp_previous_period_c_);
|
||||
}
|
||||
|
||||
if (findKey(MeasurementType::Unknown, ValueInformation::DateTime, 0, 0, &key, &t->values)) {
|
||||
struct tm datetime;
|
||||
extractDVdate(&t->values, key, &offset, &datetime);
|
||||
device_date_time_ = strdatetime(&datetime);
|
||||
t->addMoreExplanation(offset, " device datetime (%s)", device_date_time_.c_str());
|
||||
}
|
||||
|
||||
key = "0DFF5F";
|
||||
if (hasKey(&t->values, key)) {
|
||||
string hex;
|
||||
extractDVstring(&t->values, key, &offset, &hex);
|
||||
t->addMoreExplanation(offset, " vendor extension data");
|
||||
// This is not stored anywhere yet, we need to understand it, if necessary.
|
||||
}
|
||||
}
|
|
@ -461,7 +461,7 @@ bool MeterCommonImplementation::handleTelegram(AboutTelegram &about, vector<ucha
|
|||
|
||||
char log_prefix[256];
|
||||
snprintf(log_prefix, 255, "(%s) log", meterName().c_str());
|
||||
logTelegram(log_prefix, t.frame, t.header_size, t.suffix_size);
|
||||
logTelegram(t.frame, t.header_size, t.suffix_size);
|
||||
|
||||
// Invoke meter specific parsing!
|
||||
processContent(&t);
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
X(rfmtx1, T1_bit, Water, RFMTX1, RfmTX1) \
|
||||
X(q400, T1_bit, Water, Q400, Q400) \
|
||||
X(qcaloric, C1_bit, HeatCostAllocation, QCALORIC, QCaloric) \
|
||||
X(sontex868, T1_bit, HeatCostAllocation, SONTEX868, Sontex868) \
|
||||
X(supercom587,T1_bit, Water, SUPERCOM587, Supercom587) \
|
||||
X(vario451, T1_bit, Heat, VARIO451, Vario451) \
|
||||
X(waterstarm, C1_bit|T1_bit, Water,WATERSTARM, WaterstarM) \
|
||||
|
@ -131,6 +132,7 @@
|
|||
X(QCALORIC, MANUFACTURER_QDS, 0x08, 0x35) \
|
||||
X(SUPERCOM587,MANUFACTURER_SON, 0x06, 0x3c) \
|
||||
X(SUPERCOM587,MANUFACTURER_SON, 0x07, 0x3c) \
|
||||
X(SONTEX868, MANUFACTURER_SON, 0x08, 0x16) \
|
||||
X(VARIO451, MANUFACTURER_TCH, 0x04, 0x27) \
|
||||
X(VARIO451, MANUFACTURER_TCH, 0xc3, 0x27) \
|
||||
X(WATERSTARM, MANUFACTURER_DWZ, 0x06, 0x02) \
|
||||
|
@ -379,6 +381,7 @@ shared_ptr<WaterMeter> createQ400(MeterInfo &m);
|
|||
shared_ptr<HeatCostMeter> createQCaloric(MeterInfo &m);
|
||||
shared_ptr<HeatCostMeter> createEurisII(MeterInfo &m);
|
||||
shared_ptr<HeatCostMeter> createFHKVDataIII(MeterInfo &m);
|
||||
shared_ptr<HeatCostMeter> createSontex868(MeterInfo &m);
|
||||
shared_ptr<TempHygroMeter> createLansenTH(MeterInfo &m);
|
||||
shared_ptr<SmokeDetector> createLansenSM(MeterInfo &m);
|
||||
shared_ptr<PulseCounter> createLansenPU(MeterInfo &m);
|
||||
|
|
|
@ -811,7 +811,7 @@ void debugPayload(string intro, vector<uchar> &payload, vector<uchar>::iterator
|
|||
}
|
||||
}
|
||||
|
||||
void logTelegram(string intro, vector<uchar> &parsed, int header_size, int suffix_size)
|
||||
void logTelegram(vector<uchar> &parsed, int header_size, int suffix_size)
|
||||
{
|
||||
if (isLogTelegramsEnabled())
|
||||
{
|
||||
|
@ -821,7 +821,7 @@ void logTelegram(string intro, vector<uchar> &parsed, int header_size, int suffi
|
|||
string content = parsed_hex.substr(header_size*2);
|
||||
if (suffix_size == 0)
|
||||
{
|
||||
notice("%s \"telegram=|%s|%s|+%ld\"\n", intro.c_str(),
|
||||
notice("telegram=|%s|%s|+%ld\n",
|
||||
header.c_str(), content.c_str(), diff);
|
||||
}
|
||||
else
|
||||
|
@ -829,7 +829,7 @@ void logTelegram(string intro, vector<uchar> &parsed, int header_size, int suffi
|
|||
assert((suffix_size*2) < (int)content.size());
|
||||
string content2 = content.substr(0, content.size()-suffix_size*2);
|
||||
string suffix = content.substr(content.size()-suffix_size*2);
|
||||
notice("%s \"telegram=|%s|%s|%s|+%ld\"\n", intro.c_str(),
|
||||
notice("telegram=|%s|%s|%s|+%ld\n",
|
||||
header.c_str(), content2.c_str(), suffix.c_str(), diff);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ bool isLogTelegramsEnabled();
|
|||
|
||||
void debugPayload(std::string intro, std::vector<uchar> &payload);
|
||||
void debugPayload(std::string intro, std::vector<uchar> &payload, std::vector<uchar>::iterator &pos);
|
||||
void logTelegram(std::string intro, std::vector<uchar> &parsed, int header_size, int suffix_size);
|
||||
void logTelegram(std::vector<uchar> &parsed, int header_size, int suffix_size);
|
||||
|
||||
enum class Alarm
|
||||
{
|
||||
|
|
|
@ -30,6 +30,11 @@ Received telegram from: 11111111
|
|||
type: Water meter (0x07)
|
||||
ver: 0x3c
|
||||
driver: supercom587
|
||||
Received telegram from: 27282728
|
||||
manufacturer: (SON) Sontex, Switzerland (0x4dee)
|
||||
type: Heat Cost Allocator (0x08)
|
||||
ver: 0x16
|
||||
driver: sontex868
|
||||
Received telegram from: 12345699
|
||||
manufacturer: (SEN) Sensus Metering Systems, Germany (0x4cae)
|
||||
type: Water meter (0x07)
|
||||
|
|
|
@ -53,7 +53,7 @@ fi
|
|||
|
||||
RES=$(cat $TEST/thelog2.txt | tr '\n' ' ' | tr -d ' ')
|
||||
|
||||
EXP=$(printf '(supercom587) log "telegram=|A244EE4D785634123C067A8F000000|0C1348550000426CE1F14C130000000082046C21298C0413330000008D04931E3A3CFE3300000033000000330000003300000033000000330000003300000033000000330000003300000033000000330000004300000034180000046D0D0B5C2B03FD6C5E150082206C5C290BFD0F0200018C4079678885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0" (supercom587) log "telegram=|A244EE4D111111113C077AAC000000|0C1389490000426CE1F14C130000000082046C21298C0413010000008D04931E3A3CFE0100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000001600000031130000046D0A0C5C2B03FD6C60150082206C5C290BFD0F0200018C4079629885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0" (iperl) log "telegram=|1E44AE4C9956341268077A36001000|2F2F0413181E0000023B00002F2F2F2F|+0" (iperl) log "telegram=|1844AE4C4455223368077A55000000|041389E20100023B0000|+0"' | tr '\n' ' ' | tr -d ' ')
|
||||
EXP=$(printf 'telegram=|A244EE4D785634123C067A8F000000|0C1348550000426CE1F14C130000000082046C21298C0413330000008D04931E3A3CFE3300000033000000330000003300000033000000330000003300000033000000330000003300000033000000330000004300000034180000046D0D0B5C2B03FD6C5E150082206C5C290BFD0F0200018C4079678885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0 telegram=|A244EE4D111111113C077AAC000000|0C1389490000426CE1F14C130000000082046C21298C0413010000008D04931E3A3CFE0100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000001600000031130000046D0A0C5C2B03FD6C60150082206C5C290BFD0F0200018C4079629885238310FD3100000082106C01018110FD610002FD66020002FD170000|+0 telegram=|1E44AE4C9956341268077A36001000|2F2F0413181E0000023B00002F2F2F2F|+0 telegram=|1844AE4C4455223368077A55000000|041389E20100023B0000|+0' | tr '\n' ' ' | tr -d ' ')
|
||||
|
||||
if [ "$RES" != "$EXP" ]
|
||||
then
|
||||
|
|
|
@ -10,6 +10,7 @@ TESTRESULT="ERROR"
|
|||
|
||||
METERS="MyWarmWater supercom587 12345678 NOKEY
|
||||
MyColdWater supercom587 11111111 NOKEY
|
||||
MyHeatCoster sontex868 27282728 NOKEY
|
||||
MoreWater iperl 12345699 NOKEY
|
||||
WaterWater iperl 33225544 NOKEY
|
||||
MyElectricity1 amiplus 10101010 NOKEY
|
||||
|
|
|
@ -35,6 +35,8 @@ mqtt_publish) sent to a REST API (eg curl) or store it in a database
|
|||
|
||||
\fB\--format=\fR(hr|json|fields) for human readable, json or semicolon separated fields
|
||||
|
||||
\fB\--ignoreduplicates\fR ignore telegram duplicates (when using multiple receiving dongles or repeaters)
|
||||
|
||||
\fB\--json_xxx=yyy\fR always add "xxx"="yyy" to the json output and add shell env METER_xxx=yyy
|
||||
|
||||
\fB\--listento=\fR<mode> listen to one of the c1,t1,s1,s1m,n1a-n1f link modes.
|
||||
|
@ -175,13 +177,17 @@ loglevel=normal
|
|||
device=im871a[12345678]:c1
|
||||
device=rtlwmbus:433M:c1,t1
|
||||
logtelegrams=false
|
||||
format=json
|
||||
meterfiles=/var/log/wmbusmeters/meter_readings
|
||||
meterfilesaction=overwrite
|
||||
meterfilesnaming=name
|
||||
meterfilestimestamp=day
|
||||
logfile=/var/log/wmbusmeters/wmbusmeters.log
|
||||
shell=/usr/bin/mosquitto_pub -h localhost -t "wmbusmeters/$METER_ID" -m "$METER_JSON"
|
||||
alarmshell=/usr/bin/mosquitto_pub -h localhost -t wmbusmeters_alarm -m "$ALARM_TYPE $ALARM_MESSAGE"
|
||||
alarmtimeout=1h
|
||||
alarmexpectedactivity=mon-sun(00-23)
|
||||
ignoreduplicates=false
|
||||
json_address=MyStreet 5
|
||||
.fi
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue