GithubHelp home page GithubHelp logo

rscada / libmbus Goto Github PK

View Code? Open in Web Editor NEW
217.0 217.0 137.0 1.16 MB

Meter-bus library and utility programs

Home Page: http://www.rscada.se/libmbus

License: BSD 3-Clause "New" or "Revised" License

C 95.88% Shell 1.76% XSLT 0.51% Roff 0.07% Makefile 1.49% M4 0.29%

libmbus's People

Contributors

aleax avatar andershub4 avatar apollon77 avatar arska avatar deimi avatar f-skold avatar fredrik-sk avatar gocarlos avatar gumulka avatar jakubovsky avatar lategoodbye avatar lvogt avatar mhei avatar nikitross avatar petrkr avatar rscada avatar strongly-typed avatar tmtom avatar trsqr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libmbus's Issues

LandisGyr G350 48bit date/time field?

Hi,
I'm working with a Landis+Gyr G350 gas meter and it seems to send a 48bit (6 byte) date-time structure. Libmbus only recognizes the 2 byte (F) and 4 byte (G) data types and I cannot find any documentation about this 6 byte structure. Does anyone know how to decode this field or what goes wrong in parsing of the data.

This is (part of) the data messages that I get with the debug option of the mbus-serial-request-data function:
68 40 40 68 08 01 72 58 20 08 12 E2 30 40 03 F1 00 00 00 // header
2F 2F // idle filler
4C 13 84 40 83 10 // gass value
46 6D 00 00 09 14 27 00 // date-time
0D 78 11 34 31 38 35 30 32 38 30 32 31 39 35 37 31 30 30 47 // fabrication number (string)
.......

Thanks.

Missing symbol

Moved
http://www.freescada.com/public-dist/libmbus1_0.7.0-1_i386.deb

to boo12 (Connected to fsdemo.freescada.com)

more /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=9.10
DISTRIB_CODENAME=karmic
DISTRIB_DESCRIPTION="Ubuntu 9.10"

Got

mbus-serial-scan-secondary -h
mbus-serial-scan-secondary: symbol lookup error: mbus-serial-scan-secondary: undefined symbol: mbus_connect_serial

Kamstrup Multical 302

Hello all, i have a Kamstrup multical 302 and i have trouble reading from it or even locating it in my network, but all other 3 Kamstrup Multical 602 are located without trouble, could someone please help me out real quick what it could be?

I have tried swapping the connections on the m-bus as well, i know they are polarity independent but it was worth a try.

best regards,
Ado

AMT Aquametro CALEC MB

Hello all, i am guessing my values are a bit off with the infinite decimals i got :P could someone please help me out

This is my output:

<MBusData>

    <SlaveInformation>
        <Id>4526402</Id>
        <Manufacturer>AMT</Manufacturer>
        <Version>128</Version>
        <ProductName>Aquametro CALEC MB</ProductName>
        <Medium>Heat: Outlet</Medium>
        <AccessNumber>156</AccessNumber>
        <Status>00</Status>
        <Signature>FFFF</Signature>
    </SlaveInformation>

    <DataRecord id="0">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Energy (100 Wh)</Unit>
        <Value>7620560</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="1">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume (1e-1  m^3)</Unit>
        <Value>41011158</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="2">
        <Function>Instantaneous value</Function>
        <StorageNumber>1</StorageNumber>
        <Unit>Time Point (date)</Unit>
        <Value>2016-06-30</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="3">
        <Function>Instantaneous value</Function>
        <StorageNumber>1</StorageNumber>
        <Unit>Energy (100 Wh)</Unit>
        <Value>7329205</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="4">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>On time (hours)</Unit>
        <Value>95868</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="5">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Power (kW)</Unit>
        <Value>11174.887695</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="6">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume flow ( m^3/h)</Unit>
        <Value>305.355103</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="7">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Flow temperature (deg C)</Unit>
        <Value>115.947960</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="8">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Return temperature (deg C)</Unit>
        <Value>83.715706</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="9">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Temperature Difference ( deg C)</Unit>
        <Value>32.232254</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="10">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Time Point (time &amp; date)</Unit>
        <Value>2016-12-08T11:55:00</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="11">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Energy (1e-1 Wh)</Unit>
        <Value>7620560125091</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="12">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume (my m^3)</Unit>
        <Value>4101115816150</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="13">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume (m m^3)</Unit>
        <Value>10.000000</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="14">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume (m m^3)</Unit>
        <Value>1.000000</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="15">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Error flags</Unit>
        <Value>8192</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

    <DataRecord id="16">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Energy (Wh)</Unit>
        <Value>1.135396</Value>
        <Timestamp>2016-12-08T09:59:36</Timestamp>
    </DataRecord>

</MBusData>

In hex:

init_slaves: debug: sending init frame #1
[2016-12-08 10:04:54] SEND (005): 10 40 FD 3D 16
init_slaves: debug: sending init frame #2
[2016-12-08 10:04:54] SEND (005): 10 40 FD 3D 16
[2016-12-08 10:04:54] SEND (005): 10 7B 01 7C 16
[2016-12-08 10:04:55] RECV (128): 68 7A 7A 68 08 01 72 02 64 52 04 B4 05 80 04 9D 00 FF FF 04 85 7D DA 47 74 00 04 15 E4 C8 71 02 42 6C 1E 26 44 85 7D B5 D5 6F 00 03 22 7C 76 01 05 2E 5B 9C 2F 46 05 3E 75 94 99 43 05 5B EB C9 E7 42 05 5F F8 55 A7 42 05 63 E6 E7 00 42 04 6D 00 0C 08 2C 06 02 C3 AF 60 4D EE 06 06 10 95 25 29 DF BA 03 05 93 28 00 00 20 41 05 93 29 00 00 80 3F 02 FD 17 00 20 05 83 33 3B 55 91 3F 93 16
mbus_frame_print: Dumping M-Bus frame [type 4, 128 bytes]: 68 7A 7A 68 08 01 72 02 64 52 04 B4 05 80 04 9D 00 FF FF 04 85 7D DA 47 74 00 04 15 E4 C8 71 02 42 6C 1E 26 44 85 7D B5 D5 6F 00 03 22 7C 76 01 05 2E 5B 9C 2F 46 05 3E 75 94 99 43 05 5B EB C9 E7 42 05 5F F8 55 A7 42 05 63 E6 E7 00 42 04 6D 00 0C 08 2C 06 02 C3 AF 60 4D EE 06 06 10 95 25 29 DF BA 03 05 93 28 00 00 20 41 05 93 29 00 00 80 3F 02 FD 17 00 20 05 83 33 3B 55 91 3F 93 16 

I can se that the temperature is way off with that many decimals so everything else must be off as well? Maybe even wrong values?

Thanks for all the help guys!

Best regards,
Ado

DataRecord date issue

<DataRecord id="3"> <Function>Instantaneous value</Function> <StorageNumber>1</StorageNumber> <Unit>Time Point (date)</Unit> <Value>2127-15-31</Value> <Timestamp>2017-03-29T12:18:07</Timestamp> </DataRecord>
Value far in the future. Seems like somethere offset is wrong. It happens on in this place.

Raspberry Pi

Good work, for the libmbus.
It works fine in ubuntu.

Have you an idea how to install libmbus on Raspberry Pi (Raspbian ARM)

The basic installation does not work.

I think it would be a perfect fit between an arduino and a pc to handle m-bus data.

Validation of manufacturer id

According to comment in mbus/mbus-protocol.c:50
I think that mbus_manufacturer_id(char *manufacturer) function should check generated id in the following way:
(0x0421 >= id && id <= 0x6b5a) ? id : 0
Now a ternary operator condition use two less than or equal symbols instead of one.

Failed to recieve M-Bus response frame

Hello.

Every time I try to connect to the Meter ("Gossen Metrawatt") for the first time after turning on, I get the following error, using the function mbus_read_slave:

[2015-06-26 08:32:54] SEND (005): 10 40 FD 3D 16
[2015-06-26 08:32:55] SEND (005): 10 40 FD 3D 16
[2015-06-26 08:32:55] SEND (005): 10 5B 04 5F 16
mbus_read_slave: Failed to receive M-Bus response frame.
init_slaves: debug: sending init frame #1
init_slaves: debug: sending init frame #2
M-bus data parse error: Got null pointer to frame, data or zero data_size.

I can only recieve the frame if I first run a query via the Windows configuration tool MBCONF. Afterwards everything works as expected.

[2015-06-26 08:43:22] SEND (005): 10 40 FD 3D 16
[2015-06-26 08:43:22] SEND (005): 10 40 FD 3D 16
[2015-06-26 08:43:23] SEND (005): 10 5B 04 5F 16
[2015-06-26 08:43:24] RECV (210): 68 CC CC 68 08 04 72 73 16 00 00 A3 1D 02 02 01 20 00 00
01 FF 54 01 02 FF 52 05 00 01
FD DC FF 64 01 01 FF 61 00
01 FF 62 00 06 FF 63 00 00 01 00 00 00 86 10 82 FF 80 FF 00 34 A2 01 00 00 00 86 10 82 FF 81
FF 00 B4 71 00 00 00 00 86 20 82 FF 80 FF 00 00 00 00 00 00 00 86 20 82 FF 81 FF 00 00 00 00
00 00 00 86 90 00 FF 93 FF 10 03 4E 00 00 00 00 86 90 00 FF 93 FF 20 67 51 00 00
00 00 86 A0 00 FF 93 FF 10 00 00 00 00 00 00 86 A0 00 FF 93 FF 20 00 00 00 00 00 00 86 90 00
FF 93 FF 30 45 69 00 00 00 00 86 90 00 FF 93 FF 40 95 20 00 00 00 00 86 A0 00 FF 93 FF 30 00
00 00 00 00 00 86 A0 00 FF 93 FF 40 00 00 00 00 00 00 0F AC 16
init_slaves: debug: sending init frame #1
init_slaves: debug: sending init frame #2
mbus_frame_print: Dumping M-Bus frame [type 4, 210 bytes]: 68 CC CC 68 08 04 72 73 16 00 00
A3 1D 02 02 01 20 00 00 01 FF 54 01 02 FF 52 05 00 01 FD DC FF 64 01 01 FF 61 00 01 FF 62
00 06 FF 63 00 00 01 00 00 00 86 10 82 FF 80 FF 00 34 A2 01 00 00 00 86 10 82 FF 81 FF 00 B4
71 00 00 00 00 86 20 82 FF 80 FF 00 00 00 00 00 00 00 86 20 82 FF 81 FF 00 00 00 00 00 00 00
86 90 00 FF 93 FF 10 03 4E 00 00 00 00 86 90 00 FF 93 FF 20 67 51 00 00 00 00 86 A0 00 FF 93
FF 10 00 00 00 00 00 00 86 A0 00 FF 93 FF 20 00 00 00 00 00 00 86 90 00 FF 93 FF 30 45 69 00
00 00 00 86 90 00 FF 93 FF 40 95 20 00 00 00 00 86 A0 00 FF 93 FF 30 00 00 00 00 00 00 86 A0
00 FF 93 FF 40 00 00 00 00 00 00 0F AC 16 
<?xml version="1.0" encoding="ISO-8859-1"?>
<MBusData>

    <SlaveInformation>
        <Id>1673</Id>
        <Manufacturer>GMC</Manufacturer>
        <Version>2</Version>
        <ProductName>Firmware Version 2</ProductName>
        <Medium>Electricity</Medium>
        <AccessNumber>1</AccessNumber>
        <Status>20</Status>
        <Signature>0000</Signature>
    </SlaveInformation>

    <DataRecord id="0">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit></Unit>
        <Quantity>Manufacturer specific</Quantity>
        <Value>1.000000</Value>
    </DataRecord>

    <DataRecord id="1">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit></Unit>
        <Quantity>Manufacturer specific</Quantity>
        <Value>5.000000</Value>
    </DataRecord>

    <DataRecord id="2">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>A</Unit>
        <Quantity>Current</Quantity>
        <Value>1.000000</Value>
    </DataRecord>

    <DataRecord id="3">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit></Unit>
        <Quantity>Manufacturer specific</Quantity>
        <Value>0.000000</Value>
    </DataRecord>

(Many Data records)
....

</MBusData>

The libmbus app itself is running on a Wago 750-8202 SPS. Hope you can give me a hand on this error, as I don't know if the problem is the libmbus or the meter itself.

python libmbus

I want to call the bash command from python. I got a response but not that well formated as i'm doing the command directly in bash. Is this normal?

The response from python script:
[2017-07-26 11:34:48] SEND (005): 10 40 FD 3D 16 [2017-07-26 11:34:48] SEND (005): 10 40 FD 3D 16 [2017-07-26 11:34:49] SEND (005): 10 5B 0A 65 16 [2017-07-26 11:34:49] RECV (136): 68 82 82 68 08 0A 72 10 00 00 00 2D 2C 01 04 46 00 00 00 0C 07 50 77 40 00 0C 16 01 52 08 00 0C 22 65 17 03 00 0C 59 30 27 00 00 0C 5D 91 25 00 00 0C 61 39 01 00 00 0C 2E 00 00 00 00 0C 3C 00 00 00 00 4C 07 10 71 32 00 4C 16 51 85 06 00 42 6C 1F 2C 0F 10 00 00 00 00 00 62 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 41 04 00 00 00 00 02 26 07 17 00 32 16
Without xml formating...
But response directly from bash:

`init_slaves: debug: sending init frame #1
[2017-07-26 11:34:17] SEND (005): 10 40 FD 3D 16
init_slaves: debug: sending init frame #2
[2017-07-26 11:34:17] SEND (005): 10 40 FD 3D 16
[2017-07-26 11:34:17] SEND (005): 10 5B 0A 65 16
[2017-07-26 11:34:18] RECV (136): 68 82 82 68 08 0A 72 10 00 00 00 2D 2C 01 04 45 00 00 00 0C 07 50 77 40 00 0C 16 01 52 08 00 0C 22 65 17 03 00 0C 59 30 27 00 00 0C 5D 91 25 00 00 0C 61 39 01 00 00 0C 2E 00 00 00 00 0C 3C 00 00 00 00 4C 07 10 71 32 00 4C 16 51 85 06 00 42 6C 1F 2C 0F 10 00 00 00 00 00 62 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 41 04 00 00 00 00 02 26 07 17 00 31 16
mbus_frame_print: Dumping M-Bus frame [type 4, 136 bytes]: 68 82 82 68 08 0A 72 10 00 00 00 2D 2C 01 04 45 00 00 00 0C 07 50 77 40 00 0C 16 01 52 08 00 0C 22 65 17 03 00 0C 59 30 27 00 00 0C 5D 91 25 00 00 0C 61 39 01 00 00 0C 2E 00 00 00 00 0C 3C 00 00 00 00 4C 07 10 71 32 00 4C 16 51 85 06 00 42 6C 1F 2C 0F 10 00 00 00 00 00 62 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 41 04 00 00 00 00 02 26 07 17 00 31 16

<SlaveInformation>
    <Id>10</Id>
    <Manufacturer>KAM</Manufacturer>
    <Version>1</Version>
    <ProductName>Kamstrup 382 (6850-005)</ProductName>
    <Medium>Heat: Outlet</Medium>
    <AccessNumber>69</AccessNumber>
    <Status>00</Status>
    <Signature>0000</Signature>
</SlaveInformation>

<DataRecord id="0">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (10 kWh)</Unit>
    <Value>407750</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="1">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Volume ( m^3)</Unit>
    <Value>85201</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="2">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>On time (hours)</Unit>
    <Value>31765</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="3">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Flow temperature (1e-2 deg C)</Unit>
    <Value>2730</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="4">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Return temperature (1e-2 deg C)</Unit>
    <Value>2591</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="5">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Temperature Difference (1e-2  deg C)</Unit>
    <Value>139</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="6">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Power (kW)</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="7">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Volume flow (1e-2  m^3/h)</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="8">
    <Function>Instantaneous value</Function>
    <StorageNumber>1</StorageNumber>
    <Unit>Energy (10 kWh)</Unit>
    <Value>327110</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="9">
    <Function>Instantaneous value</Function>
    <StorageNumber>1</StorageNumber>
    <Unit>Volume ( m^3)</Unit>
    <Value>68551</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="10">
    <Function>Instantaneous value</Function>
    <StorageNumber>1</StorageNumber>
    <Unit>Time Point (date)</Unit>
    <Value>2016-12-31</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>

<DataRecord id="11">
    <Function>Manufacturer specific</Function>
    <Value>10 00 00 00 00 00 62 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 41 04 00 00 00 00 02 26 07 17 00</Value>
    <Timestamp>2017-07-26T11:34:18</Timestamp>
</DataRecord>
`

I'm doing:
`#!/usr/bin/python

from xml.dom import minidom
from pdb import set_trace as bkp
import subprocess

bashCommand = "mbus-serial-request-data -d -b 2400 /dev/serial0 10"
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
output, error = process.communicate()

#mbusdata = minidom.parseString(output)
`

Maybe little thinking problem...thx for support.

not receiving multi replies from SEC Meter

When I read out the Meter after having connected with MBSheet, the first response is complete with over 70 Records and frame count. Afterwards with the same command I only get the first 33 (see log). Can you give me a hint where to look at?

I am running a raspberry pi 3B -> Tibbo Ehternet/Serial Converter -> Relay PW250 -> Multiple Meters
This specific is SchneiderElectric.

One thing I can see in Record 21 is the unrecognized VIF extension. The following values shouldn't be zero. Thanks for any help!

mbus-tcp-request-data-multi-reply -d 193.193.193.203 1001 29
init_slaves: debug: sending init frame #1
[2017-07-27 08:35:03] SEND (005): 10 40 FD 3D 16
init_slaves: debug: sending init frame #2
[2017-07-27 08:35:07] SEND (005): 10 40 FD 3D 16
[2017-07-27 08:35:11] SEND (005): 10 7B 1D 98 16
[2017-07-27 08:35:12] RECV (247): 68 F1 F1 68 08 1D 72 18 30 02 34 A3 4C 15 02 B5 00 00 00 02 FF 34 00 00 05 FF 35 00 00 80 3F 02 FF 36 00 00 02 FF 37 00 00 02 FF 38 00 00 04 ED FF 39 00 00 01 01 05 FF 3A 00 00 C0 FF 06 FF 20 19 FD DB 00 00 00 03 FF 21 03 00 00 03 FF 22 04 00 00 03 FF 23 0B 00 00 03 FF 24 32 00 00 05 03 0E 59 72 46 05 83 FF 09 00 00 00 00 85 40 03 71 69 48 46 85 40 83 FF 09 00 00 00 00 05 83 FF 0D 0D 59 72 46 85 40 83 FF 0D 71 69 48 46 05 83 FF 01 AE 07 D6 45 05 83 FF 02 C7 62 82 45 05 83 FF 03 A2 47 8C 45 05 FD 61 00 00 00 00 85 10 03 00 00 00 00 85 20 03 00 00 00 00 85 30 03 00 00 00 00 85 80 10 03 00 00 00 00 03 FF 25 00 00 00 05 FF 26 00 00 C8 42 03 FF 27 64 00 00 03 FF 28 03 00 00 03 FF 29 64 00 00 03 FF 2A 01 00 00 03 FF 2B 00 00 00 0F F3 16
mbus_frame_print: Dumping M-Bus frame [type 4, 247 bytes]: 68 F1 F1 68 08 1D 72 18 30 02 34 A3 4C 15 02 B5 00 00 00 02 FF 34 00 00 05 FF 35 00 00 80 3F 02 FF 36 00 00 02 FF 37 00 00 02 FF 38 00 00 04 ED FF 39 00 00 01 01 05 FF 3A 00 00 C0 FF 06 FF 20 19 FD DB 00 00 00 03 FF 21 03 00 00 03 FF 22 04 00 00 03 FF 23 0B 00 00 03 FF 24 32 00 00 05 03 0E 59 72 46 05 83 FF 09 00 00 00 00 85 40 03 71 69 48 46 85 40 83 FF 09 00 00 00 00 05 83 FF 0D 0D 59 72 46 85 40 83 FF 0D 71 69 48 46 05 83 FF 01 AE 07 D6 45 05 83 FF 02 C7 62 82 45 05 83 FF 03 A2 47 8C 45 05 FD 61 00 00 00 00 85 10 03 00 00 00 00 85 20 03 00 00 00 00 85 30 03 00 00 00 00 85 80 10 03 00 00 00 00 03 FF 25 00 00 00 05 FF 26 00 00 C8 42 03 FF 27 64 00 00 03 FF 28 03 00 00 03 FF 29 64 00 00 03 FF 2A 01 00 00 03 FF 2B 00 00 00 0F F3 16

<SlaveInformation>
    <Id>34023018</Id>
    <Manufacturer>SEC</Manufacturer>
    <Version>21</Version>
    <ProductName></ProductName>
    <Medium>Electricity</Medium>
    <AccessNumber>181</AccessNumber>
    <Status>00</Status>
    <Signature>0000</Signature>
