kopia lustrzana https://github.com/weetmuts/wmbusmeters
Added warning when T1 telegram is encrypted and no key was supplied.
rodzic
ffa60e8be9
commit
d60493ee45
|
@ -122,7 +122,7 @@ Supported heat cost allocator:
|
|||
Qundis Q caloric (qcaloric)
|
||||
|
||||
Work in progress:
|
||||
Water meter Apator wt-wmbus-16-2 (apator162)
|
||||
Water meter Apator at-wmbus-16-2 (apator162)
|
||||
Heat meter Kamstrup Multical 302 (multical302)
|
||||
Electricity meter Kamstrup Omnipower (omnipower)
|
||||
```
|
||||
|
|
|
@ -25,7 +25,7 @@ telegram=|25442D2C785634121b048D2093E13CBA20|0000790000000000000000000000000000|
|
|||
|
||||
# Test Omnipower C1 telegrams
|
||||
|
||||
telegram=|1E442D2C0771941501027A|B300108504833B08340500|
|
||||
telegram=|1E442D2C0771941501027AB3001080|04833B08340500|
|
||||
{"media":"electricity","meter":"omnipower","name":"MyElectricity","id":"15947107","total_kwh":341.000000,"current_kw":"0.000000","timestamp":"1111-11-11T11:11:11Z"}
|
||||
|
||||
# Test QCaloric C1 telegrams
|
||||
|
|
|
@ -8,7 +8,7 @@ telegram=|A244EE4D111111113C077AAC000000|0C1389490000426CE1F14C130000000082046C2
|
|||
|
||||
# Test iPerl T1 telegram, after decryption, its got 2f2f markers.
|
||||
|
||||
telegram=|1E44AE4C9956341268077A36001005|2F2F0413181E0000023B00002F2F2F2F|
|
||||
telegram=|1E44AE4C9956341268077A36001000|2F2F0413181E0000023B00002F2F2F2F|
|
||||
{"media":"water","meter":"iperl","name":"MoreWater","id":"12345699","total_m3":7.704000,"max_flow_m3h":0.000000,"timestamp":"1111-11-11T11:11:11Z"}
|
||||
|
||||
# Test iPerl T1 telegram not encrypted, no 2f2f markers.
|
||||
|
|
|
@ -100,7 +100,7 @@ Supported heat cost allocator:
|
|||
Qundis Q caloric (qcaloric)
|
||||
|
||||
Work in progress:
|
||||
Water meter Apator at-wmbus-16-2
|
||||
Water meter Apator at-wmbus-16-2 (apator162)
|
||||
Heat meter Kamstrup Multical 302 (multical302)
|
||||
Electricity meter Kamstrup Omnipower (omnipower)
|
||||
)MANUAL";
|
||||
|
|
|
@ -107,6 +107,9 @@ void MeterApator162::handleTelegram(Telegram *t)
|
|||
t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
warning("(apator162) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
vector<uchar> aeskey = key();
|
||||
decryptMode5_AES_CBC(t, aeskey);
|
||||
|
|
|
@ -109,6 +109,9 @@ void MeterIperl::handleTelegram(Telegram *t)
|
|||
t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
warning("(iperl) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
vector<uchar> aeskey = key();
|
||||
decryptMode5_AES_CBC(t, aeskey);
|
||||
|
|
|
@ -84,6 +84,9 @@ void MeterMultical302::handleTelegram(Telegram *t) {
|
|||
t->a_field_address[0], t->a_field_address[1], t->a_field_address[2],
|
||||
t->a_field_address[3]);
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
warning("(multical302) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
vector<uchar> aeskey = key();
|
||||
decryptMode1_AES_CTR(t, aeskey);
|
||||
|
|
|
@ -83,6 +83,9 @@ void MeterOmnipower::handleTelegram(Telegram *t) {
|
|||
manufacturerFlag(t->m_field).c_str(), t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
warning("(omnipower) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
vector<uchar> aeskey = key();
|
||||
decryptMode5_AES_CBC(t, aeskey);
|
||||
|
|
|
@ -98,6 +98,9 @@ void MeterQCaloric::handleTelegram(Telegram *t) {
|
|||
manufacturerFlag(t->m_field).c_str(), t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
warning("(qcaloric) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
vector<uchar> aeskey = key();
|
||||
decryptMode5_AES_CBC(t, aeskey);
|
||||
|
|
|
@ -107,6 +107,9 @@ void MeterSupercom587::handleTelegram(Telegram *t)
|
|||
t->a_field_version);
|
||||
}
|
||||
|
||||
if (t->isEncrypted() && !useAes()) {
|
||||
warning("(supercom587) warning: telegram is encrypted but no key supplied!\n");
|
||||
}
|
||||
if (useAes()) {
|
||||
vector<uchar> aeskey = key();
|
||||
decryptMode5_AES_CBC(t, aeskey);
|
||||
|
|
20
src/wmbus.cc
20
src/wmbus.cc
|
@ -351,7 +351,7 @@ void Telegram::addMoreExplanation(int pos, const char* fmt, ...)
|
|||
for (auto& p : explanations) {
|
||||
if (p.first == pos) {
|
||||
if (p.second[0] == '*') {
|
||||
warning("(wmbus) warning! already added more explanations to offset %d!\n");
|
||||
debug("(wmbus) warning: already added more explanations to offset %d!\n");
|
||||
}
|
||||
p.second = string("* ")+p.second+buf;
|
||||
found = true;
|
||||
|
@ -359,7 +359,7 @@ void Telegram::addMoreExplanation(int pos, const char* fmt, ...)
|
|||
}
|
||||
|
||||
if (!found) {
|
||||
warning("(wmbus) warning! cannot find offset %d to add more explanation \"%s\"\n", pos, buf);
|
||||
debug("(wmbus) warning: cannot find offset %d to add more explanation \"%s\"\n", pos, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -403,8 +403,20 @@ void Telegram::parse(vector<uchar> &frame)
|
|||
addExplanation(bytes, 1, "%02x acc", acc);
|
||||
status = frame[12];
|
||||
addExplanation(bytes, 1, "%02x status ()", status);
|
||||
configuration = frame[13]<<8 | frame[14];
|
||||
addExplanation(bytes, 2, "%02x%02x configuration ()", frame[13], frame[14]);
|
||||
config_field = frame[13]<<8 | frame[14];
|
||||
string config_info = "";
|
||||
if (config_field & 0x0f) {
|
||||
config_info += "encrypted ";
|
||||
is_encrypted_ = true;
|
||||
}
|
||||
if ((config_field & 0x0f) == 0 || (config_field & 0x0f) == 0x05) {
|
||||
if ((config_field & 0x0f) == 0x05) config_info += "AES_CBC ";
|
||||
if (config_field & 0x80) config_info += "bidirectional ";
|
||||
if (config_field & 0x40) config_info += "accessibility ";
|
||||
if (config_field & 0x20) config_info += "synchronous ";
|
||||
}
|
||||
if (config_info.length() > 0) config_info.pop_back();
|
||||
addExplanation(bytes, 2, "%02x%02x config (%s)", frame[13], frame[14], config_info.c_str());
|
||||
header_size = 4;
|
||||
} else
|
||||
if (ci_field == 0x8d || ci_field == 0x8c) {
|
||||
|
|
|
@ -79,7 +79,7 @@ struct Telegram {
|
|||
// When ci_field==0x7a then there are 4 extra header bytes, short data header
|
||||
int acc {}; // 1 byte
|
||||
int status {}; // 1 byte
|
||||
int configuration {}; // 2 bytes
|
||||
int config_field {}; // 2 bytes
|
||||
|
||||
// When ci_field==0x8d then there are 8 extra header bytes (ELL header)
|
||||
int cc_field {}; // 1 byte
|
||||
|
@ -105,6 +105,12 @@ struct Telegram {
|
|||
void addExplanation(vector<uchar>::iterator &bytes, int len, const char* fmt, ...);
|
||||
void addMoreExplanation(int pos, const char* fmt, ...);
|
||||
void explainParse(string intro, int from);
|
||||
|
||||
bool isEncrypted() { return is_encrypted_; }
|
||||
|
||||
private:
|
||||
|
||||
bool is_encrypted_ {};
|
||||
};
|
||||
|
||||
struct WMBus {
|
||||
|
|
Ładowanie…
Reference in New Issue