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.7.tar.gz (10.0 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.7-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tcp_modbus_aio-0.4.7.tar.gz
  • Upload date:
  • Size: 10.0 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.7.tar.gz
Algorithm Hash digest
SHA256 6de830a957c9c2c26c06b07cce91f8912866b003ed24b2c27a61efaf27186520
MD5 64509671891332d027597093745a0c8c
BLAKE2b-256 7fc18ac8339475afc89dac22f2547f391b73481aebb38905136433735c508727

See more details on using hashes here.

Provenance

The following attestation bundles were made for tcp_modbus_aio-0.4.7.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.7-py3-none-any.whl.

File metadata

  • Download URL: tcp_modbus_aio-0.4.7-py3-none-any.whl
  • Upload date:
  • Size: 11.6 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9eb902dc7468507c5f25b7e3a5d0a8e77adc120df7b3c258670d5899de7699a1
MD5 ce87de78989a861ea8311f7b5156f485
BLAKE2b-256 1a93b97501ab3b0d252557c8451886aeebca6bead692b3042924f2be53716fc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tcp_modbus_aio-0.4.7-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