</SlaveInformation>

<DataRecord id="0">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="1">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>1.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="2">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="3">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="4">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="5">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Time Point (time &amp; date)</Unit>
    <Value>2000-01-01T00:00:00</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="6">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>-nan</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="7">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>14417177</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="8">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>3</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="9">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>4</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="10">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>11</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="11">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>50</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="12">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (Wh)</Unit>
    <Value>15510.263672</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="13">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (Wh)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="14">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>0</Tariff>
    <Device>1</Device>
    <Unit>Energy (Wh)</Unit>
    <Value>12826.360352</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="15">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>0</Tariff>
    <Device>1</Device>
    <Unit>Energy (Wh)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="16">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (Wh)</Unit>
    <Value>15510.262695</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="17">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>0</Tariff>
    <Device>1</Device>
    <Unit>Energy (Wh)</Unit>
    <Value>12826.360352</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="18">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (Wh)</Unit>
    <Value>6848.959961</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="19">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (Wh)</Unit>
    <Value>4172.347168</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="20">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (Wh)</Unit>
    <Value>4488.954102</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="21">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Unrecognized VIF extension: 0x61</Unit>
    <Value>0.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="22">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>1</Tariff>
    <Device>0</Device>
    <Unit>Energy (Wh)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="23">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>2</Tariff>
    <Device>0</Device>
    <Unit>Energy (Wh)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="24">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>3</Tariff>
    <Device>0</Device>
    <Unit>Energy (Wh)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="25">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>4</Tariff>
    <Device>0</Device>
    <Unit>Energy (Wh)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="26">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="27">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>100.000000</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="28">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>100</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="29">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>3</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="30">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>100</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="31">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>1</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="32">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

<DataRecord id="33">
    <Function>Manufacturer specific</Function>
    <Value></Value>
    <Timestamp>2017-07-27T08:35:12</Timestamp>
</DataRecord>

Not able to find Meter with VMware ESXi

Hello,

i'm having some trouble with getting libmbus to work.
Host for Libmbus : Ubuntu 16.04
Level Converter : HD67020-B2-10 from ADFWEB
Meter: GWF Water Meter

Issue looks like : #24

The Solution marked there is changing the behavior due to the echo from the level converter:

I've tried all three options in the "mbus-protocol-auc.c" file at line 1523:

handle->purge_first_frame = MBUS_FRAME_PURGE_S2M;

The behavior doesn't change at all.

With the free software from Relay (MBSHEET) the meter can be found and read without any problems.

Maybe it's just a handling problem on my side.... any help is appreciated !

See also attached console output:

mbus-serial-scan -d -b 2400 /dev/ttyUSB0 Scanning primary addresses: 0 [2016-08-14 15:42:57] SEND (005): 10 40 00 40 16 [2016-08-14 15:42:58] RECV (005): 10 40 00 40 16 1 [2016-08-14 15:42:58] SEND (005): 10 40 01 41 16 [2016-08-14 15:42:58] RECV (005): 10 40 01 41 16 2 [2016-08-14 15:42:58] SEND (005): 10 40 02 42 16 [2016-08-14 15:42:58] RECV (005): 10 40 02 42 16 3 [2016-08-14 15:42:58] SEND (005): 10 40 03 43 16 [2016-08-14 15:42:58] RECV (005): 10 40 03 43 16 4 [2016-08-14 15:42:58] SEND (005): 10 40 04 44 16 [2016-08-14 15:42:58] RECV (005): 10 40 04 44 16 5 [2016-08-14 15:42:58] SEND (005): 10 40 05 45 16 [2016-08-14 15:42:58] RECV (005): 10 40 05 45 16
Thank you for your help !

Expose file descriptor for select()-style asynchronous polling

Hi all,

I've been asked to write a comms driver for M-Bus and looking around, this seems to be the best supported library for doing so. The system we use reports data over AMQP (Advanced Message Queueing Protocol; specifically RabbitMQ). This protocol requires we send heartbeats on a regular basis, otherwise we get booted from the server.

Looking at libmbus, it looks to be a synchronous library. Now, I could whack it into a thread, get it blocking on a queue that I feed with requests, then it passes back replies.

An alternative implementation would be to take the file descriptor, then use epoll or select to wait on the serial port file descriptor/socket for data. Asynchronous frameworks like Tornado and Twisted in Python have good support for this. Then when I get told there's data waiting, I can then call the libmbus functions to do the actual reading.

In the meantime, I'm able to respond to requests without the IO loop blocking.

Has there been any thought into exposing a file descriptor for use with functions like select to enable asynchronous programming?

Libtoolize and automake trouble

Hi,
I'm having trouble installing the library on Raspberry Pi 3.

I start with downloading the zip and unzip it, cd to the directory and then

autoheader && aclocal && libtoolize --ltdl --copy --force && automake --add-missing --copy && autoconf

After this it says:

Consider using 'AC_CONFIG_AUX_DIR([libtdl/config])' in configure.ac.

automake: warnings are treated as errors
/usr/share/automake-1.14/am/ltllibrary.am: warning: 'libmbus.la': linking libtool libraries using a non-POSIX
/usr/share/automake-1.14/am/ltllibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'
mbus/Makefile.am16: while processing Libtool library 'libmbus.la'


Anyone can help me with these errors?

Im thankful for any help.

Greetings,

Max

mbus-tcp-request-data / mbus-tcp-request-data-multi-reply

Here I have a ABB CEM 05100 reading a B23 212-100 meter.
mbus-tcp-request-data is working perfectly, however mbus-tcp-request-data-multi-reply failed to receive any data.
When I login into the web interface of the CEM I can see a lot more frames. Any idea?

mbus-tcp-request-data-multi-reply -d 192.168.2.43 6021 1 int init_slaves(mbus_handle *): debug: sending init frame #1 [2016-03-28 06:55:01] SEND (005): 10 40 FD 3D 16 int init_slaves(mbus_handle *): debug: sending init frame #2 [2016-03-28 06:55:06] SEND (005): 10 40 FD 3D 16 [2016-03-28 06:55:06] SEND (005): 10 7B 01 7C 16 int mbus_sendrecv_request(mbus_handle *, int, mbus_frame *, int): Failed to receive M-Bus response frame. Failed to send/receive M-Bus request.

`mbus-tcp-request-data -d 192.168.2.43 6021 1 [2016-03-28 06:55:19] SEND (005): 10 7B 01 7C 16
[2016-03-28 06:55:20] RECV (149): 68 8F 8F 68 08 01 72 83 52 07 00 42 04 20 02 36 20 00 00 0E 84 00 03 00 00 00 00 00 8E 40 84 00 00 00 00 00 00 00 04 FF A0 15 00 00 00 00 04 FF A1 15 00 00 00 00 04 FF A2 15 00 00 00 00 04 FF A3 15 00 00 00 00 07 FF A6 00 00 00 00 00 00 00 00 00 07 FF A7 00 06 00 00 00 00 00 00 00 07 FF A8 00 00 00 B6 21 1B 00 00 00 07 FF A9 00 B0 0D D9 00 00 00 00 00 0D FD 8E 00 07 30 2E 37 31 2E 31 42 0D FF AA 00 0B 30 30 31 2D 32 31 32 20 33 32 42 1F 26 16
int mbus_frame_print(mbus_frame *): Dumping M-Bus frame [type 4, 149 bytes]: 68 8F 8F 68 08 01 72 83 52 07 00 42 04 20 02 36 20 00 00 0E 84 00 03 00 00 00 00 00 8E 40 84 00 00 00 00 00 00 00 04 FF A0 15 00 00 00 00 04 FF A1 15 00 00 00 00 04 FF A2 15 00 00 00 00 04 FF A3 15 00 00 00 00 07 FF A6 00 00 00 00 00 00 00 00 00 07 FF A7 00 06 00 00 00 00 00 00 00 07 FF A8 00 00 00 B6 21 1B 00 00 00 07 FF A9 00 B0 0D D9 00 00 00 00 00 0D FD 8E 00 07 30 2E 37 31 2E 31 42 0D FF AA 00 0B 30 30 31 2D 32 31 32 20 33 32 42 1F 26 16

<SlaveInformation>
    <Id>75283</Id>
    <Manufacturer>ABB</Manufacturer>
    <Version>32</Version>
    <ProductName></ProductName>
    <Medium>Electricity</Medium>
    <AccessNumber>54</AccessNumber>
    <Status>20</Status>
    <Signature>0000</Signature>
</SlaveInformation>

<DataRecord id="0">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (10 Wh)</Unit>
    <Value>3</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="1">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Tariff>0</Tariff>
    <Device>1</Device>
    <Unit>Energy (10 Wh)</Unit>
    <Value>0</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="2">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="3">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="4">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="5">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="6">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>0</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="7">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>6</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="8">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>116529692672</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="9">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>14224816</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="10">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Firmware version</Unit>
    <Value>B1.17.0</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="11">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Manufacturer specific</Unit>
    <Value>B23 212-100</Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

<DataRecord id="12">
    <Function>More records follow</Function>
    <Value></Value>
    <Timestamp>2016-03-28T06:55:20</Timestamp>
</DataRecord>

`

Question about secondary scan / may be an issue ?

Hallo, I'm new with the libmbus and with mbus at all. I stepped through the code and found one point, that could be an issue, but may be I did not understand how the mbus protocol works: So lets explain my irritation:
Within the function mbus_scan_2nd_address_range(mbus_handle * handle, int pos, char *addr_mask) all positions (16 "letters" each 4 bit) are stepped through and (when no other mask is given) will be probed with a wildcard "F" to see if a slave is connected which address matches.
The first 8 positions (or lets say letters) contain the BCD encoded ID of the meter. Therefore if more than one meter is responding (collision case) all possibilities of this letters is probed again with all possile variants, that means with '0' to '9'. Thats right, thats fine and I understand this. Now follows my irritation: The next 8 letters are hex encoded, e.g. the manufacturer ID, the medium and the version. Here follows some examples:
00032629B5151002 for the EMU 3/75 professional
00202909CD4E0904 for the Elster F4
01305532CD4E0804 for the Elster F2
04990254C5140006 for the Engelmann WaterStar
As anybody can clearlay see, the letters 0..7 are BCD encoded but the letter 8..15 are hex encoded.
The letters 8..15 are probed too with the letter possibilities 0..9, but in my thinking they shall be probed with the possibilities 0..9 plus A..F.
So when I'm right in reality in some combinations some meters shall not be found with the scan of the function mbus_scan_2nd_address_range(). Whats wrong with my thinking or is there really a bug within this function?
Thanks in advance for checking my idea.

M-Bus tcp transport layer response timeout has been reached

We are using libmbus to read data from an Elster H5000 water meter via CMe3000 tcp gateway. But most request fails after a few seconds with an error. Only 1/3 of requests succeeds.

"Failed to receive M-Bus response frame: M-Bus tcp transport layer response timeout has been reached."

I located the error message to

mbus_error_str_set("M-Bus tcp transport layer response timeout has been reached.");
but I don't have a clue why it's happening. Since it works occasionally my guess is that it'a a timeout problem. What do you think? Any help appreciated.

https://www.elstermetering.com/en/product-detail/470/en/H5000
https://www.elvaco.se/en/product/infrastructure1/cme3000-m-bus-gateway-for-fixed-network--1050015

Costum VIFE Handling

Hello.

My Issue is more of a question I suppose. I have a special meter whit lots of costum VIFE's. When I run the normal scan application most units are printed out as manufacturer specific.

What would be the right way to patch this in? My first try to add them to the function "mbus_vib_unit_lookup" in mbus-protocol.c resulted in printing only the last VIFE, when there are more then one in the telegram.

Greetings

Unrecognized VIF extension: 0x01

Using a Engelmann SensoStar 2C we get a Unrecognized VIF extension: 0x01 from measures corresponding to energy in MWh
Tracing VIFE decoding routine, I think there is an error in this function because don't cover al cases defined on 8.4.4 section of MBus spec.

Test frame of this device is:
68 A6 A6 68 08 00 72 56 03 88 32 C5 14 01 04 62
00 00 00 04 78 E4 B6 F5 01 04 6D 1A 16 D3 11 04
16 5C 16 01 00 04 FB 01 36 01 00 00 84 20 FB 01
00 00 00 00 84 30 FB 01 00 00 00 00 04 3E 52 00
00 00 04 2E 8A 01 00 00 02 5B 36 00 02 5F 32 00
04 61 A4 01 00 00 02 27 C3 00 01 FD 17 10 04 90
28 40 42 0F 00 42 6C BF 1C 44 16 DD AE 00 00 44
FB 01 CB 00 00 00 C4 20 FB 01 00 00 00 00 C4 30
FB 01 00 00 00 00 82 01 6C 00 00 84 01 16 00 00
00 00 84 01 FB 01 00 00 00 00 84 21 FB 01 00 00
00 00 84 31 FB 01 00 00 00 00 F7 16

Implementing M-bus into an ultrasonic flow meter

I want to have wired m-bus protocol in my designed water flow meter. Could you please help me and give me some stating point! I already studied EN 13757-2 and EN 13757-3. What is the next step for implementing m-bus in a STM32 microcontroller.

Wireless MBUS

Is there any way of implementing this with the wireless version of MBUS?

Having compiled it on a Raspberry Pi using an Amber USB dongle, theres clearly some communication between the two: when I run 'mbus-serial-scan /dev/ttyUSB0', the Amber dongle flashes as its polling for devices, but never finds any.

Equally, when I request serial data, it fails to receive a response frame.

Would be great to implement since it bypasses the need for the level converter circuitry to be built.

Reading Endress Hauser RMS621 M-Bus

Hello guys, i am having issues reading this meter.

Link to meter: http://www.uk.endress.com/en/Tailor-made-field-instrumentation/System-Components-Recorder-Data-Manager/energy-manager-RMS621

Check the output :)

Reading 1:

<SlaveInformation>
    <Id>28336</Id>
    <Manufacturer>EAH</Manufacturer>
    <Version>2</Version>
    <ProductName></ProductName>
    <Medium>Bus/System</Medium>
    <AccessNumber>15</AccessNumber>
    <Status>00</Status>
    <Signature>0000</Signature>
</SlaveInformation>

<DataRecord id="0">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Time Point (time &amp; date)</Unit>
    <Value>2016-03-31T17:02:00</Value>
    <Timestamp>2016-03-31T15:03:21</Timestamp>
</DataRecord>

<DataRecord id="1">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Volume flow ( m^3/h)</Unit>
    <Value>166659104.000000</Value>
    <Timestamp>2016-03-31T15:03:21</Timestamp>
</DataRecord>

<DataRecord id="2">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Flow temperature (deg C)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2016-03-31T15:03:21</Timestamp>
</DataRecord>

<DataRecord id="3">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Return temperature (deg C)</Unit>
    <Value>-27733311640882380800.000000</Value>
    <Timestamp>2016-03-31T15:03:21</Timestamp>
</DataRecord>

<DataRecord id="4">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (kWh)</Unit>
    <Value>-0.000000</Value>
    <Timestamp>2016-03-31T15:03:21</Timestamp>
</DataRecord>

Reading2:

<SlaveInformation>
    <Id>28336</Id>
    <Manufacturer>EAH</Manufacturer>
    <Version>2</Version>
    <ProductName></ProductName>
    <Medium>Bus/System</Medium>
    <AccessNumber>3</AccessNumber>
    <Status>00</Status>
    <Signature>0000</Signature>
</SlaveInformation>

<DataRecord id="0">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Time Point (time &amp; date)</Unit>
    <Value>2016-03-31T17:06:00</Value>
    <Timestamp>2016-03-31T15:07:21</Timestamp>
</DataRecord>

<DataRecord id="1">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Volume flow ( m^3/h)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2016-03-31T15:07:21</Timestamp>
</DataRecord>

<DataRecord id="2">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Flow temperature (deg C)</Unit>
    <Value>-0.000000</Value>
    <Timestamp>2016-03-31T15:07:21</Timestamp>
</DataRecord>

<DataRecord id="3">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Return temperature (deg C)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2016-03-31T15:07:21</Timestamp>
</DataRecord>

<DataRecord id="4">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (kWh)</Unit>
    <Value>-19056912498688.000000</Value>
    <Timestamp>2016-03-31T15:07:21</Timestamp>
</DataRecord>

The ID=4 isn't even kWh, it's Mw but shows kWh? Also.. negative value?

Also when i scan for the meter it keeps changing meter place? Very weird. It is set to address 1.

Scanning primary addresses:
0 [2016-03-31 15:07:52] SEND (005): 10 40 00 40 16
1 [2016-03-31 15:07:52] SEND (005): 10 40 01 41 16
[2016-03-31 15:07:52] RECV (001): E5
Found a M-Bus device at address 1
2 [2016-03-31 15:07:52] SEND (005): 10 40 02 42 16
3 [2016-03-31 15:07:52] SEND (005): 10 40 03 43 16
4 [2016-03-31 15:07:52] SEND (005): 10 40 04 44 16
5 [2016-03-31 15:07:53] SEND (005): 10 40 05 45 16
6 [2016-03-31 15:07:53] SEND (005): 10 40 06 46 16
7 [2016-03-31 15:07:53] SEND (005): 10 40 07 47 16
8 [2016-03-31 15:07:53] SEND (005): 10 40 08 48 16
9 [2016-03-31 15:07:54] SEND (005): 10 40 09 49 16
10 [2016-03-31 15:07:54] SEND (005): 10 40 0A 4A 16

But comes also up as:

Scanning primary addresses:
0 [2016-03-31 15:08:21] SEND (005): 10 40 00 40 16
1 [2016-03-31 15:08:21] SEND (005): 10 40 01 41 16
2 [2016-03-31 15:08:22] SEND (005): 10 40 02 42 16
3 [2016-03-31 15:08:22] SEND (005): 10 40 03 43 16
[2016-03-31 15:08:22] RECV (001): E5
Found a M-Bus device at address 3
4 [2016-03-31 15:08:22] SEND (005): 10 40 04 44 16
5 [2016-03-31 15:08:22] SEND (005): 10 40 05 45 16
6 [2016-03-31 15:08:23] SEND (005): 10 40 06 46 16
7 [2016-03-31 15:08:23] SEND (005): 10 40 07 47 16
8 [2016-03-31 15:08:23] SEND (005): 10 40 08 48 16

Debug output:

mbus-serial-request-data -d -b 2400 /dev/ttyUSB0 1
init_slaves: debug: sending init frame #1
[2016-03-31 15:14:21] SEND (005): 10 40 FD 3D 16
init_slaves: debug: sending init frame #2
[2016-03-31 15:14:22] SEND (005): 10 40 FD 3D 16
[2016-03-31 15:14:22] SEND (005): 10 5B 01 5C 16
[2016-03-31 15:14:22] RECV (051): 68 2D 2D 68 08 01 72 36 83 02 00 28 14 02 0E 01 00 00 00 04 6D 0D 91 1F 23 05 3E 12 3A EB 42 05 5B 1E 8E 7F 42 05 5F FE A6 70 42 05 06 4C 2F B0 44 91 16
mbus_frame_print: Dumping M-Bus frame [type 4, 51 bytes]: 68 2D 2D 68 08 01 72 36 83 02 00 28 14 02 0E 01 00 00 00 04 6D 0D 91 1F 23 05 3E 12 3A EB 42 05 5B 1E 8E 7F 42 05 5F FE A6 70 42 05 06 4C 2F B0 44 91 16

<SlaveInformation>
    <Id>28336</Id>
    <Manufacturer>EAH</Manufacturer>
    <Version>2</Version>
    <ProductName></ProductName>
    <Medium>Bus/System</Medium>
    <AccessNumber>1</AccessNumber>
    <Status>00</Status>
    <Signature>0000</Signature>
</SlaveInformation>

<DataRecord id="0">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Time Point (time &amp; date)</Unit>
    <Value>2016-03-31T17:13:00</Value>
    <Timestamp>2016-03-31T15:14:22</Timestamp>
</DataRecord>

<DataRecord id="1">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Volume flow ( m^3/h)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2016-03-31T15:14:22</Timestamp>
</DataRecord>

<DataRecord id="2">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Flow temperature (deg C)</Unit>
    <Value>0.000000</Value>
    <Timestamp>2016-03-31T15:14:22</Timestamp>
</DataRecord>

<DataRecord id="3">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Return temperature (deg C)</Unit>
    <Value>-110617361593742888303337684056997363712.000000</Value>
    <Timestamp>2016-03-31T15:14:22</Timestamp>
</DataRecord>

<DataRecord id="4">
    <Function>Instantaneous value</Function>
    <StorageNumber>0</StorageNumber>
    <Unit>Energy (kWh)</Unit>
    <Value>46055696.000000</Value>
    <Timestamp>2016-03-31T15:14:22</Timestamp>
</DataRecord>

Thanks, much help is appreciated.

Regards,
Ado

Arduino.

A lot of people are looking for an arduino library !!
Have you ever thing to pot the library for www.arduino.cc microcontroller ?
Another question, is there a cheap m-bus converter ?
I can find only commercial one to 70€ each...
Let me know !
Thankyou Niomix

Y2K bug

The MBDOC48 defines a year (Type F and G) only with 2 digits, but not how to calculate a 4 digit value. Currently libmbus adds simply 2000 to the 2 digit value to get a 4 digit value, which it isn't really correct.

The question is: what is the correct formular to calculate the 4 digit value?

Because i don't have the EN, i can't fix this.

Device found in scan, not able to fetch data with secondary address

Hello guys,

I have the problem that I get "The selected secondary address does not match any device" for an address that was just found with a bus scan.

While getting debug data for this issue I discovered some strange behaviour (off-by-one in for loop constructing the bitmask ?) when scanning with a certain address-mask:
$ mbus-serial-scan-secondary -b 2400 /dev/ttyS0 000257FFFFFFFFFF
Found a device on secondary address 000257762D480307 [using address mask 0002577FFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
Found a device on secondary address 000258082D480307 [using address mask 0002580FFFFFFFFF]
Found a device on secondary address 000258262D480307 [using address mask 0002582FFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 0002577FFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
Found a device on secondary address 000258082D480307 [using address mask 0002580FFFFFFFFF]
Found a device on secondary address 000258262D480307 [using address mask 0002582FFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]

Anyway, the issue is that for all these 3 meters I cannot fetch data:
$ mbus-serial-request-data -b 2400 /dev/ttyS0 000258262D480307
main: Error: The selected secondary address does not match any device [000258262D480307].
$ mbus-serial-request-data -b 2400 /dev/ttyS0 000258082D480307
main: Error: The selected secondary address does not match any device [000258082D480307].
$ mbus-serial-request-data -b 2400 /dev/ttyS0 000258262D480307
main: Error: The selected secondary address does not match any device [000258262D480307].

please see debug output below:
$ mbus-serial-scan-secondary -d -b 2400 /dev/ttyS0 000257FFFFFFFFFF
init_slaves: debug: sending init frame #1
[2013-10-15 13:34:33] SEND (005): 10 40 FD 3D 16
init_slaves: debug: sending init frame #2
[2013-10-15 13:34:33] SEND (005): 10 40 FF 3F 16
[2013-10-15 13:34:33] SEND (017): 68 0B 0B 68 73 FD 52 0F 57 02 00 FF FF FF FF 26 16
[2013-10-15 13:34:33] SEND (017): 68 0B 0B 68 73 FD 52 1F 57 02 00 FF FF FF FF 36 16
[2013-10-15 13:34:34] SEND (017): 68 0B 0B 68 73 FD 52 2F 57 02 00 FF FF FF FF 46 16
[2013-10-15 13:34:34] SEND (017): 68 0B 0B 68 73 FD 52 3F 57 02 00 FF FF FF FF 56 16
[2013-10-15 13:34:34] SEND (017): 68 0B 0B 68 73 FD 52 4F 57 02 00 FF FF FF FF 66 16
[2013-10-15 13:34:35] SEND (017): 68 0B 0B 68 73 FD 52 5F 57 02 00 FF FF FF FF 76 16
[2013-10-15 13:34:35] SEND (017): 68 0B 0B 68 73 FD 52 6F 57 02 00 FF FF FF FF 86 16
[2013-10-15 13:34:35] SEND (017): 68 0B 0B 68 73 FD 52 7F 57 02 00 FF FF FF FF 96 16
[2013-10-15 13:34:35] RECV (001): FC
[2013-10-15 13:34:35] SEND (017): 68 0B 0B 68 73 FD 52 70 57 02 00 FF FF FF FF 87 16
[2013-10-15 13:34:36] SEND (017): 68 0B 0B 68 73 FD 52 71 57 02 00 FF FF FF FF 88 16
[2013-10-15 13:34:36] SEND (017): 68 0B 0B 68 73 FD 52 72 57 02 00 FF FF FF FF 89 16
[2013-10-15 13:34:36] SEND (017): 68 0B 0B 68 73 FD 52 73 57 02 00 FF FF FF FF 8A 16
[2013-10-15 13:34:37] SEND (017): 68 0B 0B 68 73 FD 52 74 57 02 00 FF FF FF FF 8B 16
[2013-10-15 13:34:37] SEND (017): 68 0B 0B 68 73 FD 52 75 57 02 00 FF FF FF FF 8C 16
[2013-10-15 13:34:37] SEND (017): 68 0B 0B 68 73 FD 52 76 57 02 00 FF FF FF FF 8D 16
[2013-10-15 13:34:37] RECV (001): E5
[2013-10-15 13:34:37] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:38] RECV (058): 68 34 34 68 08 00 72 76 57 02 00 2D 48 03 07 7D 00 00 00 04 13 79 26 00 00 04 6D 39 0E AF 1A 42 6C BC 19 44 13 C9 20 00 00 42 EC 7E DC 19 0C 78 76 57 02 00 0F 01 00 00 43 16
Found a device on secondary address 000257762D480307 [using address mask 00025776FFFFFFFF]
[2013-10-15 13:34:38] SEND (017): 68 0B 0B 68 73 FD 52 77 57 02 00 FF FF FF FF 8E 16
[2013-10-15 13:34:38] SEND (017): 68 0B 0B 68 73 FD 52 78 57 02 00 FF FF FF FF 8F 16
[2013-10-15 13:34:38] SEND (017): 68 0B 0B 68 73 FD 52 79 57 02 00 FF FF FF FF 90 16
[2013-10-15 13:34:39] SEND (017): 68 0B 0B 68 73 FD 52 8F 57 02 00 FF FF FF FF A6 16
[2013-10-15 13:34:39] SEND (017): 68 0B 0B 68 73 FD 52 9F 57 02 00 FF FF FF FF B6 16
[2013-10-15 13:34:39] SEND (017): 68 0B 0B 68 73 FD 52 FF 50 02 00 FF FF FF FF 0F 16
[2013-10-15 13:34:39] SEND (017): 68 0B 0B 68 73 FD 52 FF 51 02 00 FF FF FF FF 10 16
[2013-10-15 13:34:40] SEND (017): 68 0B 0B 68 73 FD 52 FF 52 02 00 FF FF FF FF 11 16
[2013-10-15 13:34:40] SEND (017): 68 0B 0B 68 73 FD 52 FF 53 02 00 FF FF FF FF 12 16
[2013-10-15 13:34:40] SEND (017): 68 0B 0B 68 73 FD 52 FF 54 02 00 FF FF FF FF 13 16
[2013-10-15 13:34:41] SEND (017): 68 0B 0B 68 73 FD 52 FF 55 02 00 FF FF FF FF 14 16
[2013-10-15 13:34:41] SEND (017): 68 0B 0B 68 73 FD 52 FF 56 02 00 FF FF FF FF 15 16
[2013-10-15 13:34:41] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 00 FF FF FF FF 16 16
[2013-10-15 13:34:41] RECV (001): E5
[2013-10-15 13:34:41] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:42] RECV (058): 68 34 34 68 08 00 72 76 57 02 00 2D 48 03 07 7E 00 00 00 04 13 79 26 00 00 04 6D 39 0E AF 1A 42 6C BC 19 44 13 C9 20 00 00 42 EC 7E DC 19 0C 78 76 57 02 00 0F 01 00 00 44 16
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
[2013-10-15 13:34:42] SEND (017): 68 0B 0B 68 73 FD 52 FF 58 02 00 FF FF FF FF 17 16
[2013-10-15 13:34:42] RECV (001): E5
[2013-10-15 13:34:42] RECV (001): F9
[2013-10-15 13:34:42] SEND (017): 68 0B 0B 68 73 FD 52 0F 58 02 00 FF FF FF FF 27 16
[2013-10-15 13:34:42] RECV (001): E5
[2013-10-15 13:34:42] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:43] RECV (058): 68 34 34 68 08 00 72 08 58 02 00 2D 48 03 07 1E 00 00 00 04 13 CB 5C 00 00 04 6D 38 0E AF 1A 42 6C BC 19 44 13 BE 58 00 00 42 EC 7E DC 19 0C 78 08 58 02 00 0F 01 00 00 BE 16
Found a device on secondary address 000258082D480307 [using address mask 0002580FFFFFFFFF]
[2013-10-15 13:34:43] SEND (017): 68 0B 0B 68 73 FD 52 1F 58 02 00 FF FF FF FF 37 16
[2013-10-15 13:34:43] SEND (017): 68 0B 0B 68 73 FD 52 2F 58 02 00 FF FF FF FF 47 16
[2013-10-15 13:34:43] RECV (001): E5
[2013-10-15 13:34:43] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:44] RECV (058): 68 34 34 68 08 00 72 26 58 02 00 2D 48 03 07 64 00 00 00 04 13 CE 31 00 00 04 6D 01 0F AF 1A 42 6C BC 19 44 13 F8 2F 00 00 42 EC 7E DC 19 0C 78 26 58 02 00 0F 01 00 00 F3 16
Found a device on secondary address 000258262D480307 [using address mask 0002582FFFFFFFFF]
[2013-10-15 13:34:44] SEND (017): 68 0B 0B 68 73 FD 52 3F 58 02 00 FF FF FF FF 57 16
[2013-10-15 13:34:44] SEND (017): 68 0B 0B 68 73 FD 52 4F 58 02 00 FF FF FF FF 67 16
[2013-10-15 13:34:44] SEND (017): 68 0B 0B 68 73 FD 52 5F 58 02 00 FF FF FF FF 77 16
[2013-10-15 13:34:44] SEND (017): 68 0B 0B 68 73 FD 52 6F 58 02 00 FF FF FF FF 87 16
[2013-10-15 13:34:45] SEND (017): 68 0B 0B 68 73 FD 52 7F 58 02 00 FF FF FF FF 97 16
[2013-10-15 13:34:45] SEND (017): 68 0B 0B 68 73 FD 52 8F 58 02 00 FF FF FF FF A7 16
[2013-10-15 13:34:45] SEND (017): 68 0B 0B 68 73 FD 52 9F 58 02 00 FF FF FF FF B7 16
[2013-10-15 13:34:46] SEND (017): 68 0B 0B 68 73 FD 52 FF 59 02 00 FF FF FF FF 18 16
[2013-10-15 13:34:46] SEND (017): 68 0B 0B 68 73 FD 52 FF 07 02 00 FF FF FF FF C6 16
[2013-10-15 13:34:46] SEND (017): 68 0B 0B 68 73 FD 52 FF 17 02 00 FF FF FF FF D6 16
[2013-10-15 13:34:46] SEND (017): 68 0B 0B 68 73 FD 52 FF 27 02 00 FF FF FF FF E6 16
[2013-10-15 13:34:47] SEND (017): 68 0B 0B 68 73 FD 52 FF 37 02 00 FF FF FF FF F6 16
[2013-10-15 13:34:47] SEND (017): 68 0B 0B 68 73 FD 52 FF 47 02 00 FF FF FF FF 06 16
[2013-10-15 13:34:47] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 00 FF FF FF FF 16 16
[2013-10-15 13:34:47] RECV (001): E5
[2013-10-15 13:34:48] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:48] RECV (058): 68 34 34 68 08 00 72 76 57 02 00 2D 48 03 07 7F 00 00 00 04 13 79 26 00 00 04 6D 39 0E AF 1A 42 6C BC 19 44 13 C9 20 00 00 42 EC 7E DC 19 0C 78 76 57 02 00 0F 01 00 00 45 16
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
[2013-10-15 13:34:48] SEND (017): 68 0B 0B 68 73 FD 52 FF 67 02 00 FF FF FF FF 26 16
[2013-10-15 13:34:48] SEND (017): 68 0B 0B 68 73 FD 52 FF 77 02 00 FF FF FF FF 36 16
[2013-10-15 13:34:48] SEND (017): 68 0B 0B 68 73 FD 52 FF 87 02 00 FF FF FF FF 46 16
[2013-10-15 13:34:49] SEND (017): 68 0B 0B 68 73 FD 52 FF 97 02 00 FF FF FF FF 56 16
[2013-10-15 13:34:49] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 00 00 FF FF FF FF 14 16
[2013-10-15 13:34:49] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 01 00 FF FF FF FF 15 16
[2013-10-15 13:34:50] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 00 FF FF FF FF 16 16
[2013-10-15 13:34:50] RECV (001): E5
[2013-10-15 13:34:50] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:50] RECV (058): 68 34 34 68 08 00 72 76 57 02 00 2D 48 03 07 80 00 00 00 04 13 79 26 00 00 04 6D 39 0E AF 1A 42 6C BC 19 44 13 C9 20 00 00 42 EC 7E DC 19 0C 78 76 57 02 00 0F 01 00 00 46 16
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
[2013-10-15 13:34:50] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 03 00 FF FF FF FF 17 16
[2013-10-15 13:34:51] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 04 00 FF FF FF FF 18 16
[2013-10-15 13:34:51] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 05 00 FF FF FF FF 19 16
[2013-10-15 13:34:51] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 06 00 FF FF FF FF 1A 16
[2013-10-15 13:34:51] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 07 00 FF FF FF FF 1B 16
[2013-10-15 13:34:52] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 08 00 FF FF FF FF 1C 16
[2013-10-15 13:34:52] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 09 00 FF FF FF FF 1D 16
[2013-10-15 13:34:52] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 00 FF FF FF FF 16 16
[2013-10-15 13:34:52] RECV (001): E5
[2013-10-15 13:34:53] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:53] RECV (058): 68 34 34 68 08 00 72 76 57 02 00 2D 48 03 07 81 00 00 00 04 13 79 26 00 00 04 6D 39 0E AF 1A 42 6C BC 19 44 13 C9 20 00 00 42 EC 7E DC 19 0C 78 76 57 02 00 0F 01 00 00 47 16
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
[2013-10-15 13:34:53] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 12 00 FF FF FF FF 26 16
[2013-10-15 13:34:53] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 22 00 FF FF FF FF 36 16
[2013-10-15 13:34:53] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 32 00 FF FF FF FF 46 16
[2013-10-15 13:34:54] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 42 00 FF FF FF FF 56 16
[2013-10-15 13:34:54] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 52 00 FF FF FF FF 66 16
[2013-10-15 13:34:54] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 62 00 FF FF FF FF 76 16
[2013-10-15 13:34:55] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 72 00 FF FF FF FF 86 16
[2013-10-15 13:34:55] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 82 00 FF FF FF FF 96 16
[2013-10-15 13:34:55] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 92 00 FF FF FF FF A6 16
[2013-10-15 13:34:55] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 00 FF FF FF FF 16 16
[2013-10-15 13:34:55] RECV (001): E5
[2013-10-15 13:34:56] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:56] RECV (058): 68 34 34 68 08 00 72 76 57 02 00 2D 48 03 07 82 00 00 00 04 13 79 26 00 00 04 6D 39 0E AF 1A 42 6C BC 19 44 13 C9 20 00 00 42 EC 7E DC 19 0C 78 76 57 02 00 0F 01 00 00 48 16
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
[2013-10-15 13:34:56] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 01 FF FF FF FF 17 16
[2013-10-15 13:34:56] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 02 FF FF FF FF 18 16
[2013-10-15 13:34:57] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 03 FF FF FF FF 19 16
[2013-10-15 13:34:57] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 04 FF FF FF FF 1A 16
[2013-10-15 13:34:57] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 05 FF FF FF FF 1B 16
[2013-10-15 13:34:57] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 06 FF FF FF FF 1C 16
[2013-10-15 13:34:58] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 07 FF FF FF FF 1D 16
[2013-10-15 13:34:58] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 08 FF FF FF FF 1E 16
[2013-10-15 13:34:58] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 09 FF FF FF FF 1F 16
[2013-10-15 13:34:59] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 00 FF FF FF FF 16 16
[2013-10-15 13:34:59] RECV (001): E5
[2013-10-15 13:34:59] SEND (005): 10 5B FD 58 16
[2013-10-15 13:34:59] RECV (058): 68 34 34 68 08 00 72 76 57 02 00 2D 48 03 07 83 00 00 00 04 13 79 26 00 00 04 6D 39 0E AF 1A 42 6C BC 19 44 13 C9 20 00 00 42 EC 7E DC 19 0C 78 76 57 02 00 0F 01 00 00 49 16
Found a device on secondary address 000257762D480307 [using address mask 000257FFFFFFFFFF]
[2013-10-15 13:34:59] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 10 FF FF FF FF 26 16
[2013-10-15 13:34:59] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 20 FF FF FF FF 36 16
[2013-10-15 13:35:00] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 30 FF FF FF FF 46 16
[2013-10-15 13:35:00] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 40 FF FF FF FF 56 16
[2013-10-15 13:35:00] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 50 FF FF FF FF 66 16
[2013-10-15 13:35:01] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 60 FF FF FF FF 76 16
[2013-10-15 13:35:01] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 70 FF FF FF FF 86 16
[2013-10-15 13:35:01] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 80 FF FF FF FF 96 16
[2013-10-15 13:35:01] SEND (017): 68 0B 0B 68 73 FD 52 FF 57 02 90 FF FF FF FF A6 16

