Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solis RAI 3kW support #43

Closed
Pho3niX90 opened this issue Mar 24, 2024 · 45 comments
Closed

Solis RAI 3kW support #43

Pho3niX90 opened this issue Mar 24, 2024 · 45 comments
Labels
feature New feature or request

Comments

@Pho3niX90
Copy link
Owner

@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 #27 (comment)

@Pho3niX90 Pho3niX90 added the feature New feature or request label Mar 24, 2024
@Pho3niX90
Copy link
Owner Author

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.

@Pho3niX90 Pho3niX90 changed the title @Pho3niX90 BTW I have this Solis inverter: Solis RAI 3kW. Solis RAI 3kW support Apr 2, 2024
@cgilis
Copy link

cgilis commented Apr 2, 2024

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

@cgilis
Copy link

cgilis commented Apr 2, 2024

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

@cgilis
Copy link

cgilis commented Apr 2, 2024

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
Copy link
Owner Author

Aah I understand better now.

Do you see any errors or warnings in your logs?

@cgilis
Copy link

cgilis commented Apr 2, 2024

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
Copy link
Owner Author

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
Copy link

cgilis commented Apr 2, 2024

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
Copy link
Owner Author

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
Copy link

cgilis commented Apr 2, 2024

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

@cgilis
Copy link

cgilis commented Apr 2, 2024

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

@Pho3niX90
Copy link
Owner Author

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

Got to love unifi! my entire system us unifi

@Pho3niX90
Copy link
Owner Author

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
Copy link

cgilis commented Apr 2, 2024

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
Copy link
Owner Author

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

@cgilis
Copy link

cgilis commented Apr 2, 2024

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

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

@Pho3niX90
Copy link
Owner Author

Just released 1.4.3

@cgilis
Copy link

cgilis commented Apr 2, 2024

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

@cgilis
Copy link

cgilis commented Apr 2, 2024

It feels like no difference here :-s

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

@Pho3niX90
Copy link
Owner Author

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

I will dig some more

@cgilis
Copy link

cgilis commented Apr 3, 2024

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
Copy link
Owner Author

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

@cgilis
Copy link

cgilis commented Apr 3, 2024

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

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

@Pho3niX90
Copy link
Owner Author

going to do another release now

@Pho3niX90
Copy link
Owner Author

if you can try 1.4.4-beta-2

@cgilis
Copy link

cgilis commented Apr 3, 2024

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
Copy link
Owner Author

okay let me investigate some more

@Pho3niX90
Copy link
Owner Author

@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
Copy link

cgilis commented Apr 3, 2024

Nice, Will try it right now.

@cgilis
Copy link

cgilis commented Apr 3, 2024

@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
Copy link
Owner Author

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

Pho3niX90 added a commit that referenced this issue Apr 3, 2024
The version number in the system has been updated from 1.4.3 to 1.4.4 in both manifest.json and const.py. Additionally, error handling for modbus operations within modbus_controller.py has been updated to streamline failure responses, eliminating unnecessary error check steps and focusing on exception-based error handling.

fixes #43 and #27
@cgilis
Copy link

cgilis commented Apr 3, 2024

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

@Pho3niX90
Copy link
Owner Author

Yes you can remove them. No longer needed

@cgilis
Copy link

cgilis commented Apr 3, 2024

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

@Pho3niX90 Pho3niX90 reopened this Apr 3, 2024
@Pho3niX90
Copy link
Owner Author

Pho3niX90 commented Apr 3, 2024

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
Copy link

cgilis commented Apr 3, 2024

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
Copy link

cgilis commented Apr 3, 2024

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
Copy link
Owner Author

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
Copy link

cgilis commented Apr 4, 2024

Hey @Pho3niX90 Since the update , these controls became unavailable 😅

IMG_2284
IMG_2285

@Pho3niX90 Pho3niX90 reopened this Apr 4, 2024
@Pho3niX90
Copy link
Owner Author

Hey @Pho3niX90 Since the update , these controls became unavailable 😅

IMG_2284 IMG_2285

release 1.4.5 should fix this

@cgilis
Copy link

cgilis commented Apr 4, 2024

Hey @Pho3niX90 Since the update , these controls became unavailable 😅
IMG_2284 IMG_2285

release 1.4.5 should fix this

Perfect!! 😍 this works

@cgilis
Copy link

cgilis commented Apr 4, 2024

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

IMG_2325
IMG_2324

@Pho3niX90
Copy link
Owner Author

the latest version should fix that as well

@cgilis
Copy link

cgilis commented Apr 5, 2024

the latest version should fix that as well

Will test it tonight. Thx man!

@cgilis
Copy link

cgilis commented Apr 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants