Skip to main content

asyncio client library for tcp modbus devices

Project description

tcp-modbus-aio

PyPI version

asyncio client library for tcp modbus devices. built on top of umodbus but extended for more industrial robustness and asyncio compat. the umodbus documentation is recommended reading to have any hope of using this code.

narrowly constructed for the use cases of Tutor Intelligence, but feel free to post an issue or PR if relevant to you.

usage

create a TCPModbusClient. once you have it, you can call the following methods on it:

  • await conn.send_modbus_message(request_function, **kwargs): sends a umodbus.functions.ModbusFunction to the modbus device and returns the corresponding ModbusFunction reply.
  • await conn.test_connection(): sends a modbus message to the device to ensure it's still operational (currently hardcoded to read coil 0) and return boolean of whether it succeeded. is implemented as a cached awaitable to allow you to spam this call.
  • await conn.clear_tcp_connection(): kill the current TCP socket (a new one will automatically be created for the next request)
  • await conn.log_watch(msg, memo_key="system_temperature", expiry_period_s=10, hz=1): spins up a background coroutine to log the result of that message for the next expiry_period seconds at hz frequency. memo_key is used to allow multiple calls to log_watch without having overlapping log watch loops.
  • await conn.close(): for cleaning up the connection (kills TCP conn and ping loop)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tcp_modbus_aio-0.4.5.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tcp_modbus_aio-0.4.5-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file tcp_modbus_aio-0.4.5.tar.gz.

File metadata

  • Download URL: tcp_modbus_aio-0.4.5.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tcp_modbus_aio-0.4.5.tar.gz
Algorithm Hash digest
SHA256 cc738d8fbeb27a6a7ad420f0973914ff836f32d97c41a3a351c39393e6da740d
MD5 b1f30f64e163ee95c2afa30ac509d104
BLAKE2b-256 882c5f8705561dd6cd2e27931c8aae20717087197d144ede6acb25baaed51aa4

See more details on using hashes here.

Provenance

The following attestation bundles were made for tcp_modbus_aio-0.4.5.tar.gz:

Publisher: cd.yml on tutorintelligence/tcp-modbus-aio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tcp_modbus_aio-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: tcp_modbus_aio-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tcp_modbus_aio-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3b091f295b669aa94416d2057d8ca96d67cb5561706674a78271413ffa9a4df0
MD5 659ae396bdebbf6cfbf3d992e2364d33
BLAKE2b-256 a97430f2aaa75cb68e49712ddee9dca0838f4a75d50ac540d67ebdc222de6278

See more details on using hashes here.

Provenance

The following attestation bundles were made for tcp_modbus_aio-0.4.5-py3-none-any.whl:

Publisher: cd.yml on tutorintelligence/tcp-modbus-aio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page