Best way to integrate with HomeAssistant

I’m not sure if this has already been answered so apologies if it has.

I have a Pi running emoncms logging power usage and solar generation etc. I also have another Pi running various things including Home Assistant. What I’d like to do is add some automations to my HA system based on realtime data coming from emoncms/emonhub. I’m not sure of the best way to tackle this.

My first thought was to get emoncms to use the MQTT server on the HA Pi. The only downside I can think of is if there is a network outage for any reason then data would be lost.

My other thought was to forward MQTT data using Node Red or something. I would rather not add anything to the emoncms Pi as it has been working fine for many years.

Any advice appreciated. Thank you

Did you search?

As part of the emoncms Input process, you can publish data back out to MQTT

Alternatively you could use the emoncms component in HA.

Alternatively use Node-Red with HA and connect to the EmonPi broker and create the sensors there.

Alternatively you could bridge the 2 MQTT Brokers together.

I have suggested to @TrystanLea the integration with HA needs to be addressed.

Yes, I did search - on here and on the wider internet.

Thanks for your suggestions Brian.

I could work out how to do this myself with various tools but I wanted to hear what people’s recommendations are. Perhaps I should have worded my question differently.

I did think of bridging the MQTT brokers but when searching for packages to do that it seems that particular wheel has been invented multiple times. I wasn’t sure which solution to go with.

I tried the emoncms component in HA but for some reason it does absolutely nothing with my setup. I checked API access from the HA Pi so I know it works. Also not sure how “realtime” the updates would be.

I think I’m hovering between your suggestion of republishing and Node Red. I don’t know how to republish so I’ll have to look into that.


It is just a configuration on one of the Brokers - Mosquitto MQTT Bridge-Usage and Configuration.

Search on this forum - there is a kluge to get it to work (you need to tell HA it is an energy component which it doesn’t do currently).

In Emoncms, on the Inputs page, edit the processes, and at the right point in the process, add the publish to MQTT process.

The right way is the way that works for you!

I’ve used the built-in MQTT bridge and it works for me. I’m not sure how I missed that when I was searching - all I came up with was lots of Github projects.

I now have the emontx values being replicated into my other MQTT server which is being picked up by HA.

Thanks @borpin !

1 Like

As with others, I used the mqtt bridge to get around network outages and the like. Works very well.


I haven’t bothered with an MQTT bridge. I simply use one MQTT for both Emon and HASS.

I have the HA Emon integration added and all my feeds are recorded in HASS and I have used them for the energy dashboard and a few other bits and pieces so far.

I have one Broker on a PVE container setup on a laptop - so it is highly robust. I bridge this to the HA add-on then pick up everything for HA from that. It has sort of grown like that but there is little overhead on the HA side so I just leave it be :slight_smile:

A post was split to a new topic: Integrating with HomeAssistant