Added support for lansen door/window sensor.

pull/133/head
Fredrik Öhrström 2020-06-30 11:29:55 +02:00
rodzic 3d9c10bd05
commit 3a7931fd07
8 zmienionych plików z 166 dodań i 1 usunięć

Wyświetl plik

@ -124,6 +124,7 @@ METER_OBJS:=\
$(BUILD)/meter_hydrodigit.o \
$(BUILD)/meter_iperl.o \
$(BUILD)/meter_izar.o \
$(BUILD)/meter_lansendw.o \
$(BUILD)/meter_lansensm.o \
$(BUILD)/meter_lansenth.o \
$(BUILD)/meter_mkradio3.o \

Wyświetl plik

@ -231,6 +231,9 @@ Elvaco CMa12w Thermometer (cma12w)
Supported smoke detectors:
Lansen Smoke Detector (lansensm)
Supported door/window detectors:
Lansen Door/Window Detector (lansendw)
Supported electricity meters:
Tauron Amiplus (amiplus) (includes vendor apator and echelon)
EMH Metering (ehzp)

Wyświetl plik

@ -64,6 +64,16 @@ telegram=|2e44333003020100071b7a634820252f2f0265840842658308820165950802fb1aae01
{"media":"room sensor","meter":"lansenth","name":"Tempoo","id":"00010203","current_temperature_c":21.8,"current_relative_humidity_rh":43,"average_temperature_1h_c":21.79,"average_relative_humidity_1h_rh":43,"average_temperature_24h_c":21.97,"average_relative_humidity_24h_rh":42.5,"timestamp":"1111-11-11T11:11:11Z"}
|Tempoo;00010203;21.800000;43.000000;1111-11-11 11:11.11
# Test Lansen door window telegram
telegram=|2e44333005020100071d7ab54800002f2f02fd1b110002fd971d01000efd3a2200000000008e40fd3a000000000000|
{"media":"reserved","meter":"lansensm","name":"Dooro","id":"00010205","status":"CLOSED","timestamp":"1111-11-11T11:11:11Z"}
|Dooro;00010205;CLOSED;1111-11-11 11:11.11
telegram=|2e44333005020100071d7ab66800002f2f02fd1b550002fd971d01000efd3a2300000000008e40fd3a000000000000|
{"media":"reserved","meter":"lansensm","name":"Dooro","id":"00010205","status":"OPEN","timestamp":"1111-11-11T11:11:11Z"}
|Dooro;00010205;OPEN;1111-11-11 11:11.11
# Test BMEters RFM-AMB Temperature Hygrometer telegram
telegram=|5744b40988227711101b7ab20800000265a00842658f088201659f08226589081265a0086265510852652b0902fb1aba0142fb1ab0018201fb1abd0122fb1aa90112fb1aba0162fb1aa60152fb1af501066d3b3bb36b2a00|

Wyświetl plik

@ -0,0 +1,136 @@
/*
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"
#define INFO_CODE_CLOSED 0x0011
#define INFO_CODE_OPEN 0x0055
struct MeterLansenDW : public virtual DoorWindowDetector, public virtual MeterCommonImplementation {
MeterLansenDW(WMBus *bus, MeterInfo &mi);
string status();
bool open();
private:
void processContent(Telegram *t);
private:
uint16_t info_codes_ {};
};
MeterLansenDW::MeterLansenDW(WMBus *bus, MeterInfo &mi) :
MeterCommonImplementation(bus, mi, MeterType::LANSENSM, MANUFACTURER_LAS)
{
setExpectedTPLSecurityMode(TPLSecurityMode::AES_CBC_IV);
addMedia(0x1d);
addLinkMode(LinkMode::T1);
addExpectedVersion(0x07);
addPrint("status", Quantity::Text,
[&](){ return status(); },
"The current status: OPEN or CLOSED.",
true, true);
}
unique_ptr<DoorWindowDetector> createLansenDW(WMBus *bus, MeterInfo &mi)
{
return unique_ptr<DoorWindowDetector>(new MeterLansenDW(bus, mi));
}
bool MeterLansenDW::open()
{
return info_codes_ == INFO_CODE_OPEN;
}
void MeterLansenDW::processContent(Telegram *t)
{
/*
(wmbus) 11: 02 dif (16 Bit Integer/Binary Instantaneous value)
(wmbus) 12: FD vif (Second extension of VIF-codes)
(wmbus) 13: 1B vife (Digital Input (binary))
(wmbus) 14: 1100
(wmbus) 16: 02 dif (16 Bit Integer/Binary Instantaneous value)
(wmbus) 17: FD vif (Second extension of VIF-codes)
(wmbus) 18: 97 vife (Error flags (binary))
(wmbus) 19: 1D vife (Response delay time [bittimes])
(wmbus) 1a: 0100
(wmbus) 1c: 0E dif (12 digit BCD Instantaneous value)
(wmbus) 1d: FD vif (Second extension of VIF-codes)
(wmbus) 1e: 3A vife (Dimensionless / no VIF)
(wmbus) 1f: 220000000000
(wmbus) 25: 8E dif (12 digit BCD Instantaneous value)
(wmbus) 26: 40 dife (subunit=1 tariff=0 storagenr=0)
(wmbus) 27: FD vif (Second extension of VIF-codes)
(wmbus) 28: 3A vife (Dimensionless / no VIF)
(wmbus) 29: 000000000000
*/
/*
(wmbus) 11: 02 dif (16 Bit Integer/Binary Instantaneous value)
(wmbus) 12: FD vif (Second extension of VIF-codes)
(wmbus) 13: 1B vife (Digital Input (binary))
(wmbus) 14: 5500
(wmbus) 16: 02 dif (16 Bit Integer/Binary Instantaneous value)
(wmbus) 17: FD vif (Second extension of VIF-codes)
(wmbus) 18: 97 vife (Error flags (binary))
(wmbus) 19: 1D vife (Response delay time [bittimes])
(wmbus) 1a: 0100
(wmbus) 1c: 0E dif (12 digit BCD Instantaneous value)
(wmbus) 1d: FD vif (Second extension of VIF-codes)
(wmbus) 1e: 3A vife (Dimensionless / no VIF)
(wmbus) 1f: 230000000000
(wmbus) 25: 8E dif (12 digit BCD Instantaneous value)
(wmbus) 26: 40 dife (subunit=1 tariff=0 storagenr=0)
(wmbus) 27: FD vif (Second extension of VIF-codes)
(wmbus) 28: 3A vife (Dimensionless / no VIF)
(wmbus) 29: 000000000000
*/
int offset;
extractDVuint16(&t->values, "02FD1B", &offset, &info_codes_);
t->addMoreExplanation(offset, " info codes (%s)", status().c_str());
}
string MeterLansenDW::status()
{
string s;
if (info_codes_ == INFO_CODE_OPEN)
{
s.append("OPEN");
}
else if (info_codes_ == INFO_CODE_CLOSED)
{
s.append("CLOSED");
}
else
{
s.append("ERR");
}
return s;
}

