Hello There!
Im trying to read the data of a Slave RUT240 through a Rpi but still I could not get a single answer, an error arise and it has to be with the directioning of the slave itself, maybe I have the wrong IP or UnitID. I will leave here my Modbus configuration of the slave and the code used for reading the registers, I hope to get some help from someone who has had the experience. Thanks in advance:
ip = "192.168.1.1" # ip address of GX device or if on venus local try localhost
# Value Refresh Rate in seconds
RefreshRate = 1
teltonikaID = 1
#===================================
Defaults.Timeout = 25
Defaults.Retries = 5
# Local network ip address of Cerbo GX. Default port 502
client = ModbusClient(ip, port='503')
def modbus_register(address, unit):
msg = client.read_input_registers(address, unit=unit)
decoder = BinaryPayloadDecoder.fromRegisters(msg.registers, byteorder=Endian.Big)
msg = decoder.decode_16bit_int()
return msg
signal=modbus_register(71,unit= teltonikaID)