I’m using a self hosted version 9.7.8 of emoncms on a raspberry pi2 installed with emonSD.
I have searched everywhere and have not been able to find the purpose or meaning of
[[[runtimesettings]]]
pubchannels = ToRFM12,
subchannels = ToEmonCMS,
in the [[MQTT]] section of emonhub and a couple of other places in config files.
Is “pubchannels” and “subchannels” a construct of MQTT (which I haven’t been able to find) or is it CURRENTLY being used in the emoncms eco-system? Do I need it and if so how do I use it?
The “subchannels” and “pubchannels” are nothing to do with MQTT, they are the internal channels of emonHub, used to route data between certain interfacers.
By sending your data direct to the local emoncms via MQTT you are bypassing emonHub and therefore unable to send to emoncms.org.
What format is your MQTT payload from your Brultech ECM1240 ? I assume it is via a script or node-red perhaps as I see no mention of MQTT in the spec of that device. How is it connected? is it local to the Pi? What is the original output format like?
enonHub is intended to be the HUB for connecting, collating and directing the data. What should happen with an MQTT data source is emonHub subscribes to that source and then forwards it to emonCMS(s) via HTTP or MQTT,
Tell us more about what you have going on and we’ll see if we can help.
The Brutech ECM1240 communicates with BTmon via TCPIP (in my case but serial is also supported)
BTmon was installed on the same rPi2 that was loaded with emonSD.
BTmon can post data directly to emonCMS or to MQTT and many other interfaces.
My configuration has the direct to emonCMS disabled and MQTT enabled
I don’t know the format but the data shows up fine in local emoncms inputs
Node 204975_volts
Node … Key… Name …Value
204975_volts… 0… Line Voltage…118.6
I thought the emonhub config gave emonhub all the info needed to grab the MQTT data.
Do I have to create a feed to MQTT for each topic in emomonCMS local so that emonhub can pick it up
to forward to emoncms.org? Why doesn’t emonhub grab all the messages with basetopic the same way
that emonCMS local does?
The way that MQTT is currently implemented in emonHub and emonCMS doesn’t give a lot of flexibility.
The way MQTT is published so that any authorized software can subscribe to it means that you cannot have emonHub (or any other software) subscribe to the same topic as emoncms AND forward data from other sources to emoncms on the same topic, as that would create an infinite loop.
Data can either be published to 2 separate topics, one for local emonCMS and the other for emonHub to send to remote emonCMS OR alternatively data can be published to one topic which emonHub then forwards to both instances of emonCMS.
Are you able to SSH into the emonPi and show us the output from this command?
It consists of 2 high current channels, and 5 auxillary channels
each one reports watts, watt-hours and watt-hours / day
as well as the line voltage
(I see some datapoints are missing but that would be at my end)
Paul, your reply suggests I should be able to “Publish to MQTT” a feed with a new topic in emoncms local and have the new topic picked up from the MQTT server and forwarded to emoncms.org.
I have tried to do this but I am missing something.
Publishing the data to “newtopic” shows up fine in MQTT
emonhub is talking to emoncms.org but sending a packet with no data.
Where in the emonhub config file would I specify the “newtopic” for emonhub to subscribe to
Here is what I have in config now:
[[MQTT]]
Type = EmonHubMqttInterfacer
[[[init_settings]]]
mqtt_host = 127.0.0.1
mqtt_port = 1883
mqtt_user = emonpi
mqtt_passwd = emonpimqtt2016
[[[runtimesettings]]]
pubchannels = ToRFM12,
subchannels = ToEmonCMS,
# emonhub/rx/10/values format
# Use with emoncms Nodes module
node_format_enable = 0
node_format_basetopic = emonhub/
# emon/emontx/power1 format - use with Emoncms MQTT input
# http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
nodevar_format_enable = 1
nodevar_format_basetopic = emon
[[emoncmsorg]]
Type = EmonHubEmoncmsHTTPInterfacer
[[[init_settings]]]
[[[runtimesettings]]]
pubchannels = ToRFM12,
subchannels = ToEmonCMS,
url = https://emoncms.org
apikey = xxx........................xxxxc
senddata = 1 # Enable sending data to Emoncms.org
sendstatus = 1 # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
sendinterval= 60 # Bulk send interval to Emoncms.org in seconds
i’m guessing you mean one batch of packets or one cycle, each of those lines is an individual publish and each has it’s own packet/payload containing just the current value.
This is part of the problem, once the data is separated like that it is difficult to regroup and sending 22 http requests in place of one is not only inefficient for the sender, the network and emonCMS, it causes issues with both the input processing and the timestamping, any delays caused by the high traffic and’or the network will be added to each and every datapoint which means the regular samples become irregular datapoints and are offset with the actual time captured,
That certainly wasn’t my intention, that is most likely the least efficient way of doing it and I’m not sure it would even be possible with the current MQTT implementation in emonHub.
Is the BTMon software able to publish as CSV to one topic? or send to a socket?
Where is this device relative to the emonPi? is the serial connection a possibility?
I see there is mention of a emoncms.org over http configuration for BTMon, could you not just use that to send directly to emoncms.org in parallel with your MQTT rather than trying to regroup the splintered payload or battering emoncms.org with too many requests?
Serial is not an option because the ECM1240 has to be by the electrical service panel and the rPi is at the other end of the house in my office.
I tried to get btmon to post to emoncms.org before without success. I’m going to give that another try now that I have a better understanding of what the data flows are supposed to be…
I had btmon posting directly to emoncms local with http using the oem parameters in the btmon.cfg file.
If it is just a matter of changing the url to emoncms.org and changing the api key - it should work.
I’ll give that a try.