OpenEnergyMonitor Community

Influxdb interfacer

Tags: #<Tag:0x00007f88cf84ff58>

I’ve created a PR for an influx interfacer:

and a sneak preview of 2 of my emonhub interfacers publishing directly to influxdb

It’s starting to look at something

I haven’t got all metrics in yet, they just started pushing in this evening, but first results are promising.
I hope to create a dashboard with all my specific appliances and daily load of them, so I can find out where to replace/cut the cord :slight_smile:
As you can see, my calibration is a bit off. I tried my best to match them all with the correct specs, but the spread is just to big. Most of the time my real meter load is 0, which is bad for those CT’s ranged for 100A, which I’m using on my main circuit lines. The measurements from my inverter are also in the system, but using them as calibration made the offset even worse for some of the sensors, so I’ll have to live with the slight differences.

Nice work @ziporah thats a great idea, thanks for sharing! I will test and get this pull request merged

I’ve looked at the mqtt code as well, but this needs some rework. Currently it will only capture emonhub/tx//value topics and requires the value to be in int. I’m thinking of modifying the code so it can use RPICT4V3/dishwasher for example, so I can grab kwhd values from emoncms and publish them in influxdb, that would make the grafana setup even more powerfull. Now it requires quite some work to view my house load for example, since I need to combine 3 phases and 3 measurements per phase in grafana to get the overall usage as my hybrid inverter tries to balance my meter load to 0, while if I export it directly out of emoncms, it just takes one input.

You have any suggestions for naming or can I just extend the on_message function with additional logic to subscribe to pub_topics for example instead of pub_channels?
I can also parse pub_channels to be able to use non-emonhub-prefix as subscriptions

def on_connect(self, client, userdata, flags, rc):
# Subscribe to MQTT topics
# Need additional topics here
self._mqttc.subscribe(str(self._settings["node_format_basetopic"]) + "tx/#")
def on_message(self, client, userdata, msg):
# Need logic here
for channel in self._settings["pubchannels"]:
# Add cargo item to channel
self._pub_channels.setdefault(channel, []).append(rxc)
self._log.debug("%d Sent to channel' : %s", rxc.uri, channel)

I suggest you offer both a value (int or float) and a JSON input.

The value input is more obvious as emoncms will only publish values via MQTT currently.

Base it on a specified base topic that the interfacer then subscribes to. You can then pass multiple values to the interfacer.

The other thing to consider is to pull data into InfluxDB via MQTT and Telegraf. This is how I do it currently.

1 Like

Apologies if I am not seeing it, but assuming this is ready for use, could you provide some examples of how to set this up?

I’ve not really used EmonHub much beyond it being on the EmonPi but I would love to get a copy of the feeds into my InfluxDB which has all my OpenHab data in (including 2 other power monitoring sources) and be able to display alongside other stats.

this is the configuration example and this should push all channels you’re subscribed to into influx.
You need another interfacer reading from mqtt so the influxdb kan catch those metrics and inject them into your influx instance. As stated above, it will now only read emonhub/tx//value topics. The other modifications are not in place.