Skip to content

Conversation

@markvanpraet
Copy link

Adds support for the Tapo C460 smart camera.

Changes include:

  • New smartcam fixture for C460
  • Battery module updates to safely handle optional temperature and voltage fields
  • Battery unit tests
  • Documentation updates (README and SUPPORTED)

All tests and pre-commit hooks pass locally.

@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.84%. Comparing base (a87926f) to head (7bf81a2).
⚠️ Report is 3 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@markvanpraet
Copy link
Author

All checks are now passing.
Added targeted edge-case tests to fully cover optional battery voltage/temperature and charging behavior - resulted in pretty major surgery to smartcam/test_battery.
Ready for review and happy for feedback.
Thanks!

Copy link
Member

@rytilahti rytilahti left a 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.

unit_getter=lambda: "celsius",
category=Feature.Category.Debug,
type=Feature.Type.Sensor,
if self._device.sys_info.get("battery_temperature") not in (None, "NO"):
Copy link
Member

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 :-)

Comment on lines 109 to 110
except (TypeError, ValueError):
return None
Copy link
Member

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.

@rytilahti rytilahti added the new device New device supported due to fixture being added label Jan 26, 2026
@markvanpraet
Copy link
Author

Thanks for the feedback!

Addressed review feedback:

  • Centralized battery temperature/voltage validation into a single helper
  • Avoided duplicated checks when initializing features
  • Handle invalid/non-numeric values observed in fixtures

All tests and pre-commit hooks pass.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new device New device supported due to fixture being added

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants