sourceperl / pyModbusTCP

A simple Modbus/TCP library for Python
MIT License
292 stars 102 forks source link

Device Identification objects #60

Open dunforda opened 1 year ago

dunforda commented 1 year 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 1 year ago

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

sourceperl commented 7 months 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