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

Add login_method config option to fix login issue with RouterOS Version > 6.43 #25194

Merged
merged 3 commits into from
Jul 17, 2019
Merged

Conversation

Bouni
Copy link
Contributor

@Bouni Bouni commented Jul 17, 2019

Description:

Mikrotik changed the used login method with version 6.43 of their RouterOS and disabled the old token login method with version 6.45.1. Therefore the mikrotik component was no longer able to login and use the API.

Related issue: fixes #25189

Pull request with documentation for home-assistant.io : home-assistant/home-assistant.io#9877

Example entry for configuration.yaml (if applicable):

- platform: mikrotik
  host: 192.168.23.1
  track_new_devices: false
  login_method: plain
  username: !secret mikrotik_username
  password: !secret mikrotik_password

Checklist:

  • [ x ] The code change is tested and works locally.
  • [ x ] Local tests pass with tox. Your PR cannot be merged unless tests pass
  • [ x ] There is no commented out code in this PR.
  • [ x ] I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • [ x ] The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@MartinHjelmare
Copy link
Member

Is this a breaking change? Does the user need to do anything?

@MartinHjelmare MartinHjelmare changed the title added login_method config option to fix login issue with RouterOS Version > 6.43 Add login_method config option to fix login issue with RouterOS Version > 6.43 Jul 17, 2019
@Bouni
Copy link
Contributor Author

Bouni commented Jul 17, 2019

@MartinHjelmare
Indeed as I think of it, but I could just extend the login_methods tuple so that it has both login methods and therefore it would continue for all users without the need to change anything

@MartinHjelmare
Copy link
Member

If we can solve it nicely without requiring user interaction, that would be the best.

@Bouni
Copy link
Contributor Author

Bouni commented Jul 17, 2019

@MartinHjelmare Just pushed a commit in which I changed the login method tuple so that users don't have to take action. If they want to avoid the log message on their router, they still can set the login_method in the config and specify which method to use.

@MartinHjelmare
Copy link
Member

What is the log message that can be avoided?

@Bouni
Copy link
Contributor Author

Bouni commented Jul 17, 2019

Its login failure for user homeassistant from 192.168.23.104 via api
The reason is that you pass a tuple with both login methods to the connect method.
If you put the token method first, users with Version < 6.45.1 will not get an error, but users with versions >= 6.45.1 will do.
On the other hand if we swap the order of login methods, users with Versions < 6.43 will get the error but all others not.
In my opinion its better the we it is in my last commit becuase users will eventually get to versions > 6.43
which will automatically result in no errors.

@MartinHjelmare
Copy link
Member

Sounds good. Let's make sure we explain clearly in the docs how the user can avoid the log message by configuration.

@MartinHjelmare MartinHjelmare merged commit 21f68b8 into home-assistant:dev Jul 17, 2019
KJonline pushed a commit to Rendili/home-assistant that referenced this pull request Jul 17, 2019
…into dev

* 'dev' of https://github.com/home-assistant/home-assistant: (156 commits)
  Add HmIP-PCBS2, HmIP-PCBS-BAT to Homematic IP Cloud (home-assistant#25201)
  Simplify cache restore (home-assistant#25186)
  Only include target temp if has right support flag (home-assistant#25193)
  Fix issue home-assistant#24495 (home-assistant#25199)
  Handle somfy expired token (home-assistant#25195)
  Add login_method config option to fix login issue with RouterOS Version > 6.43 (home-assistant#25194)
  Add HMIP-FCI / HMIP-FBL / HmIP-BBL (home-assistant#25188)
  [climate] Tweak evohome migration (home-assistant#25187)
  Fix device name customization on ZHA add devices page (home-assistant#25180)
  Upgrade mypy to 0.720, turn on unreachability warnings (home-assistant#25157)
  Use MockConfigEntry (home-assistant#25190)
  Add severe weather sensor to Dark Sky (home-assistant#22701)
  Fix typo in azure-pipelines-ci.yml
  Raise not ready when no data from API is retrieved (home-assistant#25182)
  Improve Nuki lock (home-assistant#22888)
  Delete config.yml (home-assistant#25181)
  Upgrade luftdaten to 0.6.2 (home-assistant#25177)
  Upgrade Mastodon.py to 1.4.5 (home-assistant#25176)
  Upgrade ruamel.yaml to 0.15.99 (home-assistant#25175)
  Upgrade discord.py to 1.2.3 (home-assistant#25174)
  ...
KJonline pushed a commit to Rendili/home-assistant that referenced this pull request Jul 17, 2019
…into hive_water_heater

* 'dev' of https://github.com/home-assistant/home-assistant: (49 commits)
  Pin Docker to Debain Stretch (home-assistant#25206)
  Updated frontend to 20190717.0
  Add HmIP-PCBS2, HmIP-PCBS-BAT to Homematic IP Cloud (home-assistant#25201)
  Simplify cache restore (home-assistant#25186)
  Only include target temp if has right support flag (home-assistant#25193)
  Fix issue home-assistant#24495 (home-assistant#25199)
  Handle somfy expired token (home-assistant#25195)
  Add login_method config option to fix login issue with RouterOS Version > 6.43 (home-assistant#25194)
  Add HMIP-FCI / HMIP-FBL / HmIP-BBL (home-assistant#25188)
  [climate] Tweak evohome migration (home-assistant#25187)
  Fix device name customization on ZHA add devices page (home-assistant#25180)
  Upgrade mypy to 0.720, turn on unreachability warnings (home-assistant#25157)
  Use MockConfigEntry (home-assistant#25190)
  Add severe weather sensor to Dark Sky (home-assistant#22701)
  Fix typo in azure-pipelines-ci.yml
  Raise not ready when no data from API is retrieved (home-assistant#25182)
  Improve Nuki lock (home-assistant#22888)
  Delete config.yml (home-assistant#25181)
  Upgrade luftdaten to 0.6.2 (home-assistant#25177)
  Upgrade Mastodon.py to 1.4.5 (home-assistant#25176)
  ...

# Conflicts:
#	homeassistant/components/hive/water_heater.py
@lock lock bot locked and limited conversation to collaborators Jul 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mikrotik device_tracker login fails if RouterOS >= 6.45.1
3 participants