Skip to main content

0x01 Counter1 - Daily Archive (legacy)

The packet contains a counter's readings for one day with a 1-hour step.

Timestamp Initial value FLAGS DIFF DATA
4B 4B 2B bit array
FieldSize, bytesValue
Timestamp4uint32_t (value + 946684800 = UNIX time stamp)
Init value4Value at the interval beginning
FLAGS2See below
DIFF DATAvariableDifferential data

FLAGS​

BitFlag MeaningDescription
0 … 4NDifferential data bits ([0 … 31] + 1)
5DIV10/ 10 DIFF
6RLEBIT RLE COMPRESSION
7SIGNEDDIFF SIGNED
8 … 13REC_NUMNumber of entries (up to 64)
14RESOLIndividual bit
15ALL_DIFF_ZEROCounter did not change, all DIFF=0. In this case, the block DIFF_DATA is missing

RESOL=1​

In the Differential data field the data are of variable length as a bitmap using the run-length encoding – RLE. In this case – zeros. There are four possible data blocks in this package. The individually dimensioned block (if the RESOL bit is set in the flags) is used to make changes to the device settings:

One block
Bit DesignationDescriptionDIFF BLOCKDIFF BLOCK...
0Variable length flagif 0: like in previous block (if this is the first block, so N)
if 1: set in the next 5 bits
1…5Number of bits per differential dataPresents if bit 0 = 1
...is followed by either a zeros repetition block or a block of difference (see below)

RLE=1​

Zero repetition block (set Bit RLE in flags), which serves to reduce / compress the amount of data:

BitDesignationDescription
0RLEalways 1
1…5repeat valueentries repeats with diff=0, ([0 … 31] + 1)

After the zeros repetition block, a variable-length flag is NOT added, but the value that was before the variable-length block (variable-length flag) is used.

Difference block if Bit RLE in flags is set:

BitDesignationDescription
0RLEAlways 0
N bitsdiff valuedifference from the previous value, character if the SIGNED flag is set;
needs to be multiplied by 10 if Flag DIV10 is set

RLE=0​

Difference block if Bit RLE in flags is NOT set:

BitDesignationDescription
N bitsdiff valuedifference from the previous value, character if the SIGNED flag is set;
needs to be multiplied by 10 if Flag DIV10 is set

Playground​

Output will appear here...