rscada/libmbus

mbus-serial-request-data only gets correct data if mbus-serial-request-data-multi-reply is called before

Opened this issue · 2 comments

when reading a sontex heat outlet with command line tools I found a strange behaviour:

  • mbus-serial-request-data returns 18 records with only entries with unit 'Volume' - makes no sense to me
  • mbus-serial-request-data-multi-reply returns 102 records
  • after the execution of mbus-serial-request-data-multi-reply all subsequent reads with mbus-serial-request-data return correct result: 24 records with all correct informations

And if mbus-serial-request-data-multi-reply is executed again, the whole thing starts from the beginning...

For me it's the same with the following hardware:

  • Relay M-Bus Mikro-Master
  • Zensus C5-ISF Meter

If i first do
mbus-serial-request-data-multi-reply -b 2400 /dev/ttyUSB0 2
i get the output, see:
01_mbus-serial-request-data-multi-reply.log

Afterwards I do
mbus-serial-request-data -b 2400 /dev/ttyUSB0 2
and get:
02_mbus-serial-request-data.log

But without doing the first command, or by doing the command twice, at least the following information is missing in when calling mbus-serial-request-data -b 2400 /dev/ttyUSB0 2:

 <DataRecord id="9">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Flow temperature (1e-2 deg C)</Unit>
        <Value>2972</Value>
        <Timestamp>2021-03-05T21:34:14Z</Timestamp>
    </DataRecord>

    <DataRecord id="10">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Return temperature (1e-2 deg C)</Unit>
        <Value>2261</Value>
        <Timestamp>2021-03-05T21:34:14Z</Timestamp>
    </DataRecord>

    <DataRecord id="11">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Temperature Difference (1e-2  deg C)</Unit>
        <Value>711</Value>
        <Timestamp>2021-03-05T21:34:14Z</Timestamp>
    </DataRecord>

    <DataRecord id="12">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Power (100 W)</Unit>
        <Value>0</Value>
        <Timestamp>2021-03-05T21:34:14Z</Timestamp>
    </DataRecord>

    <DataRecord id="13">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume flow (m m^3/h)</Unit>
        <Value>0</Value>
        <Timestamp>2021-03-05T21:34:14Z</Timestamp>
    </DataRecord>

    <DataRecord id="14">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Time Point (time &amp; date)</Unit>
        <Value>2021-03-05T22:14:00</Value>
        <Timestamp>2021-03-05T21:34:14Z</Timestamp>
    </DataRecord>

    <DataRecord id="15">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Operating time (hours)</Unit>
        <Value>12975</Value>
        <Timestamp>2021-03-05T21:34:14Z</Timestamp>
    </DataRecord>

I can proof the basic solution to send a rest to the respective device address working. I basically only added the lines here and left "Init_slaves" as is.

Apollon77/node-mbus@95d02e1#diff-e8fba70aee8fbbcfc020c8266880774a1f474f09f3f8c5ffb5a1a76254712038R305-R320