$ mbus-serial-request-data -d -b 2400 /dev/ttyS0 000257762D480307
[2013-10-15 13:37:29] SEND (017): 68 0B 0B 68 73 FD 52 76 57 02 00 2D 48 03 07 10 16
main: Error: The selected secondary address does not match any device [000257762D480307].
$ mbus-serial-request-data -d -b 2400 /dev/ttyS0 000258082D480307
[2013-10-15 13:35:36] SEND (017): 68 0B 0B 68 73 FD 52 08 58 02 00 2D 48 03 07 A3 16
main: Error: The selected secondary address does not match any device [000258082D480307].
$ mbus-serial-request-data -d -b 2400 /dev/ttyS0 000258262D480307
[2013-10-15 13:35:49] SEND (017): 68 0B 0B 68 73 FD 52 26 58 02 00 2D 48 03 07 C1 16
main: Error: The selected secondary address does not match any device [000258262D480307].
root@karl-neuhausstr40:~#

Thanks,
Aarno

read more one meter ?

hello
i am completely new to this.
I can read multiple counters in a facility or all at once?

Incorrect handling of extended value information fields (VIFEs)

Meter: Sensus PolluStat (3rd party provided mbus documentation here)
libmbus version: built from 53d66c3

Extended VIB BE 50 is reported by mbus-serial-request-data as "Volume Flow ( m^3/h)" rather than "Duration of lower limit exceed for volume flow ( s)" (or however it would be phrased). Same issue for VIB BE 58 ("upper limit").

Trimmed XML output:

<MBusData>

    <SlaveInformation>
        <Id>11788</Id>
        <Manufacturer>SEN</Manufacturer>
        <Version>6</Version>
        <ProductName></ProductName>
        <Medium>Heat / Cooling load meter</Medium>
        <AccessNumber>61</AccessNumber>
        <Status>00</Status>
        <Signature>0000</Signature>
    </SlaveInformation>

    <!-- Data records 0-11 -->

    <DataRecord id="12">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume flow ( m^3/h)</Unit>
        <Value>11582321</Value>
        <Timestamp>2015-04-07T12:50:36</Timestamp>
    </DataRecord>

    <DataRecord id="13">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Volume flow ( m^3/h)</Unit>
        <Value>756</Value>
        <Timestamp>2015-04-07T12:50:36</Timestamp>
    </DataRecord>

    <!-- Data records 14-15 -->

</MBusData>

Debug output:

[2015-04-07 12:50:48] SEND (005): 10 40 FD 3D 16
[2015-04-07 12:50:49] SEND (005): 10 40 FD 3D 16
[2015-04-07 12:50:49] SEND (005): 10 5B 04 5F 16
[2015-04-07 12:50:49] RECV (119): 68 71 71 68 08 04 72 88 17 01 00 AE 4C 06 0D 3E 00 00 00 04 6D 3B 0E E7 14 34 6D 00 00 01 01 34 FD 17 00 00 00 04 04 20 92 22 F1 00 04 24 A4 1A E7 00 04 86 3B 97 9B 00 00 04 13 BE 09 5E 00 05 2E B1 D1 2E BE 05 3E F5 B8 4E 40 05 5B B8 2D F9 41 05 5F 78 8B F9 41 05 63 00 80 3B BD 04 BE 50 71 BB B0 00 04 BE 58 F4 02 00 00 0C 78 88 17 01 00 02 7F 10 B5 5D 16

Reading through secondary addressing

Good day,

I´m new using libmbus, and I´m experimenting problems to read using secondary addressing. I have one Sontex 531 Mbus slave that when i read using primary adressing works fine.

Mbus-tcp-request-data –d 192.168.1.163 10001 5

[2015-12-10 14:51:07] SEND (017): 10 7B 05 80 16
[2015-12-10 14:51:08] RECV (125) : 68 77 77 68 08 05 72 66 87 24 16 EE 4D 0D 04 94 30 00 00 05 5B 00 00 00 00 05 5F 00 00 00 00 05 3E 00 00 00 00 05 2B 00 00 00 00 01 FF 07 01 05 96 28 B4 A2 91 39 05 FF 01 AC 0D C2 3D 05 FF 02 36 89 C7 3E 01 FF 04 01 01 FD 0F 2A 02 FD 0D 29 00 03 22 FB 0D 00 01 70 1E 82 89 01 FD 25 3C 00 82 82 03 FD 26 18 00 02 EC 7E 01 0F C2 84 01 EC 7E 01 07 82 85 01 EC 7E 01 01 1F 00 16.

I would like to read using secondary addressing, becase i have two slaves that i can´t change the primary ID and always 0, so they can´t be in the same bus.

But when i use the secondary address with the mask.

Mbus-tcp-request-data –d 192.168.1.163 10001 16357551FFFFFFFF

[2015-12-10 14:54:07] SEND (017) 68 0B 0B 68 73 FD 52 51 75 35 16 FF FF FF FF CF 16
[2015-12-10 14:54:07] RECV (001) E5

the call gets stuck. but if a execute mbconfig with secondary adressing 2 minutes later

[2015-12-10 14:56:07] SEND (005) 10 5B FD 58 16
Failed to receve M-Bus response frame: M-Bus tcp transport layer connection close by remote host.

If i compare the request with the one done with the mbconfig. The first one is the same,but before receiving the acknowledge (E5) the new message sent is different in one byte and in the checksum.

libmbus : 10 5B FD 58 16
MBconfig: 10 7B FD 78 16

Which coud be the problem?

I´m using a Ethernet to Serial converter for the task.

Best regards

libmbus doesn't build with automake 1.11

After the latest change on configure.ac, the libmbus always abort building with the following output:

./build.sh 
CDPATH="${ZSH_VERSION+.}:" && cd . && aclocal -I . -Werror -I m4
configure.ac:20: warning: macro `AM_PROG_AR' not found in library
make: *** [aclocal.m4] Error 1

I'm using automake (GNU automake) 1.11.1

Sontex Supercal531 parse error: Unknown control information 0xb7

$ ./mbus_parse_hex test-frames/SON-Sontex-Supercal531-multiframe.hex
int mbus_frame_print(mbus_frame *): Dumping M-Bus frame [type 4, 191 bytes]: 68 B9 B9 68 08 09 B7 01 01 04 40 83 03 C0 00 00 69 92 30 13 70 92 30 13 07 0C 1F 21 00 00 00 00 00 00 00 00 6C 05 00 00 04 94 F2 0C 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 0E 02 00 00 00 00 00 00 00 0E 9E 03 00 00 6C 05 00 00 6C 05 00 00 62 05 00 00 5C 05 00 00 ED 04 00 00 6A 04 00 00 9E 03 00 00 7D 03 00 00 7D 03 00 00 7D 03 00 00 7C 03 00 00 7C 03 00 00 7C 03 00 00 7C 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1F 36 16
mbus_frame_data_parse: Unknown control information 0xb7

sometimes it works, sometimes it doesn't. I'll be working on this, ping me if you know something :)

68 90 90 68 08 0A 72 01 46 63 12 EE 4D 0D 0C 4A 00 00 00 C5 89 01 63 3D 4A B5 3F 85 8A 01 63 C9 B2 B9 3F C5 8A 01 63 98 C5 B7 3F 85 8B 01 63 4F 07 B8 3F C5 8B 01 63 1A C1 B8 3F 85 8C 01 63 FB 97 BA 3F C5 8C 01 63 18 EE BD 3F 85 8D 01 63 55 46 B6 3F C5 8D 01 63 07 DD BE 3F 85 8E 01 63 A0 2F BA 3F C5 8E 01 63 07 FF BB 3F 85 8F 01 63 80 5E BB 3F C5 8F 01 63 66 22 BE 3F 85 80 02 63 F4 37 C4 3F C5 80 02 63 03 DF BC 3F 85 81 02 63 B0 D9 C4 3F 1F 4A 16

68 90 90 68 08 09 72 69 92 30 13 EE 4D 0D 04 DA 00 00 00 C5 89 01 63 00 00 00 00 85 8A 01 63 00 00 00 00 C5 8A 01 63 00 00 00 00 85 8B 01 63 00 00 00 00 C5 8B 01 63 00 00 00 00 85 8C 01 63 00 00 00 00 C5 8C 01 63 00 00 00 00 85 8D 01 63 00 00 00 00 C5 8D 01 63 00 00 00 00 85 8E 01 63 00 00 00 00 C5 8E 01 63 00 00 00 00 85 8F 01 63 00 00 00 00 C5 8F 01 63 00 00 00 00 85 80 02 63 00 00 00 00 C5 80 02 63 00 00 00 00 85 81 02 63 00 00 00 00 1F 39 16

68 90 90 68 08 06 72 81 25 00 13 EE 4D 0D 04 8B 00 00 00 C5 81 02 5F D2 4A 46 42 85 82 02 5F 8F 2E 68 42 C5 82 02 5F C3 6F 5F 42 85 83 02 5F CD F2 62 42 C5 83 02 5F EA 3A 66 42 85 84 02 5F 93 CA 52 42 C5 84 02 5F 79 C1 2E 42 85 85 02 5F 25 C2 52 42 C5 85 02 5F 41 09 11 42 85 86 02 5F 66 0F 01 42 C5 86 02 5F ED D2 0B 42 85 87 02 5F 30 55 2D 42 C5 87 02 5F 50 79 5F 42 85 88 02 5F B5 1E 64 42 C5 88 02 5F 49 00 66 42 85 89 02 5F 7C 50 4F 42 1F 88 16

68 BA BA 68 08 08 B7 01 02 E5 00 D3 00 40 19 59 42 00 69 32 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E2 15 96 46 82 6B B4 46 D2 63 C1 46 22 1B C4 46 E2 48 CC 46 C2 3B D6 46 21 16 30 46 13 14 1D 21 13 07 1D 21 13 07 1C 21 13 07 1B 21 13 07 1A 21 13 07 19 21 13 0D 17 21 1F 1C 16

68 BA BA 68 08 08 B7 01 02 E5 00 D3 00 C0 B5 60 42 40 46 33 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E2 15 96 46 82 6B B4 46 D2 63 C1 46 22 1B C4 46 E2 48 CC 46 C2 3B D6 46 21 16 30 46 13 14 1D 21 13 07 1D 21 13 07 1C 21 13 07 1B 21 13 07 1A 21 13 07 19 21 13 0D 17 21 1F 5D 16

68 BA BA 68 08 08 B7 01 02 E5 00 D3 00 80 94 60 42 80 15 33 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E2 15 96 46 82 6B B4 46 D2 63 C1 46 22 1B C4 46 E2 48 CC 46 C2 3B D6 46 21 16 30 46 13 14 1D 21 13 07 1D 21 13 07 1C 21 13 07 1B 21 13 07 1A 21 13 07 19 21 13 0D 17 21 1F 0B 16

68 BA BA 68 08 08 B7 01 02 E5 00 D3 00 40 EF 61 42 00 08 30 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E2 15 96 46 82 6B B4 46 D2 63 C1 46 22 1B C4 46 E2 48 CC 46 C2 3B D6 46 21 16 30 46 13 14 1D 21 13 07 1D 21 13 07 1C 21 13 07 1B 21 13 07 1A 21 13 07 19 21 13 0D 17 21 1F 97 16

68 BA BA 68 08 08 B7 01 02 E5 00 D3 00 80 7E 61 42 40 16 30 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E2 15 96 46 82 6B B4 46 D2 63 C1 46 22 1B C4 46 E2 48 CC 46 C2 3B D6 46 21 16 30 46 13 14 1D 21 13 07 1D 21 13 07 1C 21 13 07 1B 21 13 07 1A 21 13 07 19 21 13 0D 17 21 1F B4 16

68 BA BA 68 08 08 B7 01 02 E5 00 D3 00 00 0C 61 42 80 3C 30 42 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E2 15 96 46 82 6B B4 46 D2 63 C1 46 22 1B C4 46 E2 48 CC 46 C2 3B D6 46 21 16 30 46 13 14 1D 21 13 07 1D 21 13 07 1C 21 13 07 1B 21 13 07 1A 21 13 07 19 21 13 0D 17 21 1F 28 16

68 3E 3E 68 08 08 72 43 25 00 13 EE 4D 0D 04 3F 00 00 00 C4 00 06 28 77 00 00 C4 00 13 C2 B1 19 00 D5 82 03 2B E2 15 96 46 C4 82 03 6D 13 14 1D 21 D5 86 04 3E 10 58 69 3F C4 86 04 6D 13 11 1D 21 0F A0 16

68 3E 3E 68 08 08 72 43 25 00 13 EE 4D 0D 04 40 00 00 00 C4 00 06 28 77 00 00 C4 00 13 C2 B1 19 00 D5 82 03 2B E2 15 96 46 C4 82 03 6D 13 14 1D 21 D5 86 04 3E 10 58 69 3F C4 86 04 6D 13 11 1D 21 0F A1 16

68 50 50 68 08 08 72 43 25 00 13 EE 4D 0D 04 49 00 00 00 02 FD 17 00 00 34 75 DD 01 11 00 04 6D 39 0F 1E 21 04 06 3B 92 00 00 04 13 B8 C6 1D 00 05 5B C0 15 68 42 05 5F 00 26 32 42 05 3E 23 0B C2 3D 05 2B E2 A0 B0 44 03 22 7C 57 00 0C 78 43 25 00 13 1F CA 16

68 B9 B9 68 08 09 B7 01 01 04 40 83 03 C0 00 00 69 92 30 13 70 92 30 13 07 0C 1F 21 00 00 00 00 00 00 00 00 6C 05 00 00 04 94 F2 0C 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 0E 02 00 00 00 00 00 00 00 0E 9E 03 00 00 6C 05 00 00 6C 05 00 00 62 05 00 00 5C 05 00 00 ED 04 00 00 6A 04 00 00 9E 03 00 00 7D 03 00 00 7D 03 00 00 7D 03 00 00 7C 03 00 00 7C 03 00 00 7C 03 00 00 7C 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1F 36 16

Example to assing primary address

Hi !

This is not a bug, this is a question. I have not enough knowledge to do it. I have been reading the protocol, but I don't know how to assign primary address using the secondary.

Somebody can help me ?

Thanks

Im871A

Hi,
I am a student, and I am working on the project about Mbus. I used the broad from IMST(im871) to transfer the meter reading to the im871 USB adapter connect with Raspberry Pi. I am totally begineer in this area. Is any advice to my project? Your reply is really helpful to me.
Thank you so much.

Timeout problem for 2400 baud

I am using libmbus on a Beaglebone black and had no problems in retrieving data from various meter types. Until I encountered a GWF UniCocoder water meter. This meter is fixed at 2400 baud. I was able to do an address scan, but an serial-request-data at 2400 baud always failed. Checking with a scope I found the device was sending a correct response, but the Beaglebone as master was not able to parse the response.
I found out the Timeout for 2400 baud in mbus_serial_set_baudrate() was just a little bit to short.
Changing handle-t.c.c_cc[VTIME] from 2 to 3 solved the problem.

Installing libmbus library on windows

Hi,

I tried to install and compile this library using MinGW and msys, only to realise that they do not support automake 1.12 and thus the libray cannot be compiled. I would like to remind other people like me intended to run the library on windows that it is not possible to use msys to compile the library.

I just want to know the error-free way to compile the library, is ubuntu-version stable? I notice that there is a difference in the source code for libmbus-0.8.0 and libmbus-master, I think libmbus-master is more up-to-date, thanks to all the active developers. I really appreciate the work you guys have put into this open-source library. Can you let me know how to properly use autotools to build the library?

regards,
-Chen

Pollustat E: Problems reading multi telegram

I am trying to read out data from a Sensus Pollustat E. Using MiniCom I can see that the meter is reporting multiple telegrams but when I use libmbus to request data I only get a single telegram which seems to be the oldest one (using mbus-serial-request-data-multi-reply). If I reconfigure the meter using MiniCom to only report single telegrams I will get the correct data (the newest telegram).

Am I misuing mbus-serial-request-data-multi-reply in some way or doesnt libmbus support multi telegram readouts for this meter?

Schneider iEM3135 More than 25 values

Hello i have a mbus meter iEM3135, i am trying to read value 32 but the output only goes to 25.

Hopefully this is a quick fix :) Thanks for all the help guys!

Here is the output:

init_slaves: debug: sending init frame #1
[2017-06-09 07:44:28] SEND (005): 10 40 FD 3D 16
init_slaves: debug: sending init frame #2
[2017-06-09 07:44:28] SEND (005): 10 40 FD 3D 16
[2017-06-09 07:44:28] SEND (005): 10 5B 02 5D 16
[2017-06-09 07:44:29] RECV (250): 68 F4 F4 68 08 02 72 62 30 31 03 A3 4C 15 02 16 00 00 00 0D FD 0A 12 63 69 72 74 63 65 6C 45 20 72 65 64 69 65 6E 68 63 53 0D FD 0C 08 20 35 33 31 33 4D 45 69 0D FD 0E 07 37 30 30 2E 33 2E 31 03 FD 17 00 00 00 05 FD DC FF 01 BE C6 08 42 05 FD DC FF 02 51 F3 0B 42 05 FD DC FF 03 11 3D 09 42 05 FD DC FF 00 0B FD 09 42 05 FD C9 FF 05 AA 6A C7 43 05 FD C9 FF 06 AC FA C7 43 05 FD C9 FF 07 8E 3C C7 43 05 FD C9 FF 08 C0 B2 C7 43 05 FD C9 FF 01 C7 DD 67 43 05 FD C9 FF 02 3E 0E 65 43 05 FD C9 FF 03 C9 E1 66 43 05 FD C9 FF 04 EF 99 66 43 05 AE FF 01 A0 ED C1 40 05 AE FF 02 2E 8D C3 40 05 AE FF 03 03 BB C0 40 05 2E 74 8D 91 41 85 40 2E CB 36 76 41 85 80 40 2E 02 A2 BE 41 05 FF 0A 3E 76 43 3F 05 FF 0B 64 F8 47 42 07 03 32 30 FD 01 00 00 00 00 1F C1 16
mbus_frame_print: Dumping M-Bus frame [type 4, 250 bytes]: 68 F4 F4 68 08 02 72 62 30 31 03 A3 4C 15 02 16 00 00 00 0D FD 0A 12 63 69 72 74 63 65 6C 45 20 72 65 64 69 65 6E 68 63 53 0D FD 0C 08 20 35 33 31 33 4D 45 69 0D FD 0E 07 37 30 30 2E 33 2E 31 03 FD 17 00 00 00 05 FD DC FF 01 BE C6 08 42 05 FD DC FF 02 51 F3 0B 42 05 FD DC FF 03 11 3D 09 42 05 FD DC FF 00 0B FD 09 42 05 FD C9 FF 05 AA 6A C7 43 05 FD C9 FF 06 AC FA C7 43 05 FD C9 FF 07 8E 3C C7 43 05 FD C9 FF 08 C0 B2 C7 43 05 FD C9 FF 01 C7 DD 67 43 05 FD C9 FF 02 3E 0E 65 43 05 FD C9 FF 03 C9 E1 66 43 05 FD C9 FF 04 EF 99 66 43 05 AE FF 01 A0 ED C1 40 05 AE FF 02 2E 8D C3 40 05 AE FF 03 03 BB C0 40 05 2E 74 8D 91 41 85 40 2E CB 36 76 41 85 80 40 2E 02 A2 BE 41 05 FF 0A 3E 76 43 3F 05 FF 0B 64 F8 47 42 07 03 32 30 FD 01 00 00 00 00 1F C1 16 
<?xml version="1.0" encoding="ISO-8859-1"?>
<MBusData>

    <SlaveInformation>
        <Id>3313062</Id>
        <Manufacturer>SEC</Manufacturer>
        <Version>21</Version>
        <ProductName></ProductName>
        <Medium>Electricity</Medium>
        <AccessNumber>22</AccessNumber>
        <Status>00</Status>
        <Signature>0000</Signature>
    </SlaveInformation>

    <DataRecord id="0">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Manufacturer (as in fixed header)</Unit>
        <Value>Schneider Electric</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="1">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Model / Version</Unit>
        <Value>iEM3135 </Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="2">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Firmware version</Unit>
        <Value>1.3.007</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="3">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Error flags</Unit>
        <Value>0</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="4">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> A</Unit>
        <Value>34.194084</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="5">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> A</Unit>
        <Value>34.987614</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="6">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> A</Unit>
        <Value>34.309635</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="7">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> A</Unit>
        <Value>34.497112</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="8">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>398.833313</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="9">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>399.958374</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="10">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>398.473083</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="11">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>399.396484</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="12">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>231.866318</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="13">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>229.055634</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="14">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>230.881973</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="15">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit> V</Unit>
        <Value>230.601303</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="16">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Power (kW)</Unit>
        <Value>6.060257</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="17">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Power (kW)</Unit>
        <Value>6.110984</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="18">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Power (kW)</Unit>
        <Value>6.022829</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="19">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Power (kW)</Unit>
        <Value>18.194069</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="20">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Tariff>0</Tariff>
        <Device>1</Device>
        <Unit>Power (kW)</Unit>
        <Value>15.388377</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="21">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Tariff>0</Tariff>
        <Device>2</Device>
        <Unit>Power (kW)</Unit>
        <Value>23.829105</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="22">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Manufacturer specific</Unit>
        <Value>0.763523</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="23">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Manufacturer specific</Unit>
        <Value>49.992569</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="24">
        <Function>Instantaneous value</Function>
        <StorageNumber>0</StorageNumber>
        <Unit>Energy (Wh)</Unit>
        <Value>33370162</Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

    <DataRecord id="25">
        <Function>More records follow</Function>
        <Value></Value>
        <Timestamp>2017-06-09T07:44:29</Timestamp>
    </DataRecord>

</MBusData>

best regards,
Ado

Build for debugging.

Is it possible add manual how to build it for debugging? I want make some changes.

config.status: error: cannot find input file: `Makefile.in'

Hi,

I'm trying to install libmbus 0.8.0 on ubuntu 12.04, but it allways shows the same error:

config.status: error: cannot find input file: `Makefile.in'

I paste the hole sequence:

root@ubuntuserver:~/libmbus-0.8.0# sh configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert i686-pc-linux-gnu file names to i686-pc-linux-gnu format... func_convert_file_noop
checking how to convert i686-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @file support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
configure: creating ./config.status
config.status: error: cannot find input file: Makefile.in' root@ubuntuserver:~/libmbus-0.8.0# config.status: error: cannot find input file:Makefile.in'

I'm not very good with unix systems, but I work a lot with Mbus devices, and I'm trying to make some test to see if I can use this library, because I think it coul be a very good tool.

Many thanks,

Daniel

Collision at address 4

iam working with L-MBUS20 of Loytec. I installed Rscada on Raspberry Pi3
i got this error, when i scan
/usr/share/mbus/libmbus/bin $ sudo ./mbus-serial-scan -d -b 2400 /dev/ttyUSB0
Scanning primary addresses:
0 [2018-01-16 16:05:53] SEND (005): 10 40 00 40 16
1 [2018-01-16 16:05:53] SEND (005): 10 40 01 41 16
2 [2018-01-16 16:05:53] SEND (005): 10 40 02 42 16
3 [2018-01-16 16:05:53] SEND (005): 10 40 03 43 16
4 [2018-01-16 16:05:54] SEND (005): 10 40 04 44 16
[2018-01-16 16:05:54] RECV (001): FD
Collision at address 4
5 [2018-01-16 16:05:55] SEND (005): 10 40 05 45 16
6 [2018-01-16 16:05:55] SEND (005): 10 40 06 46 16
[2018-01-16 16:05:55] RECV (001): FE
Collision at address 6
7 [2018-01-16 16:05:56] SEND (005): 10 40 07 47 16
8 [2018-01-16 16:05:56] SEND (005): 10 40 08 48 16
[2018-01-16 16:05:56] RECV (001): FC
Collision at address 8
How can i fix it?
Any advice will be appreciated

Raspberry Pi - libmbus.so.0

Hello, I've compiled libmbus in raspbian with kernel 3.12.28.
Now I get the following error when I run mbus-tcp-scan or mbus-serial-scan:

mbus-tcp-scan: error while loading shared libraries: libmbus.so.0: cannot open shared object file: No such file or directory

I've searched the file and it exist in /usr/local/lib/libmbus.so.0
So I added it to PATH with: export PATH=$PATH:/usr/local/lib
But still same error, any ideas?
/Per

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.