Wyświetl plik

@ -223,7 +223,7 @@ bool MeterCommonImplementation::isTelegramForMe(Telegram *t)
}
if (!media_match) {
warning("(meter) %s: probably not for me since media does not match\n", name_.c_str());
warning("(meter) %s: probably not for me since received media 0x%02x does not match\n", name_.c_str(), t->dll_type);
}
debug("(meter) %s: yes for me\n", name_.c_str());

Wyświetl plik

@ -42,6 +42,7 @@
X(izar, T1_bit, Water, IZAR, Izar) \
X(lansensm, T1_bit, SmokeDetector, LANSENSM, LansenSM) \
X(lansenth, T1_bit, TempHygro, LANSENTH, LansenTH) \
X(lansendw, T1_bit, DoorWindow, LANSENDW, LansenDW) \
X(mkradio3, T1_bit, Water, MKRADIO3, MKRadio3) \
X(multical21, C1_bit, Water, MULTICAL21, Multical21) \
X(multical302,C1_bit, Heat, MULTICAL302, Multical302) \
@ -199,6 +200,12 @@ struct SmokeDetector : public virtual Meter
virtual ~SmokeDetector() = default;
};
struct DoorWindowDetector : public virtual Meter
{
virtual bool open() = 0;
virtual ~DoorWindowDetector() = default;
};
struct GenericMeter : public virtual Meter {
};
@ -225,6 +232,7 @@ unique_ptr<HeatCostMeter> createEurisII(WMBus *bus, MeterInfo &m);
unique_ptr<HeatCostMeter> createFHKVDataIII(WMBus *bus, MeterInfo &m);
unique_ptr<TempHygroMeter> createLansenTH(WMBus *bus, MeterInfo &m);
unique_ptr<SmokeDetector> createLansenSM(WMBus *bus, MeterInfo &m);
unique_ptr<DoorWindowDetector> createLansenDW(WMBus *bus, MeterInfo &m);
unique_ptr<TempHygroMeter> createCMa12w(WMBus *bus, MeterInfo &m);
unique_ptr<TempHygroMeter> createRfmAmb(WMBus *bus, MeterInfo &m);
unique_ptr<WaterMeter> createRfmTX1(WMBus *bus, MeterInfo &m);

Wyświetl plik

@ -57,6 +57,12 @@ Received telegram from: 00010204
Received telegram from: 00010203
manufacturer: (LAS) Lansen Systems, Sweden
device type: Room sensor (eg temperature or humidity)
Received telegram from: 00010205
manufacturer: (LAS) Lansen Systems, Sweden
device type: Reserved for sensors
Received telegram from: 00010205
manufacturer: (LAS) Lansen Systems, Sweden
device type: Reserved for sensors
Received telegram from: 11772288
manufacturer: (BMT) BMETERS, Italy
device type: Room sensor (eg temperature or humidity)

Wyświetl plik

@ -19,6 +19,7 @@ METERS="MyWarmWater supercom587 12345678 NOKEY
HeatMeter eurisii 88018801 NOKEY
Smokeo lansensm 00010204 NOKEY
Tempoo lansenth 00010203 NOKEY
Dooro lansendw 00010205 NOKEY
Rummet rfmamb 11772288 NOKEY
IzarWater izar 21242472 NOKEY
IzarWater2 izar 66290778 NOKEY