Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Read from mqtt server and publish to other service

Tags: #<Tag:0x00007f88c00c1c50>

I’m writing an influx interfacer to publish the data to influx and use grafana for visualisation. I currently have 2 emoncms instances running, one for test and one for my real data. I’m transferring data from one system to the other by subscribing both emonhub’s to the other mqtt server. This works for the interfaces described in the emonhub config. So interface A on server A publishes to MQTT, serverB subscribes to ToEmonCMS and injects the node inputs. Now I want to get messages from a mqtt topic on serverA: serverA/emon/TOPIC1 and use them as subchannel in another interface on server B, but I can’t seem to find a way to make emonhub on serverB do an MQTT subscribe to channel TOPIC1 on server A and put the data in ToEmonCMS, so the interface can use the data.

[[MQTT1]]
Type = EmonHubMqttInterfacer
[[[init_settings]]]

mqtt_user = emonpi
mqtt_passwd = emonpipw

[[[runtimesettings]]]
    subchannels = ToEmonCMS,
    pubchannels = emon/CHANNEL1
    timestamped = True   

[[Influx]]
Type = EmonHubInfluxInterfacer
[[[init_settings]]]
influx_user = grafana
influx_passwd = grafanapw
influx_db = test

[[[runtimesettings]]]
    subchannels = emon/CHANNEL1,

Great, it has been suggested in passing before.

I’m not sure the incoming MQTT part of emonhub was ever implemented.

Have a look at the code.

[edit]
Simplest way is to either post the data to both MQTT Brokers or bridge them together.

I was checking if someone tried this before, without digging into the code :slight_smile:
If I don’t manage to get it working, I’ll have to dig in the code or just ignore this and move my test code to my production system