-
-
Notifications
You must be signed in to change notification settings - Fork 246
smartcam: add Tapo C460 fixture and battery support #1645
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
base: master
Are you sure you want to change the base?
smartcam: add Tapo C460 fixture and battery support #1645
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1645 +/- ##
==========================================
+ Coverage 92.82% 92.84% +0.01%
==========================================
Files 157 157
Lines 9649 9666 +17
Branches 976 981 +5
==========================================
+ Hits 8957 8974 +17
Misses 492 492
Partials 200 200 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
All checks are now passing. |
rytilahti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @markvanpraet and thanks for the PR! It looks good to me on surface, just a minor nitpick on how to check for the availability to keep the code cleaner.
kasa/smartcam/modules/battery.py
Outdated
| unit_getter=lambda: "celsius", | ||
| category=Feature.Category.Debug, | ||
| type=Feature.Type.Sensor, | ||
| if self._device.sys_info.get("battery_temperature") not in (None, "NO"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the validation checks are done multiple times, I would suggest introducing a _battery_temperature (and similar for the voltage) that either returns the value or None if not available, or simply use the existing getters? Makes the code cleaner and easier to test :-)
kasa/smartcam/modules/battery.py
Outdated
| except (TypeError, ValueError): | ||
| return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a chance that this might happen? If not, it would be better to allow it to raise to avoid swallowing exceptions.
|
Thanks for the feedback! Addressed review feedback:
All tests and pre-commit hooks pass. Thanks! |
Adds support for the Tapo C460 smart camera.
Changes include:
All tests and pre-commit hooks pass locally.