You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to receive a timestamp of my most recently received data? I looked through the source code a little, but as a pretty amateur programmer I might have missed it. I often use this library to talk to industrial equipment to feed DAQ devices data while they're measuring analog and digital sensors. As DAQs timesync everything, it would be incredibly useful if this client provided a property containing the timestamp of the most recent RX data.
The text was updated successfully, but these errors were encountered:
Hello, I may have misunderstood your request but the timestamp at the source is not managed by the Modbus protocol. At least, in the basic standard functions.
However, you can do it in your code:
importtimefromdataclassesimportdataclassfrompyModbusTCP.clientimportModbusClient# a simple data container@dataclassclassMyData:
timestamp: floatdata: list# init modbus clientc=ModbusClient(host='localhost')
# polling loopwhileTrue:
# modbus i/oret_read=c.read_holding_registers(reg_addr=0, reg_nb=4)
ifret_readisnotNone:
my_data=MyData(timestamp=time.time(), data=ret_read)
print(my_data)
# wait 5s before next pollingtime.sleep(5)
Is there a way to receive a timestamp of my most recently received data? I looked through the source code a little, but as a pretty amateur programmer I might have missed it. I often use this library to talk to industrial equipment to feed DAQ devices data while they're measuring analog and digital sensors. As DAQs timesync everything, it would be incredibly useful if this client provided a property containing the timestamp of the most recent RX data.
The text was updated successfully, but these errors were encountered: