I am running an Axpert inverter with Solar Assistant on a Raspberry Pi. Solar Assistant collects data and makes an MQTT broker available.
My Home Assistant (core, running in docker) has an MQTT broker defined that connects to eclipse-mosquitto running in another docker container.
Mosquitto Configuration
The problem is, you can’t have more than 1 MQTT broker in Home Assistant so you have to add some config to your eclipse-mosquitto to bring in the data from Solar Assistant.
Here is the config:
ersistence true
persistence_location /mosquitto/data/
log_dest file /mosquitto/log/mosquitto.log
log_type all
listener 1883
allow_anonymous false
password_file /mosquitto/config/password.txt
connection SolarAssistant
address 192.168.18.32
topic # in 0 homeassistant/ ""
restart_timeout 30 800
The last 3 lines tells eclipse-mosquitto to connect to my Solar Assistant MQTT, bring in all topics (#) and rename it to “homeassistant/whatever”. The reason for the rename is because the MQTT broker in Home Assistant only takes 1 discovery prefix and I want everything on that topic.
You can read more about the restart_timeout option here: https://mosquitto.org/man/mosquitto-conf-5.html
Home Assistant Configuration
You need to create a sensor from your Solar Assistant topics. For this, you need to add config to your Home Assistant YAML configuration file. I added this at the bottom of my file, you can add more sensors.
#mqtt sensor manually added by me 26 April 2023
mqtt:
sensor:
- name: "Inverter-BatteryVoltage"
state_topic: "homeassistant/solar_assistant/inverter_1/battery_voltage/state"
When you go to your entities in Home Assistant you will see your newly created entity there.