Skip to content

ModbusClientMixin type annotations incompatibles with the async client #1821

@jvelo

Description

@jvelo

Versions

  • Python: 3.12
  • OS: macos
  • Pymodbus: 3.5.4
  • Mypy : 1.5.1

Pymodbus Specific

  • Client: async

Description

Mypy fails to validate standard async client calls due to incompatible type annotations in ModbusClientMixin.

Code and Logs

Following code

client = AsyncModbusTcpClient(HOST)
await client.connect()
coils = await client.read_coils(address=0, count=1, slave=SLAVE_ID)

Makes mypy fails with:

__main__.py:18: error: Incompatible types in "await" (actual type "ModbusResponse", expected type "Awaitable[Any]")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions