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

Constructor and documentation updates #188

Merged
merged 3 commits into from
Oct 5, 2022

Conversation

uzlonewolf
Copy link
Collaborator

@uzlonewolf uzlonewolf commented Oct 4, 2022

After that last PR I realized I forgot to update Device() to make the address optional, and the documentation was wrong in a couple spots. After fixing that I decided to make persist= an optional argument for everything (it was already an option for my ThermostatDevice). While working on that I decided I hated how a bunch of stuff was handling init(), so I deleted it in everything that didn't actually need it and made the rest dynamically pass everything through (while updating any defaults as needed).

Finally I condensed the constructor documentation to just OutletDevice.py and __init__.py and changed everything else to "See OutletDevice"

@uzlonewolf
Copy link
Collaborator Author

uzlonewolf commented Oct 4, 2022

As part of the groundwork for #185, DEVICEFILE_SAVE_VALUES now contains a list of keys which, if they exist in the Cloud.getdevices() result, are copied to devices.json. I currently have the list set to ('category', 'product_name', 'product_id', 'biz_type', 'model', 'sub', 'icon', 'version', 'last_ip'). version and last_ip are currently not set anywhere but will eventually be populated by the scanner. icon is prepended with a hostname based off of the API host to make it a valid URL.

wizard.py seemed to have re-implemented half of tinytuya.Cloud, so that was cleaned up and now tinytuya.Cloud.getdevices() is the only code path to get the device list.

@jasonacox jasonacox merged commit 927e2f2 into jasonacox:master Oct 5, 2022
@jasonacox
Copy link
Owner

Welcome back @uzlonewolf !!! 😁

These changes make sense and the approach is far more elegant. During the review, I thought through any possible backward compatibility issue with the API and didn't see anything, though BulbDevice had me wondering. It looks great.

Thanks for the wizard cleanup (the de-dup)! That bugged me but never had time to clean it up. And I love the Cloud.getdevices() updates for the extended device data details to devices.json! I also like the clean approach with device_info() as the API to all devices.json details.

I feel like I need to do a good rewrite of the README to make these enhancement visible.

Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants