Integration - MQTT
SolarAssistant provides an MQTT based API. MQTT is used by hobbyist and developers to integrate and extend the functionality of SolarAssistant into their projects. It provides access to SolarAssistant monitoring data and inverter settings changes can also be performed.
Enable MQTT output
Navigate to the "Configuration" tab and start MQTT:
Determine SolarAssistant local network IP
Also on the "Configuration" tab, determine what it's wlan0 (WiFi) or eth0 (LAN) IP is.
The IP is allocated by your network router and can usually be configured to be static
in your router configuration. If your router supports mDNS then SolarAssistant will register the hostname
Connect to MQTT
There are various utilities available to consume MQTT messages. In the example below, we will use the mosquitto client.
The result will be a continous stream of MQTT messages. To exit, press ctrl-c.
If you already have an MQTT broker where you would like to consume SolarAssistant messages then you need to set up an MQTT bridge. Using a bridge is considered best practice for reliability and latency as message delivery, network disconnects, etc. is handled by the MQTT brokers. For Home Assistant users please see our Home Assistant broker with bridge setup guide.
The example mosquitto configuration file below is used in your existing MQTT broker to pull messages from SolarAssistant. Note:
- address should be the IP address of your SolarAssistant device instead of 10.0.0.100.
- remote_username and remote_password should be uncommented if you configured MQTT authentication in SolarAssistant.
- topic in is to pull all messages from SolarAssistant
- topic out is to push solar setting change messages from your existing broker to SolarAsssistant.
Adjusting solar settings
See the example below for how to set the output source priority of an inverter via MQTT.
SolarAssistant will post a response back on topic solar_assistant/set/response_message/state. You can view these messages with the command below:
If you want to know which settings you can change via MQTT, please enable HomeAssistant discovery and then use the command below:
Adjusting solar settings - Examples with Voltronic inverter
Set charger source priority to solar and utility simultaneously:
Set maximum AC charge current to 10A:
Set shutdown battery voltage 47V:
Adjusting solar settings - Examples with Deye inverter
Set the maximum AC charge current to 20A:
Set the work mode capacity point 1 to 15%: