MBus Reader

From BITPlan Wiki
Jump to navigation Jump to search

OsProject

OsProject
id  mbusreader
state  active
owner  WolfgangFahl
title  mbusreader
url  https://github.com/WolfgangFahl/mbusreader
version  0.0.1
description  Meterbus Reader
date  2025-01-22
since  2025-01-22
until  

Introduction

M-Bus or Meter-Bus is a European standard (EN 13757-2 physical and link layer, EN 13757-3 application layer) for the remote reading of water, gas or electricity meters.

MBus Viewer

Demo

The MBus Viewer is has a nicegui demo at https://mbus.bitplan.com

Command Line

mbus-viewer -h
usage: mbus-viewer [-h] [-a] [--apache APACHE] [-c] [-d]
                   [--debugServer DEBUGSERVER] [--debugPort DEBUGPORT]
                   [--debugRemotePath DEBUGREMOTEPATH]
                   [--debugLocalPath DEBUGLOCALPATH] [-l] [-i INPUT] [-rol]
                   [--host HOST] [--port PORT] [-s] [-V] [-rp ROOT_PATH]

MBus message parser and JSON result viewer

options:
  -h, --help            show this help message and exit
  -a, --about           show about info [default: False]
  --apache APACHE       create an apache configuration file for the given
                        domain
  -c, --client          start client [default: False]
  -d, --debug           show debug info [default: False]
  --debugServer DEBUGSERVER
                        remote debug Server
  --debugPort DEBUGPORT
                        remote debug Port
  --debugRemotePath DEBUGREMOTEPATH
                        remote debug Server path mapping - remotePath - path
                        on debug server
  --debugLocalPath DEBUGLOCALPATH
                        remote debug Server path mapping - localPath - path on
                        machine where python runs
  -l, --local           run with local file system access [default: False]
  -i INPUT, --input INPUT
                        input file
  -rol, --render_on_load
                        render on load [default: False]
  --host HOST           the host to serve / listen from [default: localhost]
  --port PORT           the port to serve from [default: 9996]
  -s, --serve           start webserver [default: False]
  -V, --version         show program's version number and exit
  -rp ROOT_PATH, --root_path ROOT_PATH
                        path to mbux hex files [default:
                        /home/wf/.local/lib/python3.10/site-
                        packages/mbusread_examples]

M-Bus Reader

Command line

mbus-reader -h
usage: mbus-reader [-h] [-c CONFIG] [-i IO_CONFIG] [-D DEVICE] [-m MESSAGE]
                   [--mqtt] [--lang {en,de}] [--debug]

M-Bus Reader

options:
  -h, --help            show this help message and exit
  -c CONFIG, --config CONFIG
                        Config file path (default: examples/mbus_config.yaml)
  -i IO_CONFIG, --io_config IO_CONFIG
                        IO config file path (default: /tmp/mbus_io.yaml)
  -D DEVICE, --device DEVICE
                        Device type (default: cf_echo_ii)
  -m MESSAGE, --message MESSAGE
                        Message ID to send
  --mqtt                Enable MQTT publishing
  --lang {en,de}        Language for messages (default: en)
  --debug               Enable debug logging

Examples configuration

MBus message examples are configurable via yaml see https://github.com/WolfgangFahl/mbusreader/blob/main/mbusread_examples/mbus_examples.yaml

# Example definitions for mbus viewer tool
# WF 2025-01-22

manufacturers:
  allmess:
    name: Allmess
    url: https://www.allmess.de
    country: Germany
devices:
  cf_echo_ii:
    mid: allmess
    model: CF Echo II
    title: ''
    doc_url: https://www.allmess.de/fileadmin/multimedia/alle_Dateien/MA/MA_BA_12088-AC%20CF%20Echo%20II%20D%20TS1021_KL.pdf
  ultramaxx:
    model: CF UltraMaxx V
    mid: allmess
    url: https://de.itron.com/de/products/cf-ultramaxx-v
    doc_url: https://www.gavilar.nl/files/cf-ultramaxx-v-03-13.pdf

examples:
  # CF Echo II
  cf_echo_basic:
    did: cf_echo_ii
    name: Basic Reading
    title: Standard M-Bus reading
    hex: 684d4d680800722654832277040904360000000c78265483220406493500000c14490508000b2d0000000b3b0000000a5a18060a5e89020b61883200046d0d0c2c310227c80309fd0e2209fd0f470f00008d16
  cf_echo_init:
    did: cf_echo_ii
    name: init write
    title: CF Echo II init
    hex: 6803036873fea61716
  #cf_echo_ini2:
  #  did: cf_echo_ii
  #  name: init write2
  #  title: CF Echo II init2
  #  hex: 68 06 06 68 73 fe a1 55 82 02 eb 16
  cf_echo_read_data_cmd:
    did: cf_echo_ii
    name: read data cmd
    title: CF Echo II read data command
    hex: 105BFE5916
  ultramaxx_message1:
    did: ultramaxx
    name: message1
    title: UltraMaxx Message 1
    hex: 68 03 03 68 53 fe a6 f7 16

  ultramaxx_message2:
    did: ultramaxx
    name: message2
    title: UltraMaxx Message 2
    hex: 10 40 fe 3e 16

  ultramaxx_message3:
    did: ultramaxx
    name: message3
    title: UltraMaxx Message 3
    hex: 68 04 04 68 53 fe 50 01 a2 16 10 5b fe 59 16
    valid: false

  ultramaxx_message4:
    did: ultramaxx
    name: message4
    title: UltraMaxx Message 4
    hex: 68 04 04 68 53 fe 50 00 a1 16 10 5b fe 59 16
    valid: false

  ultramaxx_message5:
    did: ultramaxx
    name: message5
    title: UltraMaxx Message 5
    hex: 68 06 06 68 53 fe a7 02 1a 19 2d 16

  ultramaxx_reading1:
    did: ultramaxx
    name: reading1
    title: UltraMaxx reading
    # hex: 68 1c 1c 68 08 00 72 81 94 36 20 92 26 17 04 58 00 00 00 0f 10 07 11 00 12 03 3b 2b 81 94 36 20 2d 16
    hex: 68 1c 1c 68 08 00 72 81 94 36 20 92 26 17 04 60 00 00 00 0f 10 07 11 00 12 03 a0 01 81 94 36 20 70 16

  ultramaxx_reading2:
    did: ultramaxx
    name: reading2
    title: UltraMaxx reading2
    hex: 68 21 21 68 08 00 72 81 94 36 20 92 26 17 04 61 00 00 00 0c 78 81 94 36 20 3b fd 75 93 00 00 3b a6 6d 00 00 00 96 16

  ultramaxx_reading3:
    did: ultramaxx
    name: reading3
    title: UltraMaxx reading3
    hex: |
        68 4d 4d 68 08 00 72 81 94 36 20 92 26 17 04
        62 00 00 00 0c 78 81 94 36 20 04 06 5c a0 00
        00 0c 14 03 59 36 00 0b 2d 24 00 00 0b 3b 81
        00 00 0a 5a 60 05 0a 5e 02 03 0b 61 81 25 00
        04 6d 16 11 36 31 02 27 07 07 09 fd 0e 07 09
        fd 0f 11 0f 00 00 b2 16
  ultramaxx_reading4:
    did: ultramaxx
    name: reading4
    title: UltraMaxx reading4
    hex: |
      68 18 18 68 08 00 72 81 94 36 20 92 26 17 04
      63 00 00 00 0f f6 ca ee 41 a0 8b ce 41 53 16

WhatLinksHere