@app.route(slave_ids=[1], function_codes=[1, 2], addresses=[1, 2, 3, 4])
def read_coil(slave_id, address):
""" Return value of digital input. """
return address % 2
The route cannot know the Modbus function code of the request. Routes should be called with function_code so the signature for read functions becomes this:
Image a route like this:
The route cannot know the Modbus function code of the request. Routes should be called with
function_code
so the signature for read functions becomes this:And for write functions: