Universal Solar Inverter over Modbus RS485 / TCP custom_component (Growatt, Sofar, SolaX, Solis)

@fanderson: thanks for the info, I think it is helpful. I just put the grid-tied min limit to 20 %, but with some more sunny days in the near future, I will have to wait a while to see the result.

Version 0.2.2 - custom_component

Converted all Sensors to use SensorEntityDescription

Removed Optional Sensors - Now form part of the main Sensor Group, but disabled by default

Updated Energy Dashboard compatability for 2021.9x Version of Home Assistant

Renamed “Input Energy Charge Today” & “Output Energy Charge Today” to “Battery Input Energy Today” & “Battery Output Energy Today” Now compatible with the Energy Dashboard

2 Likes

Thanks for all your work on this Will, amazing. Do you have any links or info on how to make data feeds available for the new energy dashboard? Sounds like they have to be in a specific format/naming convention?

Do you mean to use my custom_component in your Energy dashboard? Or do you mean to create your own integration / custom_component for something else?

@wills106 thanks so much for your great work.
Are you planning to implement the writing to registers?

Thanks Wills, yes create my own. I have a lot of data and my own solax/solus setup and want to pull the data into the energy dashboard but the last time I look at the documentation on see anything on it.

Yes, once I have figured out how…

I am trying to implement a select option to change between the modes.
I might start off with more basic write registers and see if I can get that figured out?

I have changed from using “EntityDescription” to the new “SensorEntityDescription”

You can only use the energy units in the dashboard.

# Energy units
ENERGY_WATT_HOUR: Final = "Wh"
ENERGY_KILO_WATT_HOUR: Final = "kWh"

If you look in the const.py file this is how I defined the sensor for Battery flow to be useable in the dashboard.

    "battery_output_energy_today": SolaXModbusSensorEntityDescription(
		name="Battery Output Energy Today",
		key="output_energy_charge_today",
		native_unit_of_measurement=ENERGY_KILO_WATT_HOUR,
        icon="mdi:solar-power",
        device_class=DEVICE_CLASS_ENERGY,
        state_class=STATE_CLASS_TOTAL_INCREASING,
    ),

Edit:
It might only be kWh and not both Wh & kWh that can be used?
I’m new to all of this, so not 100% clear on it.

1 Like

The below are some of my automations for getting rudimentary control over the Solax, I am sure you have a better way.

Wake up!!

alias: Solax ModbusPowerControl - Awake!
description: Solax ModbusPowerControl - Awake!
trigger:
  - platform: state
    entity_id: input_boolean.solax_ModbusPowerControl
condition: []
action:
  - service: modbus.write_register
    data_template:
      hub: SolaX
      unit: '255'
      address: '81'
      value: '1'
mode: single

Set enabled remote control (not sure if its needed by seems to work in my case)

alias: Solax Remote Control
description: Solax Remote Control
trigger:
  - platform: state
    entity_id: input_boolean.solax_remote_control
condition: []
action:
  - service: modbus.write_register
    data_template:
      hub: SolaX
      unit: '255'
      address: '0'
      value: '2014'
  - delay: '00:00:02'
  - service: modbus.write_register
    data_template:
      hub: SolaX
      unit: '255'
      address: '86'
      value: '1'
  - delay: '00:00:02'
  - service: modbus.write_register
    data_template:
      hub: SolaX
      unit: '255'
      address: '31'
      value: '0'
mode: single

Enable grid control

alias: Solax Allow Grid Charge - On
description: Solax Allow Grid Charge - On
trigger:
  - platform: state
    entity_id: input_boolean.solax_allow_grid_charge
    to: 'on'
condition: []
action:
  - service: modbus.write_register
    data_template:
      hub: SolaX
      unit: '255'
      address: '38'
      value: '0001'
mode: single

Then I can change the rates like below for charge rate, discharge rate is (37)

alias: House Battery Charge Rate
description: House Battery Charge Rate
trigger:
  - platform: state
    entity_id: input_number.solax_battery_charge
condition: []
action:
  - service: modbus.write_register
    data_template:
      hub: SolaX
      unit: '255'
      address: '36'
      value: '{{ (trigger.to_state.state | float * 10) | int }}'
mode: single

I think I forced it to discharge lowering the max SOC but that can only go down to 40%. Found the Solus easer to do this on so far.

If you are on a Gen 2 / 3 Hybrid the address: '81' & remote control parts are not needed, they seem to be for very old ones.

address: '38' doesn’t allow grid charge on it’s own. 38 sets the charger start time “Start Time 1” which is the first slot out of the two available time slots.

image

address: '64' Turns on / off grid charge, if you are in Force Time Mode.

I would have another look at solax_x1_hybrid_g3_group_read.yaml in my homeassistant-config repository

1 Like

I have a Solax X1 Hybrid G3 with PV and batteries connected: copied your folder and have indeed all entities in my HA dashboard now. Nice peace of work!
Remark: while looking for the IP of the inverter I noticed that SolaxCloud mentioned another IP that was incorrect.
On the entities themselves I do can use the battery charge level but it does not show up in the default dashboard. Now first simple automation with car charging based upon battery charge level by using a Sonoff Mini R2 as a switch. Looking forward to change settings in Inverter by automation.

Hi you all.

Thanks to all of you participating in this thread, and special thank you to @wills106 for your great work.
I’m willing to use homsassistant-solax-modbus, I have a brand new Solax X1 Inverter, although I’m not able to identify wich is the “Gen” version of my device.
Can you please help me? Where can I get the generation version of my inverter?

Thanks

Luis

If it’s new it will be at least Gen 3, don’t know if there are many Gen 4’s yet?

Does it look like Single Phase Hybrid – SolaX Power

Or this X-ESS G4 – SolaX Power

This is the older model https://www.solaxpower.com/wp-content/uploads/2017/01/X-Hybrid-Install-Guide.pdf

Hi Will,

thanks for your quick answer.

it looks like the image on Single Phase Hybrid – SolaX Power

That’s the Gen 3 then.

Thanks Will

One more question please, for my inverter what is the most addequate option:

Using https://github.com/wills106/homsassistant-solax-modbus/ or https://github.com/wills106/homeassistant-config/tree/master/packages ?

If you want battery control it’s probably easier to use the package, as I haven’t implemented switches or select function in the custom component yet.

Although you can use the custom component and just send write commands using the built in Modbus. But if you try to read with both the inverter shuts down comms.

If you just want to read the sensors I would use the custom component as it works with the energy dashboard without any further processing of sensors.

You have Grid Import / Export. Solar Production and flow of Power in / out of the battery.

Ok thanks again.

I will start reading data only. In the near future I will try to set the battery charge percentage (on grid) dinamically.

Hopefully I’ll have the custom component fully working to write to the inverter at some point in the future.

Version 0.3.0 - custom_component

Write Support!

  • Run Mode
  • Charge periods in Force Time Use Mode
  • Min Battery Capacity
  • Charge / Discharge rate of battery

@mickemartinsson Has done a Swedish Translation

Default names of new select / number

  • select.solax_run_mode_select
  • select.solax_grid_charge_select
  • number.solax_battery_minimum_capacity
  • number.solax_battery_charge
  • number.solax_battery_discharge

Battery Charge/Discharge Limits

  • Gen 2 - 50Amp (I don’t know if this applies to all Batterys on the Gen 2 or just the Pylon Tech. Be very carefull!)
  • Every other setup 20Amp

Battery1

Version 0.3.1

Corrected Gen2 Values

Version 0.3.2

Added missing Language Mappings for Language Register

2 Likes