MicroPython implementation of the Meter-Bus (M-Bus EN13757-3) protocol.
Due to rising prices for oil, gas and heat as well as climate change, it is becoming more and more important to monitor energy consumption in order to keep an eye on energy costs, but also to be able to check the effectiveness of savings. Many meters for oil and gas, but also for water, are equipped with a special 2 wire bus system, the M-BUS or meter bus, for monitoring consumption values.
I've tested this code with our Arduino MKR M-BUS shield and the Arduino Portenta H7 (via OpenMV IDE) and the Raspberry Pico (via Thonny IDE).
MicroPython will not support the decimal function of standard Python. To solve this problem the library micropython-decimal-number is required.
Please enable/ disable the lines for UART configuration in the examples for your board first!
This program will scan the M-Bus for devices via the primary (logical) address. Currently it is limited to address 6 as maximum, but you can change the value MAX_PRIMARY_SLAVES in defines.py for upto 250 primary addresses.
This program will scan the M-Bus for devices via the secondary address.
Will request the data from a slave device via primary address first and secondary address. The data is returned in JSON format.
Based on the pyMeterBus project by Mikael Ganehag Brorsson