Describe the issue
When trying to configure or connect to a Mikrotik router, the integration fails to authenticate. The issue stems from recent changes in the underlying librouteros library, which introduced two breaking changes in how the login method is passed during the connect() call:
The parameter 'login_methods' was renamed to 'login_method'.
It no longer accepts a string ("plain" or "token") and now requires the actual callable function.
ERROR (MainThread) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.x.x error while connecting: connect() got an unexpected keyword argument 'login_methods'. Did you mean 'login_method'?
How to reproduce the issue
Go to Settings -> Devices & Services in Home Assistant.
Attempt to add or configure the Mikrotik Router integration.
Enter valid IP, username, password, and port.
Click Submit.
See the connection failure in the UI and the fatal errors in the Home Assistant logs.
Expected behavior
Screenshots
Software versions
- Home Assistant version: 2026.4.4
- Mikrotik Router version: 2.2
- Router OS version: 7.22
- Mikrotik hAP AX^3
Diagnostics data
Traceback/Error logs
First error (due to parameter name change):
ERROR (MainThread) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.x.x error while connecting: connect() got an unexpected keyword argument 'login_methods'. Did you mean 'login_method'?
Second error (if parameter is renamed manually, due to string vs callable change):
ERROR (MainThread) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.x.x error while connecting: 'str' object is not callable
Additional context
I have successfully patched this locally by doing the following in custom_components/mikrotik_router/mikrotikapi.py:
Importing the functions at the top:
from librouteros.login import plain, token
Updating the kwargs dictionary inside the connect() method from this:
"login_methods": self._login_method,
To this:
"login_method": plain if self._login_method == "plain" else token,
Describe the issue
When trying to configure or connect to a Mikrotik router, the integration fails to authenticate. The issue stems from recent changes in the underlying librouteros library, which introduced two breaking changes in how the login method is passed during the connect() call:
The parameter 'login_methods' was renamed to 'login_method'.
It no longer accepts a string ("plain" or "token") and now requires the actual callable function.
ERROR (MainThread) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.x.x error while connecting: connect() got an unexpected keyword argument 'login_methods'. Did you mean 'login_method'?How to reproduce the issue
Go to Settings -> Devices & Services in Home Assistant.
Attempt to add or configure the Mikrotik Router integration.
Enter valid IP, username, password, and port.
Click Submit.
See the connection failure in the UI and the fatal errors in the Home Assistant logs.
Expected behavior
Screenshots
Software versions
Diagnostics data
Traceback/Error logs
First error (due to parameter name change):
ERROR (MainThread) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.x.x error while connecting: connect() got an unexpected keyword argument 'login_methods'. Did you mean 'login_method'?
Second error (if parameter is renamed manually, due to string vs callable change):
ERROR (MainThread) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.x.x error while connecting: 'str' object is not callable
Additional context
I have successfully patched this locally by doing the following in custom_components/mikrotik_router/mikrotikapi.py:
Importing the functions at the top:
from librouteros.login import plain, token
Updating the kwargs dictionary inside the connect() method from this:
"login_methods": self._login_method,
To this:
"login_method": plain if self._login_method == "plain" else token,