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

ModbusTCP _in_waiting not defined. #657

Closed
janiversen opened this issue Jul 31, 2021 · 7 comments · Fixed by #659 or #660
Closed

ModbusTCP _in_waiting not defined. #657

janiversen opened this issue Jul 31, 2021 · 7 comments · Fixed by #659 or #660
Labels

Comments

@janiversen
Copy link
Collaborator

janiversen commented Jul 31, 2021

Versions

  • Python: 3.8
  • OS: hastío
  • Pymodbus: 2.51
  • Modbus Hardware (if used):

Pymodbus Specific

  • Client: tcp - sync

Description

The modbus integration in home assistant uses pymodbus, and lately we have started getting more and more issues with

File "/usr/src/homeassistant/homeassistant/components/modbus/modbus.py", line 305, in _pymodbus_call
result = self._pb_call[use_call][ENTRY_FUNC](address, value, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pymodbus/client/common.py", line 103, in write_registers
return self.execute(request)
File "/usr/local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 109, in execute
return self.transaction.execute(request)
File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 194, in execute
response, last_exception = self._retry_transaction(retries, "empty", request, expected_response_length, full=full)
File "/usr/local/lib/python3.9/site-packages/pymodbus/transaction.py", line 250, in _retry_transaction
in_waiting = self.client._in_waiting()
AttributeError: 'ModbusTcpClient' object has no attribute '_in_waiting'

We use slave 0 as default, and some users inform that the error goes away if they specify a slave > 0, but this is not consistent.

I am the maintainer of the modbus integration.

Code and Logs

 # code and logs here.
https://github.com/home-assistant/core/tree/dev/homeassistant/components/modbus
@janiversen janiversen changed the title ModbusTCP _inWaiting not defined. ModbusTCP _in_waiting not defined. Jul 31, 2021
@dhoomakethu
Copy link
Contributor

Is the issue also seen with 2.5.2?

@dhoomakethu
Copy link
Contributor

Never mind this is a bug.

@janiversen
Copy link
Collaborator Author

Yup but difficult to reproduce and isolate, I have tried for a while….but of course you know the code a lot better.

Looking forward to see a fix.

dhoomakethu added a commit that referenced this issue Aug 1, 2021
@dhoomakethu dhoomakethu mentioned this issue Aug 1, 2021
This was linked to pull requests Aug 1, 2021
@Akkarine Akkarine mentioned this issue Aug 5, 2021
@dhoomakethu
Copy link
Contributor

Please give a try with 2.5.3rc1 .
PyPi: https://pypi.org/project/pymodbus/2.5.3rc1/

@janiversen
Copy link
Collaborator Author

will do

@janiversen
Copy link
Collaborator Author

As far as I can tell it solves the issue, however I can only do limited testing. I have issued a PR to have 2.5.3rc1 on our dev, allowing much more users to test.

@Hvitnov
Copy link

Hvitnov commented Sep 24, 2021

After update to 2.5.1 I have seen this issue pretty consistently on several dataloggers communicating on modbusTCP via Narrowband IOT.

Updating to 2.5.3rc1 solved this for me.

camtarn pushed a commit to camtarn/pymodbus that referenced this issue Dec 6, 2021
camtarn added a commit to camtarn/pymodbus that referenced this issue Dec 6, 2021
camtarn added a commit to camtarn/pymodbus that referenced this issue Dec 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants