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

Fix TP-Link device tracker regression since 0.49 #8497

Merged

Conversation

maikelwever
Copy link
Contributor

Description:

Fix TP-Link device tracker regression since 0.49

This regression was introduced by #8322.

Because all backends are attempted, and the broken one is first in line, this breaks other routers than the addition from the PR as well.

Fix is to utf encode the password like the other TP-Link backends do.

Traceback generated by the regression:

INFO:homeassistant.components.device_tracker:Setting up device_tracker.tplink
INFO:homeassistant.components.device_tracker.tplink:Loading wireless clients...
ERROR:homeassistant.components.device_tracker:Error setting up platform tplink
Traceback (most recent call last):
  File "/home/maikel/projects/home-assistant/homeassistant/components/device_tracker/__init__.py", line 151, in async_setup_platform
    platform.get_scanner, hass, {DOMAIN: p_config})
  File "/usr/lib64/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib64/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/maikel/projects/home-assistant/homeassistant/components/device_tracker/tplink.py", line 39, in get_scanner
    scanner = cls(config[DOMAIN])
  File "/home/maikel/projects/home-assistant/homeassistant/components/device_tracker/tplink.py", line 63, in __init__
    self.success_init = self._update_info()
  File "/home/maikel/projects/home-assistant/homeassistant/util/__init__.py", line 303, in wrapper
    result = method(*args, **kwargs)
  File "/home/maikel/projects/home-assistant/homeassistant/components/device_tracker/tplink.py", line 394, in _update_info
    password_md5 = hashlib.md5(self.password).hexdigest().upper()
TypeError: Unicode-objects must be encoded before hashing

Checklist:

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

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass

This regression was introduced by home-assistant#8322.

Fix is to utf encode the password like the other TP-Link backends do.
@mention-bot
Copy link

@maikelwever, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @mKeRix and @michaelarnauts to be potential reviewers.

@@ -391,7 +391,7 @@ def _update_info(self):
"Cache-Control": "no-cache"
}

password_md5 = hashlib.md5(self.password).hexdigest().upper()
password_md5 = hashlib.md5(self.password.encode('utf')).hexdigest().upper()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (87 > 79 characters)

@balloob balloob added this to the 0.49.1 milestone Jul 16, 2017
@balloob
Copy link
Member

balloob commented Jul 16, 2017

Thanks!

@balloob balloob merged commit f6c3832 into home-assistant:dev Jul 16, 2017
balloob pushed a commit that referenced this pull request Jul 24, 2017
* Fix TP-Link device tracker regression since 0.49

This regression was introduced by #8322.

Fix is to utf encode the password like the other TP-Link backends do.

* Fix linting issue introduced in previous commit

Commit in question: 677f3fb
@balloob balloob mentioned this pull request Jul 24, 2017
dethpickle pushed a commit to dethpickle/home-assistant that referenced this pull request Aug 18, 2017
* Fix TP-Link device tracker regression since 0.49

This regression was introduced by home-assistant#8322.

Fix is to utf encode the password like the other TP-Link backends do.

* Fix linting issue introduced in previous commit

Commit in question: 677f3fb
@home-assistant home-assistant locked and limited conversation to collaborators Dec 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants