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

Uploaded Python 3

File details

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

File metadata

  • Download URL: tcp_modbus_aio-0.4.6.tar.gz
  • Upload date:
  • Size: 10.2 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.6.tar.gz
Algorithm Hash digest
SHA256 4fed7b8bdae937a18ba765a48885e9a143d59576e002ab1db422f79e0815d46d
MD5 4344409c83fde3f032ceb0a0ce463263
BLAKE2b-256 d84d71b01b83406146ccdb614a5d06adfc429d75c65ff7cdb1c44ab6e6699f43

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: tcp_modbus_aio-0.4.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9943b1d0c5deadbecbea58c0a68187404c5a106a71975642b4e4418a17f45166
MD5 a75e73b0e7e1eb6bcb570bd2792d27d8
BLAKE2b-256 2a605ade6faee38246f3662d67907eabbd009dc7a68c7ecf309ffd55edb7e55b

See more details on using hashes here.

Provenance

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