[Feature Request] restart_comm

Dear Mech-Mind Team,
I came across the problem of restarting the Adapter via the Adapter itself.

This is necessary in case of any config changes, etc. that have an effect on the adapter object itself.

The easiest solution I found was to add a new Mech-Center command “restart_comm” in addition to “start_comm” and “stop_comm” which basically combines the two. Since this involves changing Mech-Center Code, it would be awesome to include a restart adapter command into further versions.

Thank you very much,
kind regards,


Hi Jonathan,

I’m not so sure about “restarting the Adapter via the Adapter itself”.

I think you can just call the “start_comm”. It will firstly close the interface opened before, then start a new one. So actually it act like a “restart_comm”.


Hi Xinv, thanks for your response.
I thought so too, but the request fails while the adapter is running:

`08:23:00.156 [I] Thread-33 adapter.py 240: Call service:notify, message:{‘function’: ‘control_center’, ‘command’: ‘start_comm’}

08:23:00.158 [I] ThreadPoolExecutor-1_7 manager.py 165: Forward to “notify” with message: {‘function’: ‘control_center’, ‘command’: ‘start_comm’}

08:23:00.160 [E] MainThread adapter_manager.py 88: ‘use_standard_interface’
Traceback (most recent call last):

File “C:\Mech-Mind\Mech-Vision & Mech-Viz-1.8.2\Mech-Center\src\interface\adapter_manager.py”, line 73, in start
comm_settings = self.format_comm_settings(comm_settings)

File “C:\Mech-Mind\Mech-Vision & Mech-Viz-1.8.2\Mech-Center\src\interface\adapter_manager.py”, line 57, in format_comm_settings
if not (comm_settings[jk.use_standard_interface] and interface_name == INTERFACE_SIEMENS_PLC_CLIENT):
KeyError: ‘use_standard_interface’`

I believe the

‘comm_settings = msg.get(jk.communication_setting, {})’

call fails, while the adapter is running, since comm_settings is an empty dict while adapter is running.

Hi Jonathan,
The function “start_comm” needs to add parameters.
For example, to start the adapter, the message you send should be like this:
“command”: “start_comm”,
“communication_setting”: {
“host_address”: “”,
“project_dir”: “C:/Users/mech-mind/Desktop/test_adapter”,
“use_standard_interface”: False,
“is_enable”: True

1 Like

Hi Zhiming,
ah this is perfect - i didn’t know I could pass those arguments as well.

In case someone needs the full solution:

    msg = {
        "function": "control_center",
        "command": "start_comm",
        "communication_setting": self.setting_infos["communication"],
    self.call(service_name="notify", message=msg)
    logging.error("error restarting adapter")
    return False
return True
1 Like