diff --git a/pymodbus/server/simulator/http_server.py b/pymodbus/server/simulator/http_server.py index 537aaf8a1..82f74fef0 100644 --- a/pymodbus/server/simulator/http_server.py +++ b/pymodbus/server/simulator/http_server.py @@ -131,6 +131,8 @@ def __init__( if custom_actions_module: actions_module = importlib.import_module(custom_actions_module) custom_actions_dict = actions_module.custom_actions_dict + else: + custom_actions_dict = None server = setup["server_list"][modbus_server] server["loop"] = asyncio.get_running_loop() if server["comm"] != "serial": @@ -502,8 +504,8 @@ async def build_json_server(self, params, json_dict): def helper_build_filter(self, params): """Build list of registers matching filter.""" - range_start = params.get("range_start", -1) - range_stop = params.get("range_stop", range_start) + range_start = int(params.get("range_start", -1)) + range_stop = int(params.get("range_stop", range_start)) reg_action = int(params["action"]) reg_writeable = "writeable" in params reg_type = int(params["type"]) diff --git a/pymodbus/server/simulator/main.py b/pymodbus/server/simulator/main.py index 79961333b..09af4928a 100755 --- a/pymodbus/server/simulator/main.py +++ b/pymodbus/server/simulator/main.py @@ -109,6 +109,8 @@ def get_commandline(): async def run_main(): """Run server async.""" cmd_args = get_commandline() + cmd_args["http_port"] = 8081 + cmd_args["json_file"] = "./pymodbus/server/simulator/setup.json" task = ModbusSimulatorServer(**cmd_args) await task.run_forever()