Skip to content

Conversation

@dries007
Copy link
Contributor

AsyncModbusSerialClient.connect is missing a return, which causes it to be unusable for async with blocks, since the __aenter__ always assumes it failed now.

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks.

@dries007
Copy link
Contributor Author

dries007 commented Jan 16, 2023

My workaround until this gets released on pip:

class FixedAsyncModbusSerialClient(AsyncModbusSerialClient):
    # fixme: Remove after https://github.com/pymodbus-dev/pymodbus/pull/1271 is released.
    async def connect(self):
        return await super().connect() or self.connected

@janiversen janiversen merged commit 94fa6b1 into pymodbus-dev:dev Jan 16, 2023
@janiversen
Copy link
Collaborator

I expect to release v3.1.1 at the end of the month, if I can get 2 pull requests done.

alexrudd2 pushed a commit to alexrudd2/pymodbus that referenced this pull request Feb 21, 2023
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants