There are instructions on how to feed data from the Solax X1 solar inverter into Openhab via the vendor’s cloud service. For those interested in keeping communication local, here’s how to do it.
- Set up a local MQTT/Mosquitto server
- Make sure that the MQTT server listens at port 2901. (For Mosquitto add the line “listener 2901” to mosquitto.conf)
- Redirect all DNS queries for mqtt001.solaxcloud.com and mqtt002.solaxcloud.com to your local MQTT server IP.
- Install the MQTT binding in Openhab and configure it like this in your things-file:
Bridge mqtt:broker:brokerhome [ host="", secure=false ]{
Thing topic solax {
Channels:
Type string : inverter “State [%s]” [stateTopic=“loc/xxxxxx”]
}
}
“xxxxx” should be replaced with the serial number of your LAN stick. (I guess it should work in the same/similar way with a WLAN stick.)
These are my items:
Group gSolarPower
String inverter_state “[JSONPATH($.Data):%s]” {channel=“mqtt:topic:brokerhome:solax:inverter”}
Number:ElectricCurrent iPV_Current1 “PV1 Current [%.1f A]” (gInitializeZero,gSolarPower)
Number:ElectricCurrent iPV_Current2 “PV2 Current [%.1f A]” (gInitializeZero)
Number:ElectricPotential iPV_Voltage1 “PV1 Voltage [%.1f V]” (gInitializeZero,gSolarPower)
Number:ElectricPotential iPV_Voltage2 “PV2 Voltage [%.1f V]” (gInitializeZero)
Number:ElectricCurrent iPV_Grid_A “Grid Output Current [%.1f A]” (gInitializeZero,gSolarPower)
Number:ElectricPotential iPV_Grid_V “Grid Voltage [%.1f V]” (gInitializeZero,gSolarPower)
Number:Power iPV_Grid_W “Grid Power [%.1f W]” (gInitializeZero,gSolarPower)
Number:Temperature iPV_inverter_temp “Inverter Temperature [%.0f °C]” (gInitializeZero,gSolarPower)
Number:Energy iPV_kWh_daily “Inverter Yield - Today [%.1f kWh]” (gInitializeZero,gSolarPower)
Number:Energy iPV_kWh_total “Inverter Yield - Total [%.1f kWh]” (gInitializeZero,gSolarPower)
Number:Frequency iPV_gridFrequency “Grid Frequency [%.2f Hz]” (gInitializeZero,gSolarPower)
Number iPV_inverter_status “Status [%.0f]” (gInitializeZero,gSolarPower)
And here is a rule that is triggered on every update to parse the MQTT-data from the inverter:
rule “parse solar inverter data on update”
when
Item inverter_state changed
then
val state_json = transform(“JSONPATH”, “$.Data”, inverter_state.state.toString)
val state_data = state_json.replace(’[’, ‘’).replace(’]’, ‘’)
val state_tmp = state_data.split(’,’)
iPV_Current1.postUpdate(Float::parseFloat(state_tmp.get(0)))
iPV_Current2.postUpdate(Float::parseFloat(state_tmp.get(1)))
iPV_Voltage1.postUpdate(Float::parseFloat(state_tmp.get(2)))
iPV_Voltage2.postUpdate(Float::parseFloat(state_tmp.get(3)))
iPV_Grid_A.postUpdate(Float::parseFloat(state_tmp.get(4)))
iPV_Grid_V.postUpdate(Float::parseFloat(state_tmp.get(5)))
iPV_Grid_W.postUpdate(Float::parseFloat(state_tmp.get(6)))
iPV_inverter_temp.postUpdate(Float::parseFloat(state_tmp.get(7)))
iPV_kWh_daily.postUpdate(Float::parseFloat(state_tmp.get(8)))
iPV_kWh_total.postUpdate(Float::parseFloat(state_tmp.get(9)))
iPV_gridFrequency.postUpdate(Float::parseFloat(state_tmp.get(50)))
iPV_inverter_status.postUpdate(Float::parseFloat(state_tmp.get(68)))
end
And here are my sources for this setup:
- General idea: https://github.com/squishykid/solax/issues/13#issuecomment-652633947 - note the discussion on the Mosquitto server version!
- Parsing data 1: https://community.home-assistant.io/t/solax-solar-inverter-setup-guide/48008
- Parsing data 2: https://github.com/GitHobi/solax/wiki/direct-data-retrieval
This approach is working fine for me, except for some hiccups where data is not delivered to my Mosquitto instance. I guess it’s some issue with DNS resolution - will update this post once I know more.