EmonHub Interfacers


EmonHub is a piece of software running on the emonPi and emonBase that can read/subscribe or send/publish data to and from a multitude of services. It is primarily used as the bridge between the OpenEnergyMonitor monitoring hardware and the Emoncms software but it can also be used to read in data from a number of other sources, providing an easy way to interface with a wider range of sensors.

SDS011 Air-Quality sensor

1. Plug the SDS011 sensor into a USB port on either the emonPi or emonBase.

2. Login to the local copy of Emoncms running on the emonPi/emonBase and navigate to Setup > EmonHub. Click on ‘Edit Config’ and add the following config to the interfacers section to enable reading from the SDS011 sensor:

readinterval: Interval between readings in minutes, it is recommended to read every 5 minutes to preserve sensor lifespan.

Example SDS011 EmonHub configuration:

[[SDS011]]
    Type = EmonHubSDS011Interfacer
    [[[init_settings]]]
        com_port = /dev/ttyUSB0
    [[[runtimesettings]]]
        readinterval = 5
        nodename = SDS011
        pubchannels = ToEmonCMS,

3. The SDS011 readings will appear on the Emoncms Inputs page within a few minutes and should look like this:

Tip: When logging the SDS011 inputs to feeds, make sure to set the feed interval to match the sensor readinterval, e.g select 5 minutes if readinterval is set to 5.

Reading from a SDM120 single-phase meter

The SDM120-Modbus single phase electricity meter provides MID certified electricity monitoring up to 45A, ideal for monitoring the electricity supply of heat pumps and EV chargers. A USB to RS485 converter is needed to read from the modbus output of the meter such as: https://www.amazon.co.uk/gp/product/B07SD65BVF. The SDM120 meter comes in a number of different variants, be sure to order the version with a modbus output.

1. Connect up the USB to RS485 converter to the modbus output of the SDM120 meter and plug the converter into a USB port on either the emonPi or emonBase.

2. Login to the local copy of Emoncms running on the emonPi/emonBase and navigate to Setup > EmonHub. Click on ‘Edit Config’ and add the following config to the interfacers section to enable reading from the SDM120 meter:

read_interval: Interval between readings in seconds

Example SDM120 EmonHub configuration:

[[SDM120]]
    Type = EmonHubSDM120Interfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = SDM120

3. The SDM120 readings will appear on the Emoncms Inputs page within a few seconds and should look like this:

Tip: When logging the SDM120 cumulative energy output (sdm_E) to a feed, use the ‘log to feed (join)’ input processor to create a feed that can work with the delta mode in graphs. This removes any data gaps and makes it possible for the graph to generate daily kWh data on the fly.

MBUS Reader for Electric and Heat meters

Many electricity and heat meters are available with meter bus (MBUS) outputs. Using an MBUS to UART converter, these can be read from an emonPi or emonBase. For heat pumps, this provides a convenient way of monitoring the heat output, flow temperature, return temperature, flow rate and cumulative heat energy provided by the system.

1. Connect up the USB to MBUS converter to the MBUS output of the meter and plug the converter into a USB port on either the emonPi or emonBase.

2. Login to the local copy of Emoncms running on the emonPi/emonBase and navigate to Setup > EmonHub. Click on ‘Edit Config’ and add the following config in the interfacers section to enable reading from the MBUS meter:

  • baud: The MBUS baud rate is typically 2400 or 4800. It is usually possible to check the baud rate of the meter using the meter configuration interface.
  • address: The address of the meter is also usually possible to find via the meter configuration interface. If in doubt try 0 or 254.
  • pages: Some meters such as the Sontex 531 have infomation on multiple MBUS pages (These are 3,1 on the Sontex 531). For other meters just set to 0.
  • read_interval: Interval between readings in seconds.

Example MBUS EmonHub configuration:

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device = /dev/ttyUSB0
        baud = 4800
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        address = 100
        pages = 3,1
        read_interval = 10
        nodename = MBUS

3. The MBUS readings will appear on the Emoncms Inputs page within a few seconds and for the Sontex 531 should look like this:

Tip: When logging the cumulative energy output (Energy) to a feed, use the ‘log to feed (join)’ input processor to create a feed that can work with the delta mode in graphs. This removes any data gaps and makes it possible for the graph to generate daily kWh data on the fly.

Direct DS18B20 temperature sensing

This EmonHub interfacer can be used to read directly from DS18B20 temperature sensors connected to the GPIO pins on the RaspberryPi. At present a couple of manual setup steps are required to enable DS18B20 temperature sensing before using this EmonHub interfacer.

Manual RaspberryPi configuration:

1. SSH into your RaspberryPi, open /boot/config.txt in an editor:

sudo nano /boot/config.txt

2. Add the following to the end of the file:

dtoverlay=w1-gpio

3. Exit and reboot the Pi

sudo reboot

4. SSH back in again and run the following to enable the required modules:

sudo modprobe w1-gpio
sudo modprobe w1-therm

Configuring the Interfacer:

Login to the local copy of Emoncms running on the emonPi/emonBase and navigate to Setup > EmonHub. Click on ‘Edit Config’ and add the following config in the interfacers section to enable reading from the temperature sensors.

  • read_interval: Interval between readings in seconds.
  • ids: This can be used to link specific sensors addresses to input names listed under the names property.
  • names: Names associated with sensor id’s, ordered by index.

Example DS18B20 EmonHub configuration:

[[DS18B20]]
    Type = EmonHubDS18B20Interfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sensors
        # ids = 28-000008e2db06, 28-000009770529, 28-0000096a49b4
        # names = ambient, cyl_bot, cyl_top

Direct Pulse counting

This EmonHub interfacer can be used to read directly from pulse counter connected to a GPIO pin on the RaspberryPi.

  • pulse_pin: Pi GPIO pin number must be specified. Create a second interfacer for more than one pulse sensor
  • Rate_limit: The rate in seconds at which the interfacer will pass data to emonhub for sending on. Too short and pulses will be missed. Pulses are accumulated in this period.
  • nodeoffset: Default NodeID is 0. Use nodeoffset to set NodeID

Example Pulse counting EmonHub configuration:

[[pulse]]
    Type = EmonHubPulseCounterInterfacer
    [[[init_settings]]]
        pulse_pin = 15
        # bouncetime = 2
        # rate_limit = 2
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        nodeoffset = 3

Read State of charge of a Tesla Power Wall

This interfacer fetches the state of charge of a Tesla Power Wall on the local network. Enter your PowerWall IP-address or hostname in the URL section of the following emonhub.conf configuration:

[[PowerWall]]
    Type = EmonHubTeslaPowerWallInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        name = powerwall
        url = http://POWERWALL-IP/api/system_status/soe
        readinterval = 10

Modbus Renogy

See example config:
EmonHub Github: Renogy.emonhub.conf

SMA Solar

See example config and documentation:
EmonHub Github: SMA Solar

Victron VE.Direct Protocol

See example config and documentation:
EmonHub Github: Victron VE.Direct Protocol

Modbus TCP

See example config and documentation:
EmonHub Github: modbus TCP configuration