nio-blocks / modbus

Communicate with a device using Modbus
0 stars 0 forks source link

Add params to indicate source #21

Closed shadetree01010100 closed 7 years ago

shadetree01010100 commented 8 years ago

Currently there is no attribute that includes the source address/device, I'm finding that it requires adding a dynamic field after each modbus block to "name" the signal so that i can tell one from another. For example, these two signals came from two different modbus devices (slaves) but cannot be distinguished: {'transaction_id': 1, 'check': 0, 'protocol_id': 0, 'registers': [13111], 'skip_encode': False, 'unit_id': 0, 'params': {'address': 0}}

{'skip_encode': False, 'protocol_id': 0, 'registers': [15718], 'params': {'address': 0}, 'unit_id': 0, 'check': 0, 'transaction_id': 1}

This also applies to ModbusRTU block, if we could include an attribute (e.g. 'slave') that specifies the source address, that would be awesome, and save us from having to configure a unique dynamic field for each Modbus connection. In the case of ModbusTCP, this would be the configured "Host" IP address and for RTU it is the configured "Slave Address" integer.

shadetree01010100 commented 8 years ago

For an example of gratuitous dynamic fields, see the service "vibration_sensors" in PanelA in the AZZ project.

cowleyk commented 7 years ago

This issue was solved with the addition of the EnrichSignals mixin