Hi, I have a solax X1 inverter, with a pocket wifi dongle, and I have done it a different way, which should work if you are using a pocket lan dongle.
I have setup dnsmasq to trick solax into sending the data to my Rasberry Pi that home assistant is on.
These are the setting I use:
#Solax Pocket wifi c8:39:64:76:53:1c MXCHIP
dhcp-host=c8:39:64:76:53:1c,10.0.1.8
address=/www.eu.solaxcloud.com/10.0.1.1
address=/mqtt001.solaxcloud.com/10.0.1.1
address=/mqtt002.solaxcloud.com/10.0.1.1
What this does is tells dnsmasq to allocate and IP address of 10.0.1.8 to the wifi dongle using its MAC address as ID, and tells solax inverter that there server are actually my Rpi (ip address 10.0.1.1)
The wifi dongle then publishes its MQTT data to 10.0.1.1
The same process can be used for the LAN dongle.
In home assistant:
binary_sensor:
- platform: ping
host: 10.0.1.8
name: "solax_pocket_wifi"
count: 2
scan_interval: 300
automation:
- alias: solar_check_offline
description: "checks if received solar mqtt message within last 6 mins"
trigger:
- platform: state
entity_id: binary_sensor.solar_communication
from: 'on'
to: 'off'
condition:
- condition: time
after: '05:30:00'
before: '19:30:00'
action:
- service: mqtt.publish
data:
topic: "solar/data_update_end_of_day"
payload: ''
- alias: solar_resptimesync
description: "responds to reqsynctime message from solax inverter"
trigger:
- platform: mqtt
topic: "reqsynctime/#"
action:
- service: mqtt.publish
data:
topic: 'respsynctime/{{ trigger.payload_json.wifisn }}'
payload: >
{"month":"{{now().month}}","hour":"{{now().hour}}","year":"{{now().year}}","day":"{{now().day}}","minute":"{{now().minute}}","second":"{{now().second}}"}
sensor:
- platform: mqtt
name: "solar_pv1_current"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[0] }}'
unit_of_measurement: 'A'
- platform: mqtt
name: "solar_pv2_current"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[1] }}'
unit_of_measurement: 'A'
- platform: mqtt
name: "solar_pv1_voltage"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[2] }}'
unit_of_measurement: 'V'
- platform: mqtt
name: "solar_pv2_voltage"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[3] }}'
unit_of_measurement: 'V'
- platform: mqtt
name: "solar_grid_current"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[4] }}'
unit_of_measurement: 'A'
- platform: mqtt
name: "solar_grid_voltage"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[5] }}'
unit_of_measurement: 'V'
- platform: mqtt
name: "solar_now"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[6] }}'
unit_of_measurement: 'W'
- platform: mqtt
name: "solar_inverter_temp"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[7] }}'
unit_of_measurement: '°C'
- platform: mqtt
name: "solar_today"
state_topic: "loc/SWH53A7QPS"
#value_template: "{{ value_json.data[8] |float(0) }}"
value_template: '{{ value_json.data[8] }}'
unit_of_measurement: 'kWh'
- platform: mqtt
name: "solar_total"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[9] }}'
unit_of_measurement: 'kWh'
- platform: mqtt
name: "solar_total_mwh"
state_topic: "loc/SWH53A7QPS"
#value_template: "{{( value_json.data[9] | float(0) | float / 1000 )| round(2,default = 0) }}"
value_template: '{{ (value_json.data[9] | float(0) / 1000 )| round(2,default = 0) }}'
unit_of_measurement: 'mWh'
- platform: mqtt
name: "solar_pv1_power"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[11] }}'
unit_of_measurement: 'W'
- platform: mqtt
name: "solar_pv2_power"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[12] }}'
unit_of_measurement: 'W'
- platform: mqtt
name: "solar_gred_frequency"
state_topic: "loc/SWH53A7QPS"
value_template: '{{ value_json.data[50] }}'
unit_of_measurement: 'Hz'
- platform: mqtt
name: "solar_status_code"
state_topic: "loc/SWH53A7QPS"
value_template: >
{% if value_json is defined %}
{% if value_json.data[68] == 0 %}Wait
{% elif value_json.data[68] == 1 %}Grid Sync
{% elif value_json.data[68] == 2 %}Normal
{% elif value_json.data[68] == 3 %}Lost grid
{% elif value_json.data[68] == 9 %}Offline
{% else %}{{ value_json.data[68] }} - Unknown
{% endif %}
{% else %}
Offline
{% endif %}
The binary_sensor is used to ping the wifi dongle every 5 minutes (300 seconds) to check if there is a connection.
The - alias: solar_resptimesync is an answer to the inverter when it asks the solaxcloud server for time information.
The advantage of this setup is no information leaves my property, and I have 24/7 access to it.
If the solaxcloud server is down home assistant can’t access any solar production data.
I have been using the above setup for a 3 or 4 years now without issue.
Anyways hope this is helpfully.