pull/170/head
Fredrik Öhrström 2020-08-30 21:40:50 +02:00
commit ab521e257d
8 zmienionych plików z 178 dodań i 5 usunięć

16
CHANGES
Wyświetl plik

@ -1,3 +1,19 @@
Version 0.9.35: 2020-08-23
Added support for alarms (shell command triggered)
and resetting of dongle when no telegrams have been received
for a preset time, or if there are communication errors
with the dongle.
Added support for the Waterstar M meter.
Bug fix for long term problem where wmbusmeters did not properly
shut down background rtl_sdr|rtl_wmbus pipeline.
Eric added support for the Multical 403. Thanks Eric!
Bibo made snapcraft fixes. The snap now builds properly! Thanks Bibo!
Version 0.9.34: 2020-07-09
Wmbusmeters should now properly handle

Wyświetl plik

@ -115,6 +115,7 @@ METER_OBJS:=\
$(BUILD)/meter_apator08.o \
$(BUILD)/meter_apator162.o \
$(BUILD)/meter_cma12w.o \
$(BUILD)/meter_compact5.o \
$(BUILD)/meter_ebzwmbe.o \
$(BUILD)/meter_ehzp.o \
$(BUILD)/meter_esyswm.o \

Wyświetl plik

@ -230,6 +230,7 @@ Innotas EurisII (eurisii)
Techem FHKV data II/III (fhkvdataiii)
Supported heat meter:
Heat meter Techem Compact V (compact5) (non-standard protocol)
Heat meter Techem Vario 4 (vario451) (non-standard protocol)
Heat meter Kamstrup Multical 302 (multical302) (in C1 mode, please open issue for T1 mode)
Heat and Cooling meter Kamstrup Multical 403 (multical403) (in C1 mode)

Wyświetl plik

@ -9,6 +9,9 @@ then
cp $SNAP/etc/wmbusmeters.conf $SNAP_COMMON/etc/wmbusmeters.conf
sed -i "s|^meterfiles=.*|meterfiles=$SNAP_COMMON/logs/meter_readings|g" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "s|^logfile=.*|logfile=$SNAP_COMMON/logs/wmbusmeters.log|g" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a listento=t1" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a # To use rtl_433 uncomment following line \n#device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_433 -F csv -f 868.95M" "$SNAP_COMMON/etc/wmbusmeters.conf"
sed -i "/^device=.*/a # To use rtl_wmbus uncomment following line \n#device=rtlwmbus:LD_LIBRARY_PATH=/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu::/snap/wmbusmeters/current/lib:/snap/wmbusmeters/current/usr/lib:/snap/wmbusmeters/current/lib/x86_64-linux-gnu:/snap/wmbusmeters/current/usr/lib/x86_64-linux-gnu /snap/wmbusmeters/current/usr/bin/rtl_sdr -f 868.95M -s 1600000 - 2>/dev/null | /snap/wmbusmeters/current/usr/bin/rtl_wmbus" "$SNAP_COMMON/etc/wmbusmeters.conf"
fi
# Launch the snap

Wyświetl plik

@ -7,7 +7,7 @@ description: |
The readings can then be published using MQTT, curled to a REST api,
inserted into a database or stored in a log file.
Following must be executed "sudo snap connect wmbusmeters:raw-usb core:raw-usb"
to allow snap read USB devices and check that root user of your system is
to allow snap read USB devices and check that root user of your system is
added to group that can read USB devices
base: core18
@ -48,22 +48,43 @@ parts:
build-packages:
- g++
- make
- libncurses-dev
- librtlsdr-dev
- libncurses5-dev
stage-packages:
- mosquitto-clients
- curl
- libusb-1.0-0
- rtl-sdr
prime:
- usr/bin/
- usr/lib/
- lib/
- etc/wmbusmeters.conf
rtl-wmbus:
source: "https://github.com/weetmuts/rtl-wmbus.git"
plugin: make
artifacts:
- build/rtl_wmbus
organize:
build/rtl_wmbus: usr/bin/rtl_wmbus
prime:
- usr/bin/rtl_wmbus
rtl-433:
source: "https://github.com/merbanan/rtl_433.git"
plugin: cmake
organize:
bin/rtl_433: usr/bin/rtl_433
prime:
- usr/bin/rtl_433
apps:
wmbusmeters:
command: launcher.sh
command: /bin/sh $SNAP/launcher.sh
daemon: simple
restart-condition: always
plugs:
- network
- network-bind
- raw-usb
- raw-usb

Wyświetl plik

@ -0,0 +1,128 @@
/*
Copyright (C) 2019 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"
#include"units.h"
#include"util.h"
struct MeterCompact5 : public virtual HeatMeter, public virtual MeterCommonImplementation
{
MeterCompact5(MeterInfo &mi);
double totalEnergyConsumption(Unit u);
double currentPeriodEnergyConsumption(Unit u);
double previousPeriodEnergyConsumption(Unit u);
private:
void processContent(Telegram *t);
double total_energy_kwh_ {};
double curr_energy_kwh_ {};
double prev_energy_kwh_ {};
};
unique_ptr<HeatMeter> createCompact5(MeterInfo &mi)
{
return unique_ptr<HeatMeter>(new MeterCompact5(mi));
}
MeterCompact5::MeterCompact5(MeterInfo &mi) :
MeterCommonImplementation(mi, MeterType::COMPACT5, MANUFACTURER_TCH)
{
addMedia(0x04); // C telegrams
addMedia(0xC3); // T telegrams
addLinkMode(LinkMode::C1);
addLinkMode(LinkMode::T1);
addExpectedVersion(0x45);
addPrint("total", Quantity::Energy,
[&](Unit u){ return totalEnergyConsumption(u); },
"The total energy consumption recorded by this meter.",
true, true);
addPrint("current", Quantity::Energy,
[&](Unit u){ return currentPeriodEnergyConsumption(u); },
"Energy consumption so far in this billing period.",
true, true);
addPrint("previous", Quantity::Energy,
[&](Unit u){ return previousPeriodEnergyConsumption(u); },
"Energy consumption in previous billing period.",
true, true);
}
double MeterCompact5::totalEnergyConsumption(Unit u)
{
assertQuantity(u, Quantity::Energy);
return convert(total_energy_kwh_, Unit::KWH, u);
}
double MeterCompact5::currentPeriodEnergyConsumption(Unit u)
{
assertQuantity(u, Quantity::Energy);
return convert(curr_energy_kwh_, Unit::KWH, u);
}
double MeterCompact5::previousPeriodEnergyConsumption(Unit u)
{
assertQuantity(u, Quantity::Energy);
return convert(prev_energy_kwh_, Unit::KWH, u);
}
void MeterCompact5::processContent(Telegram *t)
{
// Unfortunately, the Techem Compact V is mostly a proprieatary protocol
// simple wrapped inside a wmbus telegram since the ci-field is 0xa2.
// Which means that the entire payload is manufacturer specific.
map<string,pair<int,DVEntry>> vendor_values;
vector<uchar> content;
t->extractPayload(&content);
uchar prev_lo = content[3];
uchar prev_hi = content[4];
double prev = (256.0*prev_hi+prev_lo)/1000;
string prevs;
strprintf(prevs, "%02x%02x", prev_lo, prev_hi);
int offset = t->parsed.size()+3;
vendor_values["0215"] = { offset, DVEntry(MeasurementType::Instantaneous, 0x15, 0, 0, 0, prevs) };
t->explanations.push_back({ offset, prevs });
t->addMoreExplanation(offset, " energy used in previous billing period (%f KWH)", prev);
uchar curr_lo = content[7];
uchar curr_hi = content[8];
double curr = (256.0*curr_hi+curr_lo)/1000;
string currs;
strprintf(currs, "%02x%02x", curr_lo, curr_hi);
offset = t->parsed.size()+7;
vendor_values["0215"] = { offset, DVEntry(MeasurementType::Instantaneous, 0x15, 0, 0, 0, currs) };
t->explanations.push_back({ offset, currs });
t->addMoreExplanation(offset, " energy used in current billing period (%f KWH)", curr);
total_energy_kwh_ = prev+curr;
curr_energy_kwh_ = curr;
prev_energy_kwh_ = prev;
}

Wyświetl plik

@ -1,5 +1,5 @@
/*
Copyright (C) 2017-2019 Fredrik Öhrström
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

Wyświetl plik

@ -30,6 +30,7 @@
X(apator08, T1_bit, Water, APATOR08, Apator08) \
X(apator162, C1_bit|T1_bit, Water, APATOR162, Apator162) \
X(cma12w, C1_bit|T1_bit, TempHygro, CMA12W, CMa12w) \
X(compact5, T1_bit, Heat, COMPACT5, Compact5) \
X(ebzwmbe, T1_bit, Electricity, EBZWMBE, EBZWMBE) \
X(eurisii, T1_bit, HeatCostAllocation, EURISII, EurisII) \
X(ehzp, T1_bit, Electricity, EHZP, EHZP) \
@ -221,12 +222,14 @@ struct GenericMeter : public virtual Meter {
string toMeterName(MeterType mt);
MeterType toMeterType(string& type);
LinkModeSet toMeterLinkModeSet(string& type);
unique_ptr<WaterMeter> createMultical21(MeterInfo &m);
unique_ptr<WaterMeter> createFlowIQ3100(MeterInfo &m);
unique_ptr<HeatMeter> createMultical302(MeterInfo &m);
unique_ptr<HeatMeter> createMultical403(MeterInfo &m);
unique_ptr<HeatMeter> createVario451(MeterInfo &m);
unique_ptr<WaterMeter> createWaterstarM(MeterInfo &m);
unique_ptr<HeatMeter> createCompact5(MeterInfo &m);
unique_ptr<ElectricityMeter> createOmnipower(MeterInfo &m);
unique_ptr<ElectricityMeter> createAmiplus(MeterInfo &m);
unique_ptr<WaterMeter> createSupercom587(MeterInfo &m);