sourceperl / pyModbusTCP

A simple Modbus/TCP library for Python
MIT License
308 stars 106 forks source link

Device Identification objects #60

Closed dunforda closed 4 months ago

dunforda commented 2 years ago

Thank you very much for your package. Is it possible to read the Device Identification information? E.g. serial number of TH probes etc.

Thank you,

dunforda commented 2 years ago

I tried copy/adapting read_holding_registers in client.py but it's obviously a bit more complicated than that ...

sourceperl commented 1 year ago

This is now available in pyModbusTCP version 0.2.1.

from pyModbusTCP.client import ModbusClient

mc = ModbusClient(host='myserver.example.com')
dev_id_resp = mc.read_device_identification()
print(f'vendor={dev_id_resp.vendor_name}')

more: https://pymodbustcp.readthedocs.io/en/latest/package/class_ModbusClient.html#pyModbusTCP.client.ModbusClient.read_device_identification