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