Alllows accessing of RS485 or TCP ModBus.
| setting | values | description |
|---|---|---|
| type | pyRTU | RTU | TCP | pyRTU - python only modbus stack RTU - libmodbus stack TCP - python modbus/TCP |
| mode | master | slave | |
| debug | True | False | |
| port | /dev/ttyMB | tty device path |
| baudrate | 50 | 75 | 110 | 134 | 150 | 200 | 300 600 | 1200 | 1800 | 2400 | 4800 | 9600 19200 | 38400 | 57600 | 115200 | |
| parity | none | odd | even | |
| bits | 8 | |
| stopbits | 1 | |
| asynchronous | True | False | poll datapoints in the background |
| autopoll | True | False | |
| sleep_interval | float(0..x) | sleep time between polls in [s] |
| fork_tcp_gateway | True | False | enable raw access via ModBus/TCP |
| ferrors_remove_dp | int(1..x) | remove datapoint from poll list after x read failures |
| ferrors_dp_block_time | float(1..x) | block datapoint for time x |
| ferrors_device_block | int(1..x) | block device after x read errors |
| ferrors_device_block_time | float(1..x) | block all device datapoints for time x |
| int_values | True | False | return objects (True) or hex-string(False) |
/<driver_name>/<slave_address>/<function_code>/<register_address>:<length>/<field>
| uri-part | values | description |
|---|---|---|
| slave_address | int_hex(0..ff) | slave address of modbus device |
| function_code | int_hex(3|4) | 3 - Holding 4 - Input |
| register_address | int_hex(0000..ffff) | register address |
| length | int_hex(0..x) | count of words to read, optional, default=1 |
| field | <empty> | _raw | time | state | verbose | <empty> - value _raw - raw object time - request succeeded time state - last request state verbose - list of [time succeeded,valid value,last state,last request time,last value] |
| URI | /mb_master/00/04/007b | /mb_master/0a/03/0005/verbose |
|---|---|---|
| slave_address | 00 | 0a (hex) = 10 (dec) |
| function_code | 04 - InputRegister | 03 - HoldingRegister |
| register_address | 007b (hex) = 123 (dec) | 0005 (hex) = 5 (dec) |
| length | 1 | 1 |
| field | verbose | |
| description | read InputRegister @ address 123 from device 0 | return verbose state of HoldingRegister @ address 5 from device 10 |