Add ERT SCM protocol decoder
This commit is contained in:
parent
4f57c2f880
commit
84fb94bcb6
9 changed files with 121 additions and 1 deletions
|
@ -224,6 +224,7 @@ Read the Test Data section at the bottom.
|
|||
[146] Auriol AFW2A1 temperature/humidity sensor
|
||||
[147] TFA Drop Rain Gauge 30.3233.01
|
||||
[148] DSC Security Contact (WS4945)
|
||||
[149] ERT SCM
|
||||
|
||||
* Disabled by default, use -R n or -G
|
||||
|
||||
|
|
|
@ -334,6 +334,7 @@ stop_after_successful_events false
|
|||
protocol 146 # Auriol AFW2A1 temperature/humidity sensor
|
||||
protocol 147 # TFA Drop Rain Gauge 30.3233.01
|
||||
protocol 148 # DSC Security Contact (WS4945)
|
||||
protocol 149 # ERT SCM
|
||||
|
||||
## Flex devices (command line option "-X")
|
||||
|
||||
|
|
|
@ -155,7 +155,8 @@
|
|||
DECL(ws2032) \
|
||||
DECL(auriol_afw2a1) \
|
||||
DECL(tfa_drop_303233) \
|
||||
DECL(dsc_security_ws4945)
|
||||
DECL(dsc_security_ws4945) \
|
||||
DECL(ert_amr)
|
||||
|
||||
/* Add new decoders here. */
|
||||
|
||||
|
|
|
@ -571,6 +571,9 @@ TFA Drop Rain Gauge 30.3233.01
|
|||
.TP
|
||||
[ \fB148\fI\fP ]
|
||||
DSC Security Contact (WS4945)
|
||||
.TP
|
||||
[ \fB149\fI\fP ]
|
||||
ERT SCM
|
||||
|
||||
* Disabled by default, use \-R n or \-G
|
||||
.SS "Input device selection"
|
||||
|
|
|
@ -60,6 +60,7 @@ add_library(r_433 STATIC
|
|||
devices/elro_db286a.c
|
||||
devices/elv.c
|
||||
devices/emontx.c
|
||||
devices/ert.c
|
||||
devices/esa.c
|
||||
devices/esic_emt7110.c
|
||||
devices/esperanza_ews.c
|
||||
|
|
|
@ -59,6 +59,7 @@ rtl_433_SOURCES = abuf.c \
|
|||
devices/elro_db286a.c \
|
||||
devices/elv.c \
|
||||
devices/emontx.c \
|
||||
devices/ert.c \
|
||||
devices/esa.c \
|
||||
devices/esic_emt7110.c \
|
||||
devices/esperanza_ews.c \
|
||||
|
|
108
src/devices/ert.c
Normal file
108
src/devices/ert.c
Normal file
|
@ -0,0 +1,108 @@
|
|||
/** @file
|
||||
ERT SCM sensors
|
||||
|
||||
Copyright (C) 2020 Benjamin Larsson.
|
||||
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "decoder.h"
|
||||
|
||||
/**
|
||||
Random information:
|
||||
|
||||
https://github.com/bemasher/rtlamr
|
||||
|
||||
https://en.wikipedia.org/wiki/Encoder_receiver_transmitter
|
||||
|
||||
https://patentimages.storage.googleapis.com/df/23/d3/f0c33d9b2543ff/WO2007030826A2.pdf
|
||||
|
||||
96-bit Itron® Standard Consumption Message protocol
|
||||
https://www.smartmetereducationnetwork.com/uploads/how-to-tell-if-I-have-a-ami-dte-smart-advanced-meter/Itron%20Centron%20Meter%20Technical%20Guide1482163-201106090057150.pdf (page 28)
|
||||
|
||||
SAAA AAAA AAAA AAAA AAAA A
|
||||
|
||||
S - Sync bit
|
||||
A - Preamble
|
||||
|
||||
iiR PPTT TTEE CCCC CCCC CCCC CCCC CCCC CCCC IIII IIII IIII IIII IIII IIII XXXX XXXX XXXX XXXX
|
||||
|
||||
i - ERT ID Most Significant bits
|
||||
R - Reserved
|
||||
P - Physical tamper
|
||||
T - ERT Type (4 and 7 are mentioned in the pdf)
|
||||
E - Encoder Tamper
|
||||
C - Consumption data
|
||||
I - ERT ID Least Significant bits
|
||||
X - CRC (polynomial 0x6F63)
|
||||
|
||||
https://web.archive.org/web/20090828043201/http://www.openamr.org/wiki/ItronERTModel45
|
||||
|
||||
*/
|
||||
|
||||
static int ert_decode(r_device *decoder, bitbuffer_t *bitbuffer)
|
||||
{
|
||||
static const uint8_t ERT_PREAMBLE[] = {/*0xF*/ 0x2A, 0x60};
|
||||
unsigned int bit_offset;
|
||||
uint8_t *b;
|
||||
uint8_t physical_tamper, ert_type, encoder_tamper;
|
||||
uint32_t consumption_data, ert_id;
|
||||
data_t *data;
|
||||
|
||||
if (bitbuffer->bits_per_row[0] != 96)
|
||||
return DECODE_ABORT_LENGTH;;
|
||||
|
||||
b = bitbuffer->bb[0];
|
||||
if (crc16(&b[2], 10, 0x6F63, 0))
|
||||
return DECODE_FAIL_MIC;
|
||||
|
||||
/* Instead of detecting the preamble we rely on the
|
||||
* CRC and extract the parameters from the back */
|
||||
|
||||
/* Extract parameters */
|
||||
physical_tamper = (b[3]&0xC0) >> 6;
|
||||
ert_type = (b[3]&0x60) >> 2;
|
||||
encoder_tamper = b[3]&0x03;
|
||||
consumption_data = (b[4]<<16) | (b[5]<<8) | b[6];
|
||||
ert_id = ((b[2]&0x06)<<23) | (b[7]<<16) | (b[8]<<8) | b[9];
|
||||
|
||||
/* clang-format off */
|
||||
data = data_make(
|
||||
"model", "", DATA_STRING, "ERT-SCM",
|
||||
"id", "Id", DATA_INT, ert_id,
|
||||
"physical_tamper", "Physical Tamper", DATA_INT, physical_tamper,
|
||||
"ert_type", "ERT Type", DATA_INT, ert_type,
|
||||
"encoder_tamper", "Encoder Tamper", DATA_INT, encoder_tamper,
|
||||
"consumption_data","Consumption Data", DATA_INT, consumption_data,
|
||||
"mic", "Integrity", DATA_STRING, "CRC",
|
||||
NULL);
|
||||
/* clang-format on */
|
||||
|
||||
decoder_output_data(decoder, data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static char *output_fields[] = {
|
||||
"model",
|
||||
"id",
|
||||
"physical_tamper",
|
||||
"ert_type",
|
||||
"encoder_tamper",
|
||||
"consumption_data",
|
||||
NULL,
|
||||
};
|
||||
|
||||
r_device ert_amr = {
|
||||
.name = "ERT",
|
||||
.modulation = OOK_PULSE_MANCHESTER_ZEROBIT,
|
||||
.short_width = 30,
|
||||
.long_width = 30,
|
||||
.gap_limit = 0,
|
||||
.reset_limit = 64,
|
||||
.decode_fn = &ert_decode,
|
||||
.disabled = 0,
|
||||
.fields = output_fields,
|
||||
};
|
|
@ -175,6 +175,7 @@
|
|||
<ClCompile Include="..\src\devices\elro_db286a.c" />
|
||||
<ClCompile Include="..\src\devices\elv.c" />
|
||||
<ClCompile Include="..\src\devices\emontx.c" />
|
||||
<ClCompile Include="..\src\devices\ert.c" />
|
||||
<ClCompile Include="..\src\devices\esa.c" />
|
||||
<ClCompile Include="..\src\devices\esic_emt7110.c" />
|
||||
<ClCompile Include="..\src\devices\esperanza_ews.c" />
|
||||
|
|
|
@ -286,6 +286,9 @@
|
|||
<ClCompile Include="..\src\devices\emontx.c">
|
||||
<Filter>Source Files\devices</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\devices\ert.c">
|
||||
<Filter>Source Files\devices</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\devices\esa.c">
|
||||
<Filter>Source Files\devices</Filter>
|
||||
</ClCompile>
|
||||
|
|
Loading…
Add table
Reference in a new issue