Pho3niX90 / solis_modbus

Home Assistant HACS integration for Solis inverters
16 stars 0 forks source link

Solis RAI 3kW support #43

Open Pho3niX90 opened 3 months ago

Pho3niX90 commented 3 months ago

@Pho3niX90 BTW I have this Solis inverter: Solis RAI 3kW. The only control functions that are working are those in the screenshot below. It's enough to control the battery.

CleanShot 2024-03-24 at 14 56 15@2x

_Originally posted by @cgilis in https://github.com/Pho3niX90/solis_modbus/issues/27#issuecomment-2016818375_

Pho3niX90 commented 3 months ago

Could you perhaps post your visible registers here that you are able to see? @cgillis

The idea, is to create a version compatible with your inverter, and then see if it solves the slowdown. One question I never asked in #27 was what inverter they were using.

This will aid in finding the slowdown location, and making more compatible with your inverter.

cgilis commented 3 months ago

CleanShot 2024-04-02 at 19 07 22@2x

cgilis commented 3 months ago

CleanShot 2024-04-02 at 19 08 23@2x

cgilis commented 3 months ago

The first screenshot are the only ones that I can control. The other actions has no effect on my Solis. But that's enough to start / stop charge the battery

Pho3niX90 commented 3 months ago

Aah I understand better now.

Do you see any errors or warnings in your logs?

cgilis commented 3 months ago

home-assistant_2024-04-02T17-22-31.374Z.log

Sorry is this enough? :)

`This error originated from a custom integration.

Logger: custom_components.solis_modbus.modbus_controller Source: custom_components/solis_modbus/modbus_controller.py:25 integration: Solis Modbus (documentation, issues) First occurred: March 29, 2024 at 13:39:08 (145 occurrences) Last logged: 15:24:06

Failed to connect to Modbus device. Will retry`

Also this:

`This error originated from a custom integration.

Logger: homeassistant Source: custom_components/solis_modbus/modbus_controller.py:39 integration: Solis Modbus (documentation, issues) First occurred: 17:06:43 (1 occurrences) Last logged: 17:06:43

Error doing job: Exception in callback _run_async_call_action(, >)>>) at /usr/src/homeassistant/homeassistant/helpers/event.py:1506 Traceback (most recent call last): File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, self._args) File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1510, in _run_async_call_action hass.async_run_hass_job(job, time_tracker_utcnow()) File "/usr/src/homeassistant/homeassistant/core.py", line 727, in async_run_hass_job hassjob.target(args) File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1604, in _interval_listener hass.async_run_hass_job(self._run_job, now) File "/usr/src/homeassistant/homeassistant/core.py", line 727, in async_run_hass_job hassjob.target(*args) File "/config/custom_components/solis_modbus/number.py", line 85, in async_update entity.update() File "/config/custom_components/solis_modbus/number.py", line 136, in update value = controller.read_holding_register(self._register)[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solis_modbus/modbus_controller.py", line 39, in read_holding_register result = self.client.read_holding_registers(register, count, slave=1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymodbus/client/mixin.py", line 102, in read_holding_registers return self.execute( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymodbus/client/base.py", line 177, in execute return self.transaction.execute(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymodbus/transaction.py", line 168, in execute response, last_exception = self._transact( ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymodbus/transaction.py", line 285, in _transact size = self._send(packet) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymodbus/transaction.py", line 325, in _send return self.client.framer.sendPacket(packet) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymodbus/framer/base.py", line 68, in sendPacket return self.client.send(message) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pymodbus/client/tcp.py", line 166, in send raise ConnectionException(str(self)) pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] ModbusTcpClient(192.168.1.239:502)`

Pho3niX90 commented 3 months ago

That does seem to show a general connection issues.

Are you able to do a ping test from your raspberry pi to the solis? Just to see how stable the connection is? I will have to do some reading into the HA python code to see why this might be causing delays. My assumption is that this is related to IO to the SD card (assuming you are using one)

cgilis commented 3 months ago

On the Pi: CleanShot 2024-04-02 at 19 36 19@2x

On a macbook: CleanShot 2024-04-02 at 19 36 58@2x

Pho3niX90 commented 3 months ago

Ok there are some ups and downs, some dramatic and some not so much of an issue. It might be that the more dramatic ones closer to a second might eventually add up, and cause some queueing.

Is the slowdown (of ha) from the start, or only after a while?

cgilis commented 3 months ago

It is from the start, when the plugin is loaded.

cgilis commented 3 months ago

btw, the connection is good! CleanShot 2024-04-02 at 19 48 50@2x

Pho3niX90 commented 3 months ago

btw, the connection is good! CleanShot 2024-04-02 at 19 48 50@2x

Got to love unifi! my entire system us unifi

Pho3niX90 commented 3 months ago

It is from the start, when the plugin is loaded.

Okay let me do some investigation, something is blocking the mainthread in the code. Will try and diagnose, and startup a raspberry pi

cgilis commented 3 months ago

Nice! Thx man!

PS I also had it on my Home Assistant Yellow, but yeah that's running on a RP Compute Module :-) So that won't make a difference I think :-) I can if you want, try it on a virtual machine on a Synology NAS?

Pho3niX90 commented 3 months ago

Could you see if https://github.com/Pho3niX90/solis_modbus/tree/feature/speedup made a difference, if any?

cgilis commented 3 months ago

Sorry for my stupid question, but i can't find it in the list

CleanShot 2024-04-02 at 21 18 45@2x

Pho3niX90 commented 3 months ago

Just released 1.4.3

cgilis commented 3 months ago

Installing, will let you know if it works :-)

cgilis commented 3 months ago

It feels like no difference here :-s

home-assistant_2024-04-02T19-28-16.689Z.log

Pho3niX90 commented 3 months ago

Those logs just contains info that the rpi is undervolted :)

I will dig some more

cgilis commented 3 months ago

Hi @Pho3niX90

I transferred a backup to a new Raspberry Pi 5, but it is still the same issue. home-assistant_2024-04-03T14-19-25.367Z.log

Pho3niX90 commented 3 months ago

@cgilis I made some more changes, please see if 1.4.4-beta-1 made any difference?

cgilis commented 3 months ago

It feels better, but it's still there.. sorry man :-)

home-assistant_2024-04-03T15-25-17.234Z.log

Pho3niX90 commented 3 months ago

going to do another release now

Pho3niX90 commented 3 months ago

if you can try 1.4.4-beta-2

cgilis commented 3 months ago

Feels again a bit better, but after 12 refreshes the loading is still there.. strange home-assistant_2024-04-03T15-43-59.967Z.log

Pho3niX90 commented 3 months ago

okay let me investigate some more

Pho3niX90 commented 3 months ago

@cgilis once you have time, please test https://github.com/Pho3niX90/solis_modbus/releases/tag/1.4.4-beta-3 I believe this fixes the issue. I was able to reproduce it my side

cgilis commented 3 months ago

Nice, Will try it right now.

cgilis commented 3 months ago

@cgilis once you have time, please test https://github.com/Pho3niX90/solis_modbus/releases/tag/1.4.4-beta-3 I believe this fixes the issue. I was able to reproduce it my side

πŸ₯³. Yes it’s working!! Can I buy you a beer? 🍺

Pho3niX90 commented 3 months ago

That's good news! Thanks so much for helping to find the issue. Quickly going to tidy things up, will then release the real 1.4.4

cgilis commented 3 months ago

Is it ok that I remove my log files in this thread?

Pho3niX90 commented 3 months ago

Yes you can remove them. No longer needed

cgilis commented 3 months ago

Small question about Solis RAI 3kW support. Do you think the only things I can control more? (screenshot on top)

Pho3niX90 commented 3 months ago

Going to check if I can find some documentation on that specific model. But I am sure there should be more controls available.

The items that aren't working, do they work via the Solis app?

cgilis commented 3 months ago

The app is not usable anymore as from the installation of the plugin, but that is OK. This plugin is better πŸ˜‚

but I think nothing was controllable before in the app..

cgilis commented 3 months ago

That's good news! Thanks so much for helping to find the issue. Quickly going to tidy things up, will then release the real 1.4.4

Confirmed working on 2024.4 πŸ™ƒ

Pho3niX90 commented 3 months ago

Yeah the modbus can only handle a single connection at a time. So once HA connects with the inverter, it breaks the cloud connectivity. To enable it again, you need to disable the solis ha plugin.

The documentation I am currently finding states it's the same registrars, it might mean that certain switches needs to be off on the RAI before others take effect. Will dig some more

cgilis commented 3 months ago

Hey @Pho3niX90 Since the update , these controls became unavailable πŸ˜…

IMG_2284 IMG_2285

Pho3niX90 commented 3 months ago

Hey @Pho3niX90 Since the update , these controls became unavailable πŸ˜…

IMG_2284 IMG_2285

release 1.4.5 should fix this

cgilis commented 3 months ago

Hey @Pho3niX90 Since the update , these controls became unavailable πŸ˜… IMG_2284 IMG_2285

release 1.4.5 should fix this

Perfect!! 😍 this works

cgilis commented 3 months ago

Hey @Pho3niX90 found another bug. cant set te charging current.

IMG_2325 IMG_2324

Pho3niX90 commented 3 months ago

the latest version should fix that as well

cgilis commented 3 months ago

the latest version should fix that as well

Will test it tonight. Thx man!

cgilis commented 2 months ago

Sorry for my delayed response, but it is working with the latest version! Thx @Pho3niX90