M-Bus Software – libmbus (Linux)
libmbus
Informatie (ENG)
libmbus is an open source library for the M-bus (Meter-Bus) protocol.
The Meter-Bus is a standard for reading out meter data from electricity meters, heat meters, gas meters, etc. The M-bus standard deals with both the electrical signals on the M-Bus, and the protocol and data format used in transmissions on the M-Bus. The role of libmbus is to decode/encode M-bus data, and to handle the communication with M-Bus devices.
Installeren op de Raspberry Pi
Middels de volgende commando’s kan libmbus gedownload en geïnstalleerd worden:
1 2 3 4 5 |
sudo apt-get install subversion autoconf libtool sqlite3 git clone https://github.com/rscada/libmbus.git cd libmbus ./build.sh sudo make install |
Hieronder een instructie voor de oudere Raspberry Pi OS (libmbus v0.8.0 werkt niet op v3 met Jessie):
1 2 3 4 5 6 7 8 9 |
sudo apt-get install libtool automake wge(t) https://github.com/rscada/libmbus/archive/0.8.0.zip unzip 0.8.0.zip cd libmbus-0.8.0 autoheader && aclocal && libtoolize --ltdl --copy --force && automake --add-missing --copy && autoconf ./configure make sudo make install sudo ln -s /usr/local/lib/libmbus.so.0 /usr/lib/libmbus.so.0 |
Gebruik van libmbus
Zoeken naar apparaten:
mbus-serial-scan /dev/ttyUSB0 (your usb number might be different)
Informatie van apparaat tonen:
mbus-serial-request-data /dev/ttyUSB0 <device number>
Voorbeeld XML dump
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
<MBusData> <SlaveInformation> <Id>69599538</Id> <Manufacturer>KAM</Manufacturer> <Version>15</Version> <ProductName></ProductName> <Medium>Heat: Outlet</Medium> <AccessNumber>2</AccessNumber> <Status>00</Status> <Signature>0000</Signature> </SlaveInformation> <DataRecord id="0"> <Function>Instantaneous value</Function> <Unit>Fabrication number</Unit> <Value>69599538</Value> <Timestamp>2014-11-17T14:54:29</Timestamp> </DataRecord> <DataRecord id="1"> <Function>Instantaneous value</Function> <Unit>Energy (10 kWh)</Unit> <Value>0</Value> <Timestamp>2014-11-17T14:54:29</Timestamp> </DataRecord> ... <DataRecord id="26"> <Function>Instantaneous value</Function> <Unit>Time Point (date)</Unit> <Value>2000-00-00</Value> <Timestamp>2014-11-17T14:54:29</Timestamp> </DataRecord> <DataRecord id="27"> <Function>Manufacturer specific</Function> <Value>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0E B0 A6 02 98 53 00 00 C3 FC 24 00 32 01 26 04 00 00 00 00 11 13 01 08 01 70 01 0C 00 00 00 00 00</Value> <Timestamp>2014-11-17T14:54:29</Timestamp> </DataRecord> </MBusData> |
Bronnen:
domotiga.nl
sites.google.com
Problems
Problem
mbus-serial-scan
mbus-serial-scan: error while loading shared libraries: libmbus.so.0: cannot open shared object file: No such file or directory
Search the file: sudo find / | grep libmbus.so.0
/usr/local/lib/libmbus.so.0
export PATH=$PATH:/usr/local/lib
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/usr/local/lib
Still same error, to be continued on github.
On another Ubuntu machine with libmbus installed from prebuilt binay it’s located in /usr/lib/libmbus.so.0
Solution
Make a soft link between current position and expected position:
sudo ln -s /usr/local/lib/libmbus.so.0 /usr/lib/libmbus.so.0
bron: http://bends.se/?page=anteckningar/automation/m-bus/libmbus