Emonhub stand-alone config

I wanted to use emonhub to read from a heatmeter without using any external services. My long-term plan was to forward data for others to share but short-term I wanted a system that would still work even if internet service was temporarily disrupted. This is because I have an issue where my LG ASHP can fail when the return temperature gets too low. I wanted a reliable setup that could activate the immersion heater in those circumstances.

My heatmeter is a Sontex 531 and I am running this and other functions such as the thermostat and demand response on a raspberry pi running a current version of Raspbian.

I started with a normal emonhub install, planning to simply edit the config accordingly.

I tried redirecting the output to a local server but this did not work. Never found out why but I knew the EmonHubEmoncmsHTTPInterfacer was not designed for this mode of use.

My next attempt involved getting rid of that piece of config and instead publishing the data to a local MQTT instance. See final config below. From there I could write a small piece of subscriber code to forward the data to the right place.

The subscriber to this is set to follow topic emonhub/#
It finds all the data on topic emonhub/rx/heatmeter/values

The point to note is that the config is mentioning MQTT channels which are being ignored.

If you take out any part of the MQTT config it doesn’t connect to the broker at all. There are some error messages which helped me track this down.

Here’s the working config:

[hub]
### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
loglevel = ERROR ##DEBUG
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
#######################       Interfacers       #######################
#######################################################################

[interfacers]

[[MQTT]]
    Type = EmonHubMqttInterfacer
        [[[init_settings]]]
            mqtt_host = 127.0.0.1
            mqtt_port = 1883
            mqtt_user = emonpi
            mqtt_passwd = <your_pw_here>
        [[[runtimesettings]]]
             subchannels = ToEmonCMS,
             pubchannels = emon/CHANNEL1, #ignored
             timestamped = True           #ignored

[[MBUS]]
    Type = EmonHubMBUSInterfacer
    [[[init_settings]]]
        device = /dev/ttyAMA0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,         #ignored
        read_interval = 10
        validate_checksum = False
        nodename = heatmeter
        [[[[meters]]]]
            [[[[[heatmeter]]]]]
                address = 1
                type = sontex531

Firstly, you are misunderstanding what a pubchannel is (it is purely internal, not an MQTT topic) - read this emonHub Configuration File — OpenEnergyMonitor 0.0.1 documentation

Secondly, I would specify the topic the MQTT interfacer uses, not rely on the defaults. emonHub Default Configuration — OpenEnergyMonitor 0.0.1 documentation

Finally, I’m not sure what your problem is.

Unsurprisingly, a broken config causes it to fail.

??

Thx @bopin. Now I know that the channels are not MQTT-related. My objective was to assist others who, like me, just wanted to get it working. However, it may be worth mentioning that I don’t think the doc explains what channels are in this context and why they are needed in the config when not acted upon. (I imagine that this is described elsewhere.)

https://docs.openenergymonitor.org/emonhub/overview.html#basic-concept

As I say, I am not understanding what your issue or point is.

Generally, RTFM (all of it).

This is not ignored. It fundamentally is the link to the MQTT Interfacer.

As per the docs, you need a blank line after the pubchannels line. (emonHub Configuration File — OpenEnergyMonitor 0.0.1 documentation)

This is not ignored it is that you do not have a corresponding Interfacer (subchannel) to accept any incoming data and make use of it.