Add three more register sizes in the apator162 driver.

pull/963/head
Fredrik Öhrström 2023-05-12 09:28:41 +02:00
rodzic acaf159f33
commit 15aba2318f
3 zmienionych plików z 46 dodań i 30 usunięć

Wyświetl plik

@ -60,3 +60,13 @@ telegram=|6E4401062020202705077A3D0060852F2F|0F|151794|94|0A0200|43|0403|81|D87F
telegram=|3E4401061405410305077A190030852F2F|0F|86B4B8|95|290200|40|C6C1|B4|F0F3F3|41|5559|42|FA701000|F0|01010000|10|BC780000|FFFFFFFFFFFFFFFFFFFFFF2483|
{"media":"water","meter":"apator162","name":"MyTapWaterf","id":"03410514","total_m3":30.908,"timestamp":"1111-11-11T11:11:11Z"}
|MyTapWaterf;03410514;30.908;1111-11-11 11:11.11
# Yet another
telegram=|3C4401061111441105077A280030852F2F|0F|064CB597180200|43|A0068300055A2D69610156BB0C101B1208007101A60AC5AA6DE6A5F0880E9ADD08393C|
{"id": "11441111", "media": "water", "meter": "apator162", "name": "MyTapWaterg", "timestamp": "1111-11-11T11:11:11Z", "total_m3": 528.923}
|MyTapWaterg;11441111;528.923;1111-11-11 11:11.11
# Yet another
telegram=|3E4401060403820305077A090030852F2F0F9B5B229700000044C2DED310A25500007201C64A0000853C000094310000A0464B1904FFFFFFFFFFFFFFFF2ED6|
{"id": "03820304", "media": "water", "meter": "apator162", "name": "MyTapWaterh", "timestamp": "1111-11-11T11:11:11Z", "total_m3": 21.922 }
|MyTapWaterh;03820304;21.922;1111-11-11 11:11.11

Wyświetl plik

@ -89,7 +89,7 @@ namespace
if (c == 0xff) break; // An FF signals end of telegram padded to encryption boundary,
// FFFFFFF623A where 4 last are perhaps crc or counter?
i++;
if (size == -1 || i+size >= content.size())
if (size == -1 || i+size > content.size())
{
vector<uchar> frame;
t->extractFrame(&frame);
@ -150,7 +150,10 @@ namespace
case 0x42: return 4; // Energy
case 0x43: return 2; // Life days - In default frame f.ex. 43 6E 0A -> 2670 days from first run
case 0x71: return 9;
case 0x44: return 3;
case 0x71: return 1+2*8; // ?
case 0x72: return 1+3*4; // ?
case 0x73: return 1+4*4; // Historical data
case 0x75: return 1+6*4; // Historical data
case 0x7B: return 1+12*4; // Historical data
@ -160,11 +163,12 @@ namespace
case 0x82:
case 0x83:
case 0x84:
case 0x85:
case 0x86:
case 0x87: return 10; // Events
case 0x85:
case 0x88:
case 0x88: return 6;
case 0x8F: return 11; // Events
case 0x8A: return 9; // Events

Wyświetl plik

@ -16,7 +16,9 @@ METERS="Wasser apator162 20202020 NOKEY
MyTapWatere apator162 25202020 NOKEY
MyTapWatere apator162 26202020 NOKEY
MyTapWatere apator162 27202020 NOKEY
MyTapWaterf apator162 03410514 NOKEY"
MyTapWaterf apator162 03410514 NOKEY
MyTapWaterg apator162 11441111 NOKEY
MyTapWaterh apator162 03820304 NOKEY"
cat simulations/simulation_apas.txt | grep '^{' | jq --sort-keys . > $TEST/test_expected.txt
$PROG --format=json simulations/simulation_apas.txt $METERS 2> $TEST/test_stderr.txt | jq --sort-keys . > $TEST/test_output.txt