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:
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?
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.
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.
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.
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.
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)
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 …