There is a device that sends information using the Modbus protocol. I am using the following python code to receive the information of this device :
from pymodbus.client.sync import ModbusTcpClient,ModbusUdpClient
from pymodbus.transaction import ModbusRtuFramer as ModbusFramer
client = ModbusUdpClient("109.125.128.232", port=50450, framer=ModbusFramer)
success = client.connect()
print(success)
read = client.read_holding_registers(address=100, unit=2)
I get the following error :
Traceback (most recent call last):
File "C:\Users\hossein\Desktop\modebuspool\modebus.py", line 9, in <module>
read = client.read_holding_registers(address=100, unit=2)
File "C:\Users\hossein\AppData\Local\Programs\Python\Python37\lib\site-packages\pymodbus\client\common.py", line 114, in read_holding_registers
return self.execute(request)
File "C:\Users\hossein\AppData\Local\Programs\Python\Python37\lib\site-packages\pymodbus\client\sync.py", line 109, in execute
return self.transaction.execute(request)
File "C:\Users\hossein\AppData\Local\Programs\Python\Python37\lib\site-packages\pymodbus\transaction.py", line 178, in execute
broadcast=broadcast
File "C:\Users\hossein\AppData\Local\Programs\Python\Python37\lib\site-packages\pymodbus\transaction.py", line 274, in _transact
size = self._send(packet)
File "C:\Users\hossein\AppData\Local\Programs\Python\Python37\lib\site-packages\pymodbus\transaction.py", line 309, in _send
return self.client.framer.sendPacket(packet)
File "C:\Users\hossein\AppData\Local\Programs\Python\Python37\lib\site-packages\pymodbus\framer\rtu_framer.py", line 263, in sendPacket
timeout = start + self.client.timeout
TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'