Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API-Login from Mikrotik has changed with Version 6.43 #16615

Closed
CoReYeDe opened this issue Sep 14, 2018 · 3 comments · Fixed by #16718
Closed

API-Login from Mikrotik has changed with Version 6.43 #16615

CoReYeDe opened this issue Sep 14, 2018 · 3 comments · Fixed by #16718

Comments

@CoReYeDe
Copy link

CoReYeDe commented Sep 14, 2018

Home Assistant release with the issue:
Home Assistant 0.77.3

Last working Home Assistant release (if known):
Home Assistant 0.77.3

Operating environment (Hass.io/Docker/Windows/etc.):
Docker on Synology NAS

Component/platform:

device_tracker/mikrotik.py

Description of problem:
API-Login from Mikrotik has changed with Version 6.43
https://wiki.mikrotik.com/wiki/Manual:API#Initial_login

Traceback (if applicable):

Error doing job: Task exception was never retrieved

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/librouteros/connections.py", line 181, in write
    self.sock.sendall(string)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/device_tracker/__init__.py", line 692, in async_device_tracker_scan
    found_devices = await scanner.async_scan_devices()
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/device_tracker/mikrotik.py", line 137, in scan_devices
    self._update_info()
  File "/usr/src/app/homeassistant/components/device_tracker/mikrotik.py", line 159, in _update_info
    device_names = self.client(cmd='/ip/dhcp-server/lease/getall')
  File "/usr/local/lib/python3.6/site-packages/librouteros/api.py", line 79, in __call__
    self.protocol.writeSentence(cmd, *words)
  File "/usr/local/lib/python3.6/site-packages/librouteros/connections.py", line 139, in writeSentence
    self.transport.write(encoded)
  File "/usr/local/lib/python3.6/site-packages/librouteros/connections.py", line 185, in write
    raise ConnectionError('Failed to write to socket. ' + str(error))
librouteros.exceptions.ConnectionError: Failed to write to socket. [Errno 32] Broken pipe

Additional information:

@kunago
Copy link
Contributor

kunago commented Sep 14, 2018

This should already be supported by the latest librouteros via this commit, so an update of the library should be hopefully enough.

@CoReYeDe
Copy link
Author

CoReYeDe commented Sep 14, 2018

Library librouteros is updated from 2.1 to 2.1.1 but the Error persists
Update via pip install librouteros --upgrade

@qguernsey
Copy link

I did some digging on this tonight. I manually update librouteros with pip to version 2.1.1. Verified that it was correctly installed in the virtualenv. After starting up hass, I checked the environment again and it was once again running 2.1.0. Looking at the device tracker code for this it has
REQUIREMENTS = ['librouteros==2.1.0']
Looks like it is running as designed. Just need a pull request to update the version of librouteros. It appears the new library works with the new version of firmware. I don't have a device to check backwards compatibility to earlier versions.

@ghost ghost added the in progress label Sep 19, 2018
@ghost ghost removed the in progress label Sep 20, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants