Skip to content
This repository has been archived by the owner on Sep 4, 2021. It is now read-only.

refactoring, support for smart blinds, cli interface, updated howto #45

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

dominikandreas
Copy link

Hi,

first of all, big thanks to everyone who worked on this! I'm really glad that this project exists and allows me to control my tuya devices without using the cloud.

I wanted to control my smart blinds and found out how to send the commands for open, close and stop (uses the same protocol, just different dps data). The changes were originally implemented just for myself to control my blinds from homeassistant using pytuya, but I guess others might be interested in this as well, so here we are.

Changes include:

  • added cover device for controlling smart blinds, garage doors, curtains etc
  • added commandline interface using click combined with a yaml config file
  • added ability to extract keys from api response
  • added ability to query for devices
  • udpated readme with better howto for extracting api response, cli, homeassistant integration
  • refactorings according to pep8, readability, simplicity

Someone should probably test this before merging as I only have smart blinds from tuya and wasn't able to test other devices.

Cheers,
Dominik

P.s.: sorry for the git commits and log messages. it's quite a lot of changes that could've been better organized in git for diff viewing and such...

@clach04
Copy link
Owner

clach04 commented Nov 13, 2018

@dominikandreas there is some really great stuff in here it is a lot to digest in one go (the readme is nice a clear). The refactoring is a mix of pep8, code changes, and code refactoring (e.g. ternary usage) which makes review process long and potentially error prone (I just tried this evening and was not able to complete).

The new dependencies mean that tests that do not require command line tools nor yaml, no longer run without additional requirements. I love the new command line tools, its really neat that you've made this almost turn-key solution for integration with HA without the need for plugin-approval. I do not want to maintain the command line tools in this project and new dependencies need a really good justification. I think the command likn pieces should be separate and then depend on the library.

Any chance you could remove the command line pieces into a new project, and then rebase/squash and submit the PR? I'd still need to handle multiple changes BUT I could test it more easily.

Thanks for taking the time to polish this so much, it looks very easy to use for end users.

@dominikandreas
Copy link
Author

I think extracting the CLI part into a separate project is a good idea and shouldn't be a problem, it's already pretty separated.

I'll try to clean it all up a bit for better reviewing and push another pull request. In the meantime, if there's anything in the changes you don't like (e.g. I've also added a retry logic that would probably be better to be resolved by that other pull request), please let me know

@dominikandreas
Copy link
Author

For now I will continue development on my repository until the other pull requests are completed. Unfortunately my time is pretty limited and the priority for integrating my devices in homeassistant is higher than refactoring the code. Feel free to close this pull request until then, or leave it open to track my changes..

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 this pull request may close these issues.

2 participants