Read Device Identification is described in section 6.21 of the MODBUS Application Protocol Specification V1.1b
http://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdfand I believe I've found the relevant pymodbus code here:
http://readthedocs.org/docs/pymodbus/en/latest/library/mei-message.html#pymodbus.mei_message.ReadDeviceInformationRequestI have instantiated a pymodbus ModbusSerialClient like this:
client = ModbusSerialClient(
method='rtu',
port='/dev/tts/1',
baudrate=9600,
bytesize=8,
parity='N',
stopbits=2,
timeout=1.5,
writeTimeout=1.5)
but I don't know how to execute the request. I've tried the following:
>>> from pymodbus.client.sync import ModbusSerialClient as ModbusClient
>>> from pymodbus.mei_message import ReadDeviceInformationRequest
>>> c = ModbusClient(method='rtu',port='/dev/tts/1',baudrate=9600,bytesize=8,parity='N',stopbits=2,timeout=1.5,writeTimeout=1.5)
>>> req = ReadDeviceInformationRequest(01,0x00)
>>> c.execute(req)
>>>
but there is no return value like the read_* functions in modbus/client/common.py. Am I doing this correctly? Is there a simpler way to do this? I feel as though I need to implement a read_device_information() in the manner of ModbusClientMixin.read_coils(), but I am unsure if this is how this should be done.
Justin