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
When using a ModbusTCP to RTU gateway, the unit_id is used to indicate the slave address on the RS-485 bus.
Slave address 0 is for broadcasting, for which no answers from the slaves should be expected, but pyModbusTCP threats unit_id=0 just like all the other values and waits for a response.
The only way to send a series of broadcast messages right now is to set the timeout value very low (approx. the time it takes for the frame to transmit on the RS-485 bus) and to ignore the return value of the write function.
Many devices using ModbusTCP (that are not RTU gateways) often ignore the unit_id value or use unit_id=0 as a regular target, so I understand the reason why it's implemented this way.
It would be a good feature though to be able to indicate somehow that the target is a RTU-Gateway, where unit_id=0 is treated as a broadcast message and the write function just returns True when the transmission is done.
The text was updated successfully, but these errors were encountered:
If the MODBUS server is connected to a MODBUS+ or MODBUS Serial Line sub-network and addressed through a bridge or a gateway, the MODBUS Unit identifier is necessary to identify the slave device connected on the sub- network behind the bridge or the gateway. The destination IP address identifies the bridge itself and the bridge uses the MODBUS Unit identifier to forward the request to the right slave device.
The MODBUS slave device addresses on serial line are assigned from 1 to 247 (decimal). Address 0 is used as broadcast address.
On TCP/IP, the MODBUS server is addressed using its IP address; therefore, the MODBUS Unit Identifier is useless. The value 0xFF has to be used. Remark : The value 0 is also accepted to communicate directly to a MODBUS/TCP device.
You should treat Unit ID 0 as a broadcast address for RTU gateways
You should not use Unit ID 1-247 (significant slave addresses) for Modbus/TCP devices
Unit ID 255 has to be used for Modbus/TCP endpoints
Unit ID 0 is also accepted, contradicting point 1.
So the best solution I think would be to have a configuration option for the modbus client e.g. "gateway" that can be set to True in case Unit ID 0 is broadcast and has no response from the slave.
When using a ModbusTCP to RTU gateway, the unit_id is used to indicate the slave address on the RS-485 bus.
Slave address 0 is for broadcasting, for which no answers from the slaves should be expected, but pyModbusTCP threats unit_id=0 just like all the other values and waits for a response.
The only way to send a series of broadcast messages right now is to set the timeout value very low (approx. the time it takes for the frame to transmit on the RS-485 bus) and to ignore the return value of the write function.
Many devices using ModbusTCP (that are not RTU gateways) often ignore the unit_id value or use unit_id=0 as a regular target, so I understand the reason why it's implemented this way.
It would be a good feature though to be able to indicate somehow that the target is a RTU-Gateway, where unit_id=0 is treated as a broadcast message and the write function just returns True when the transmission is done.
The text was updated successfully, but these errors were encountered: