Python service linking and decoding input to MQTT & Emoncms
Switch branches/tags
Clone or download

emonHub (emon-pi variant)

Emonhub is used in the OpenEnergyMonitor system to read data received over serial from either the EmonPi board or the RFM12/69Pi adapter board then forward the data to emonCMS in a decoded ready-to-use form - based on the configuration in emonhub.conf

More generally: Emonhub consists of a series of interfacers that can read/subscribe or send/publish data to and from a multitude of services. EmonHub supports decoding data from:

Default Interfacers

  • EmonHubJeeInterfacer: Decode data received from RFM69Pi & emonPi in JeeLabs data packet structure e.g. emonTx, emonTH, JeeNode RFM12 demo etc.
  • EmonHubMqttInterfacer: Publish decoded data to MQTT

Other Interfacers

See interfacer specific readmes in /conf/interfacer_examples

  • Direct Serial: space seperated value format
  • Direct Serial (emontx3e): current emonTx V3 CSV key:value format (added by @owenduffy)
  • Smilics energy monitors (added by @K0den)
  • Victron Products e.g BMV 700 battery monitor (added by @jlark)
  • ModBus e.g. FRONIUS Solar inverter (added by @cjthuys)
  • Graphite timeseries DB (added by @hmm01i)
  • SMASolar (added by @stuartpittaway)
  • BMW EV API e.g state of charge, charging state etc. (added by @stuartpittaway)

Emonhub is included on the emonsD pre-built SD card used by both the EmonPi and Emonbase. The documentation below covers installing the emon-pi variant of emonhub on linux for self build setups.

'Emon-Pi' variant

This variant of emonhub is based on @pb66 Paul Burnell's experimental branch adding:

  • Internal pub/sub message bus based on pydispatcher
  • Publish to MQTT
  • Https Emoncms interface
  • A multi-file implementation of interfacers.
  • Rx and tx modes for node decoding/encoding provides improved control support.
  • json based config file option so that emonhub.conf can be loaded by emoncms

emonhub.conf configuration

Installing Emonhub

Emonhub requires the following dependencies:

Mosquitto: (see

sudo apt-key add mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/

Depending on which version of Debian you're using:

sudo wget


sudo wget

Update apt information:

sudo apt-get update

sudo apt-get install -y mosquitto python-pip python-serial python-configobj
sudo pip install paho-mqtt
sudo pip install pydispatcher

It is recommended to turn off mosquitto persistence

sudo nano /etc/mosquitto/mosquitto.conf


persistence false

Install the emon-pi variant of emonhub:

git clone && emonhub/install
sudo service emonhub start

The emonhub configuration guide can be found here:

emonhub.conf configuration

To view the emonhub log via terminal on the emonpi or emonbase:

tail -f /var/log/emonhub.log

EmonHub Emoncms config module

If you're using Emoncms on the same Raspberry Pi as emonhub, you may find the emoncms config module useful which provides in-browser access to emonhub.conf and emonhub.log: