We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I run a server/client example:
#!/usr/bin/env python3 import multiprocessing as mp import time from pymodbus.client import ModbusTcpClient from pymodbus.datastore import (ModbusDeviceContext, ModbusSequentialDataBlock, ModbusServerContext) from pymodbus.server import StartTcpServer class CallbackDataBlock(ModbusSequentialDataBlock): def setValues(self, address, value): print(f"Callback from setValues with address {address}, value {value}") super().setValues(address, value) def server(): PORT = 1234 block = CallbackDataBlock(0x00, [0]*10) store = ModbusDeviceContext(di=block, co=block, hr=block, ir=block) context = ModbusServerContext(devices=store, single=True) print(f"Starting server 127.0.0.1:{PORT}") StartTcpServer(context=context, address=("", PORT)) def client(): with ModbusTcpClient(host='127.0.0.1', port=1234) as client: print("Writing to address 4") client.write_coil(address=4, value=True) if __name__ == "__main__": p_server = mp.Process(target=server) p_server.start() time.sleep(1) p_client = mp.Process(target=client) p_client.start() time.sleep(1) p_server.terminate() p_server.kill() p_client.join()
I'd expect:
Writing to address 4 Callback from setValues with address 4, value [True]
but I'm getting a
Writing to address 4 Callback from setValues with address 5, value [True]
What could be the issue here?
The text was updated successfully, but these errors were encountered:
There are no issue, this is how ModbusSequentialDataBlock works for historical reasons.
ModbusSequentialDataBlock have a difference between "addressing" a value and "defining" the value.
The simulator as well as the upcoming datastore have addressing == defining.
Sorry, something went wrong.
No branches or pull requests
When I run a server/client example:
I'd expect:
but I'm getting a
What could be the issue here?
The text was updated successfully, but these errors were encountered: