-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
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
Modbus: Connection unexpectedly closed #87265
Comments
py_modbus was upgraded in 2023.2, you should check if your integration takes intto account the new version of modbus |
I suppose something has changed but I have no idea what I could check, it's standard modbus integration, it's been working for months, now it's having trouble keeping the connection to the solar inverter, although e.g. with an air conditioner it still works without a problem |
Hey there @adamchengtkc, @janiversen, @vzahradnik, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) modbus documentation |
Please run with debug as pr documentation, it is quite hard to help you without a debug log. Often the disconnect happens because the device receives something it does not like. |
Ok, short log after restarting HA with settings
|
That cannot be ! in that case it never never connected, never send or received anything. |
Ahh did not see the attached log. |
Your solar device closes the connection from time to time, but it reconnects nicely so I am not sure what the problem. The transaction before and after are ok. The new version is a lot faster, and maybe your device do not like that, anyhow this does not seem to be a modbus integration problem. |
I've tried changing various integration configuration options several times without success. |
I have a Huawei SUN2000 connected via wifi to a HA running on a raspberry pi 4. This setup have been running for about 3 weeks without a single reconnect. |
My SUN2000-8KTL-M0 firmware was a bit outdated. |
The log does not seem to have any modbus errors. At least not by a fast scan, maybe your problem is timeout. |
Closed as it is the device that closes the connection, but the modbus integration reconnects as it should. |
It would be nice if the issue was resolved instead of closing the ticket. |
no problem reopening this, but the problem remains the same and is outside the control of the modbus integration. Version 2923.2 contains a faster pymodbus implementation, which do affect some devices, and calls for use of e.g. the timeout parameter. Version 2023.2, does not contain new read/write handling. |
so in essence, please supply us with something that indicates an error in the modbus integration, otherwise we cannot really help you. |
For me this entity is nothing but modbus integration and it stopped working :)
On 2023.2 this no longer works.
|
“Connection unexpectedly closed” means your device closed the connection. The modbus connection cannot do a lot more than accept that fact. Could it be that you have a custom component installed that interferes, by f.x. use an old pymodbus version (we have seen that quite a lot). |
You need to compare the last message sent in the good and the bad case. Of course remembering that transaction id and the MBA in general will be different. The payloads should be identical, in which case the only difference is timing. I have no idea what your custom_components does, but if you look in your log, Homeassistant tell you to run without custom_components when reporting issues. |
What can I say, if you did not upgrade, there was no changes in the modbus integration. You are back into a need to analyze what happens when it happens. |
I got it :) So far it looks good. |
The problem
After restarting HA, a few reads are performed correctly, then the entity becomes unavailable forever.
What version of Home Assistant Core has the issue?
2023.2
What was the last working version of Home Assistant Core?
2023.1.7
What type of installation are you running?
Home Assistant OS
Integration causing the issue
modbus
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: