Skip to content

Commit b475772

Browse files
authored
Solve problem due to mypy changes (#1386)
* Solve problem due to mypy changes. * part2.
1 parent 217469a commit b475772

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pymodbus/server/simulator/http_server.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ def __init__(
131131
if custom_actions_module:
132132
actions_module = importlib.import_module(custom_actions_module)
133133
custom_actions_dict = actions_module.custom_actions_dict
134+
else:
135+
custom_actions_dict = None
134136
server = setup["server_list"][modbus_server]
135137
server["loop"] = asyncio.get_running_loop()
136138
if server["comm"] != "serial":
@@ -502,8 +504,8 @@ async def build_json_server(self, params, json_dict):
502504

503505
def helper_build_filter(self, params):
504506
"""Build list of registers matching filter."""
505-
range_start = params.get("range_start", -1)
506-
range_stop = params.get("range_stop", range_start)
507+
range_start = int(params.get("range_start", -1))
508+
range_stop = int(params.get("range_stop", range_start))
507509
reg_action = int(params["action"])
508510
reg_writeable = "writeable" in params
509511
reg_type = int(params["type"])

pymodbus/server/simulator/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def get_commandline():
109109
async def run_main():
110110
"""Run server async."""
111111
cmd_args = get_commandline()
112+
cmd_args["http_port"] = 8081
113+
cmd_args["json_file"] = "./pymodbus/server/simulator/setup.json"
112114
task = ModbusSimulatorServer(**cmd_args)
113115
await task.run_forever()
114116

0 commit comments

Comments
 (0)