Universal Solar Inverter over Modbus RS485 / TCP custom_component (AlphaESS, Growatt, Sofar, SolaX, Solinteg, Solis, SRNE, Swatten, TIGO TSI & Qcells Q.Volt Hyb)

The suggested change did not work. After change, “house_load” turned “unknown”. Probably some indentation issue or something related
But the following change apparently did the trick:

    if inverter_load > 0:
      self.data["house_load"] = inverter_load - feedin_power
    else:
      self.data["house_load"] = abs(feedin_power)

Don’t know if it helps but I made my house load like this

    value_template: "{{ states('sensor.solax_inverter_power') | int - states('sensor.solax_measured_power') | int }}"

Hi all,

First of all, thanks a lot for this. I’ve had my PV and Battery storage system installed this week and I’ve wanted to get things integrated into Home Assistant from the outset. I’ve only found your integration this morning and it’s installed ok, however, I can not get any readings from the inverter at all.

  • I’m running the latest version of HA
  • I have an X1-Hybrid-G4 inverter but can only install up to G3 in HA, I selected that version hoping some bits would work, but it seems all I can get is “unknown” from all of the 88 sensors.

I’m going to be away from home for the next week but will have my laptop with me to be able to get on to HA and make some adjustments or checks if required. Was hoping you might be able to point me in the right direction?

Thanks in advance,

Tom

Reading of the sensors is the same for the majority of them between Gen 2 - 4. Gen 2 is missing some.

Some of the write registers are different on the newer Gen 4 which I haven’t implemented yet.

I would double check your Ethernet connection and the IP address of your inverter, initially it took a bit of finding to find my IP address as it had a obscure name.

Thanks for the reply. The IP is coming from the router, it flashed up as a new device when it was connected and I named it. 196.168.68.158, I’m assuming it would need to be a static IP though? I’ll double-check as my router can be a bit useless at updating sometimes.

Can you give me a clue where I could find the MAC address of the inverter so I can double-check it?

Thanks,

Tom

On your inverter Panel / LCD go into settings, ethernet and scroll down several times and it should be there.

Thanks, I’ll go check that. Not actually touched the inverter itself yet.

Just so you know this component only works with the actual ethernet port on the Inverter and not a Pocket WiFi / Pocket Lan

That’s what I’m connected with. It’s running to a power line adapter. Just working though the menus.

In my settings I only have User Settings or Advanced Settings. None of which refer to the network or Ethernet that I can see. I know I’ve seen the MAC address somewhere though.

That’s a Pocket Lan, not sure why the installer has used that when there is built in ethernet on the newer Hybrids from Gen 2 and up.

You might be able to use the built in SolaX integration with that? Not sure though.

Or plug it into the ethernet under the front panel. Just make sure it’s actually the ethernet port as there are other RJ45 sockets for RS485 / CAN etc

I’ll go back and have a look. Thanks for the help. The standard Solax integration didn’t seem to do anything.

I started to make a version for the Gen4 solax X3 (and X1)
It is currently still a fork of the work of wills106. Hope we can merge it.
This version is also made for serial RS485

It is still work in progress, my hybrid X3 Gen4 does not respond yet on the serial modbus.
The code has been adapted according to the documentation for the G4 and is significantly different from the Gen3 code.
It should still support the older versions.

Any

Please do not use it yet, as I could not test it yet, need to re-check my cabling.

As we are starting to get a huge amount of code repetition I would recommend to start using variables based on the inverter selected.
I started to do this in __init__.py for the rounding of calculations between gen 2 and Gen 3

if self.read_gen2x1 == True:
    mult = 0.01
else:
    mult = 0.1

We are now having:

NUMBER_TYPES_G2
NUMBER_TYPES_G3
NUMBER_TYPES_G4

Where the majority is the same, but for example we have 50Amp 25Amp and 30Amp battery charge / discharge between the versions.
Really that should be replaced by a variable that is set depending on the inverter set in the config, like how I have started to do it in __init__.py
This will reduce the amount of lines of code and will also reduce the chance of introducing errors from copy and pasting previous chunks of code.

if self.read_gen2x1 == True:
    charge = 50
elif self.read_gen3x1 == True or self.read_gen3x3 == True:
    charge = 25
elif self.read_gen4x1 == True or self.read_gen4x3 == True:
    charge = 30
else:
    charge = 0

@Voreland How are you connecting to your Gen4 inverter?
Are you connecting directly via Ethernet or are you using an Ethernet/WiFi to RS485 bridge?

I use a very low cost usb to RS485 adapter. it costs about 2 € at berrybase.de
I extended the initial setup dialog with a ‘Serial RS485’ checkbox and the /dev/ttyUSB0 entry field.

Yesterday, I had some wiring problems, now today, these problems are solved, and I can retrieve all entities from my Gen4 X3. Seems like the polarity of the RS485 bus matters.

I have not tested any write actions yet …

Additional note: The Gen4 does not allow accessing the API through wired Ethernet (pocketlan)

I noticed you were connecting via a USB adapter.

I was wondering how @Voreland was connecting to his Inverter as he’s using my component on his Gen4. I was assuming they still had built in Ethernet.

Have they dropped the internal Ethernet port inside the Inverter on the Gen 4 then? If you are having to use an RS485 - USB dongle.

The PocketLan / PocketWiFi only connects to the cloud / limited local API on some Firmware versions I believe. Neither pass Modbus protocols.

The Gen4 can work wiih Ethernet, if you install a PocketLan adapter. There is no fixed Ethernet port anymore (without PocketLan)
I will have a look how @Voreland did it, but he/she is probably using wifi with the hotspot generated by the Solax device. I will read it first …

Regards,

Jan