Skip to content

A sample app which drives the M-Bus Master Hat using python.

License

Notifications You must be signed in to change notification settings

packom/pyMbusHat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

A simple python app which uses the M-Bus Master Hat and pyMeterBus to read data from an M-Bus slave.

Setup

sudo apt install python-pip
pip install -r requirements.txt

Also, if this is the first time using the M-Bus Master Hat, follow the installation instructions here.

Running

Edit py_mbus_hat.py and change the slave_address to the appropriate value. Then:

python py_mbus_hat.py

Operation

  • Checks for an M-Bus Master Hat. If this fails then it is likely you don't have an M-Bus Master Hat installed, or you haven't rebooted the Pi since installing it (remove and then reapply power).

  • Turns on the M-Bus. The M-Bus power led on the Hat should illuminate.

  • Reads data from the slave configured above.

  • Outputs the data read.

  • Turns off the M-Bus, cleans up and exits.

Errors

If you have been using the serial port using other software you may get a warning that the serial channel is already in use. You can suppress the warning by adding:

GPIO.setwarnings(False) 

You may find that the bus needs to be left powered longer than 0.1s (the default in the script) to allow successful reads of the bus. This is likely to be more prevalent in bus powered meters, as they need some time to power on and stabilise after the bus is powered.

About

A sample app which drives the M-Bus Master Hat using python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages