Skip to content

Add Tuya light platform#15444

Merged
MartinHjelmare merged 4 commits intohome-assistant:devfrom
huangyupeng:tuya_light
Jul 15, 2018
Merged

Add Tuya light platform#15444
MartinHjelmare merged 4 commits intohome-assistant:devfrom
huangyupeng:tuya_light

Conversation

@huangyupeng
Copy link
Copy Markdown
Contributor

Description:

Add support for Tuya light. After configuring username and password and country code in Tuya component, home assistant can discover supported devices which related to user's Tuya account and control them through Tuya cloud service.

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

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.

If the code does not interact with devices:

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

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Looks good. Two small comments.

Comment thread homeassistant/components/tuya.py Outdated
@property
def unique_id(self):
"""Return a unique ID."""
return 'tuya.' + self.tuya.object_id()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use string formatting.

return 'tuya.{}'.format(self.tuya.object_id())

Comment thread homeassistant/components/tuya.py Outdated

TUYA_TYPE_TO_HA = {
'switch': 'switch'
'switch': 'switch',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please sort 🔡.

@huangyupeng
Copy link
Copy Markdown
Contributor Author

@MartinHjelmare
Last time, you said that I should use icon property. But I found that when return the URL, the icon doesn't work. So, maybe I should use entity_picture property?

@MartinHjelmare
Copy link
Copy Markdown
Member

Yeah, that looks good. I missed that it was a url.

@MartinHjelmare MartinHjelmare merged commit ca4f69f into home-assistant:dev Jul 15, 2018
@ghost ghost removed the in progress label Jul 15, 2018
@MartinHjelmare
Copy link
Copy Markdown
Member

Make sure to add a docs PR.

@frenck
Copy link
Copy Markdown
Member

frenck commented Jul 15, 2018

@MartinHjelmare Please do not merge when you think or know the documentation is missing.

@MartinHjelmare
Copy link
Copy Markdown
Member

Yes, I missed to check this time.

@gsalvati
Copy link
Copy Markdown

Dears, I updated to HA 0.74.2 and enabled Tuya component for my account.
But I have 3 window switch and I want to know how to enable it on HA interface? There is 3 position in the Window (blind) Switch (UP, OFF, DOWN), its more like 2 way light switch.
Any help?

@gsalvati
Copy link
Copy Markdown

@huangyupeng can you add "cover" support por Tuya Smart?

@MartinHjelmare
Copy link
Copy Markdown
Member

Feature and enhancement requests should go in the Feature Requests section of our community forum. Thanks!

@home-assistant home-assistant locked and limited conversation to collaborators Jul 28, 2018
@ghost ghost removed the platform: light.tuya label Mar 21, 2019
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.

5 participants