Skip to content

Tuya fix login problem and add login platform param#16058

Merged
balloob merged 2 commits intohome-assistant:devfrom
huangyupeng:tuya_fix_login
Aug 19, 2018
Merged

Tuya fix login problem and add login platform param#16058
balloob merged 2 commits intohome-assistant:devfrom
huangyupeng:tuya_fix_login

Conversation

@huangyupeng
Copy link
Copy Markdown
Contributor

@huangyupeng huangyupeng commented Aug 19, 2018

Description:

  1. add platform param to distinguish accounts from different apps. Default is tuya.
  2. fix a bug which may cause login failed.
  3. add the error reason while login failed.

Related issue (if applicable): fixes #15613

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.io#6048

Example entry for configuration.yaml (if applicable):

tuya:
  username: phone or email@example.com
  password: accountpassword
  country_code: 1
  platform: 'smart_life' or 'tuya'

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

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

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

@ghost ghost added the in progress label Aug 19, 2018
@balloob balloob added this to the 0.76.1 milestone Aug 19, 2018
@balloob
Copy link
Copy Markdown
Member

balloob commented Aug 19, 2018

Thanks for the quick fix.

@balloob balloob merged commit 21b88f2 into home-assistant:dev Aug 19, 2018
@ghost ghost removed the in progress label Aug 19, 2018
balloob pushed a commit that referenced this pull request Aug 19, 2018
* add a platform param to distinguish different app's account.

* fix requirements
@balloob balloob mentioned this pull request Aug 19, 2018
huangyupeng added a commit to huangyupeng/home-assistant.github.io that referenced this pull request Aug 20, 2018
Add platform to distinguish accounts from different apps
The value could be 'tuya' or 'smart_life'. Default is 'tuya'.
related pull request is home-assistant/core#16058
@bakerbug
Copy link
Copy Markdown

bakerbug commented Aug 20, 2018

I’m having issues with the Tuya component. All was working well in 0.75.3 and with 0.76.1 I am getting the following exception:

2018-08-20 13:28:24 ERROR (MainThread) [homeassistant.setup] Error during setup of component tuya
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py”, line 148, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File “/usr/lib/python3.5/asyncio/futures.py”, line 380, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.5/asyncio/tasks.py”, line 304, in _wakeup
future.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/concurrent/futures/thread.py”, line 55, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/tuya.py”, line 65, in setup
tuya.init(username, password, country_code, platform)
File “/srv/homeassistant/lib/python3.5/site-packages/tuyapy/tuyaapi.py”, line 44, in init
self.get_access_token()
File “/srv/homeassistant/lib/python3.5/site-packages/tuyapy/tuyaapi.py”, line 68, in get_access_token
raise TuyaAPIException(message)
tuyapy.tuyaapi.TuyaAPIException: Get accesstoken failed. Username or password error!

I have verified that my credentials are valid (they didn’t change since I upgraded). I have also tried adding the new platform option to my tuya config set to both smart_life and tuya. All combinations result in the same exception.

@huangyupeng
Copy link
Copy Markdown
Contributor Author

Could you please send me you account name ?

@MartinHjelmare
Copy link
Copy Markdown
Member

@bakerbug Please open an issue for this, if you suspect a bug.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Aug 20, 2018
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.

Tuya Component API Error

5 participants