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.
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.
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.
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