Home assistant mqtt broker connection to emoncms

Hello,

okay so i have a MQTT broker setup in home assistant.

its hostname is core-mosquitto.local.hass.io

and i created a user/pass for it.

i can’t exactly recall how i linked my other pi running solar assistant mqtt to it, but i have that data in home assistant.

i have just installed the addon for emoncms, and i learnt my broker has to publish topic ‘emon’

i am quite confused as i do not want to break my present dashboards,

i also seem not to understand what host i should specify in the emoncms settings

i input my broker details outlined above but that appears not to work as apparently emoncms requires me to publish prefix emon

perhaps someone understands how to fix this?

thank you

The 3 questions in red are self explanatory. It needs to log into your broker. It needs an IP address, a login name, and a password to do so.

You would get that info from the broker. If you are running HAOS with an add-on you would look at the information you put in the add-on configuration, or you would need to add another login and password for this application.

here:

I use secrets, but you can just create a login and password in clear test instead of the secrets. Restart the addon and the password should be available.

Thank you.

I have done as outlined.

from what i gather, i will need to change the published prefix for all of the other brokers in my network to match what is pre-configured in the emoncms container.

but that will break my present setup so unless i figure out a way to change the emoncms settings, it will not be possible to use this.

Thanks for the assistance

So in
mqtt_host you enter the ip of the solar assistant mqtt
in mqtt_user you enter the username you use to connect to solar assistant
in mqtt_password you enter the password you use to connect to solar assistant

Multiple brokers can make things confusing. If you have an application with an embedded broker and a pseudo dedicated function, then keep that stuff together.

Otherwise all the random other and possibly unrelated stuff can go in the same broker and no thing has to change to use the other thing.
Brokers are there to receive info from hosts and make it available to other hosts that are subscribed and asking for that info. That’s it.

Why ? Mqtt clients only listen to the prefix they are configured to listen to. Having another prefix on the same prefix does not disturb them.

Emoncm only listens on prefix ‘emon’, unless you edit the config files

But because this install as a home assistant addon container, i can’t edit the emoncms config files. well, i’ve tried to do it inside the container, but it doesn’t work.

i think the settings are mapped in the host Home Assistant file system, and i don’t have access to that

So this

addon has it’s own broker internal, is that what you are trying to say? Or is it a client?
And no, it is a very bad idea to edit an addon’s container internals. Use what is available in the config file.

Thank you all.

so i did some more googling, and found the following solution

You create a folder in home Assistant /share/mosquitto

Then you make a .conf file in it for Solar Assistant.

connection SolarAssistant
#remote_username
#remote_password
address 192.168.1.101
topic # in
topic solar_assistant/# out

so what i did is make a mosquitto bridge.conf file in the same folder to bridge the two prefixes solar_assistant and emon

connection bridge01
address 192.168.1.101:1883
remote_username emonpi
remote_password emonpimqtt2016
topic # both 0  emon/ solar_assistant/

and after a reboot the data showed up in emoncms. problem solved

1 Like

I think @francisp was on it then but the rest of us were trying to figure it out…
You should consider giving them the solution tag…

@francisp is 100% correct. but for that to work i have to go info Solar Assistant and change the prefix to emon, and user/pass to emonpi

but my peculiar situation meant i did not want to change my Solar Assistant broker settings.
Nor do i want to change my Home Assistant broker

My Solar Assistant broker publishes prefix solar_assistant.

That comes into HA via the .conf file above

I can add any number of brokers to HA via a conf file, and all of their data will pool in Home Assistant’s broker prefix core-mosquitto.local.hass.io

I have other brokers also coming into Home Assistant, like the BATMON addon which i use to monitor the BMS of my inverter batteries

so i cannot change the Home Assistant broker to just Solar Assistant IP That works for anyone that has just 1 broker

So in my case the solution is to use MQTT bridges in HA, and how to do it is outlined above