Skip to content

Add WhiteLamp SmartCam module for outdoor cameras (e.g. C325WB)#1713

Open
ijardillier wants to merge 2 commits into
python-kasa:masterfrom
ijardillier:add-smartcam-whitelamp
Open

Add WhiteLamp SmartCam module for outdoor cameras (e.g. C325WB)#1713
ijardillier wants to merge 2 commits into
python-kasa:masterfrom
ijardillier:add-smartcam-whitelamp

Conversation

@ijardillier

Copy link
Copy Markdown

New WhiteLamp module under kasa/smartcam/modules/

  • Exposes white_lamp_state (on/off toggle via reverseWhitelampStatus) and white_lamp_brightness (1-100, only if device supports it)
  • Adds Module.SmartCamWhiteLamp and Module.WhiteLamp module names
  • Adds fixture for C325WB(EU) 1.0 / 1.4.4
  • Adds unit tests in tests/smartcam/modules/test_whitelamp.py
  • Fixes fake protocol to handle reverseWhitelampStatus toggle command

Pre-commit OK
Tests : OK

Also tested with python-kasa CLI and my own Home Assistant instance with 2 C325WB cameras.

Hope all is compliant with your guidelines and nothing missing.

- New WhiteLamp module under kasa/smartcam/modules/
- Exposes white_lamp_state (on/off toggle via reverseWhitelampStatus)
  and white_lamp_brightness (1-100, only if device supports it)
- Adds Module.SmartCamWhiteLamp and Module.WhiteLamp module names
- Adds fixture for C325WB(EU) 1.0 / 1.4.4
- Adds unit tests in tests/smartcam/modules/test_whitelamp.py
- Fixes fake protocol to handle reverseWhitelampStatus toggle command
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.43568% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.24%. Comparing base (76d9f68) to head (2c10b1e).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
kasa/smartcam/smartcammodule.py 88.67% 3 Missing and 3 partials ⚠️
kasa/module.py 96.87% 1 Missing and 3 partials ⚠️
kasa/smartcam/modules/whitelamp.py 97.22% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1713      +/-   ##
==========================================
+ Coverage   93.22%   93.24%   +0.01%     
==========================================
  Files         157      158       +1     
  Lines        9815     9854      +39     
  Branches     1003     1005       +2     
==========================================
+ Hits         9150     9188      +38     
  Misses        472      472              
- Partials      193      194       +1     

☔ View full report in Codecov by Harness.
📢 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.

  to match the class name used as key in dev.modules
- Add SmartCamModule.SmartCamWhiteLamp assertion in test_whitelamp_is_on
- Add test_whitelamp_no_brightness to cover the case where brightness
  is not supported by the device"

@rytilahti rytilahti left a comment

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.

Thanks for the PR @ijardillier, I have done a quick review on it. The module looks very straightforward, so this can be merged rather quickly after the issues mentioned in the comments are fixed.

@@ -0,0 +1,96 @@
"""Module for white lamp (floodlight) controls on Tapo outdoor cameras."""

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.

If it is a floodlight, feel free to name the class also like that, no need to keep the internal namings :-) The name of the class and the file could be simply FloodLight and floodlight.py respectively. If you want to keep the internal naming available in docstrings, you can put that in parentheses.

Comment on lines +17 to +20
"""Implementation of white lamp controls for outdoor cameras (e.g. C325WB).

The white lamp is the built-in floodlight that can be triggered manually
or by motion events. It is distinct from the LED status indicator.

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.

Suggested change
"""Implementation of white lamp controls for outdoor cameras (e.g. C325WB).
The white lamp is the built-in floodlight that can be triggered manually
or by motion events. It is distinct from the LED status indicator.
"""Implementation of floodlight controls for outdoor cameras.

@@ -0,0 +1,96 @@
"""Module for white lamp (floodlight) controls on Tapo outdoor cameras."""

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.

Suggested change
"""Module for white lamp (floodlight) controls on Tapo outdoor cameras."""
"""Module for floodlight controls ("whitelamp" module) on Tapo outdoor cameras."""

If it is a floodlight, feel free to name the class also like that, no need to keep the internal namings :-) The name of the class and the file could be simply FloodLight and floodlight.py respectively. If you want to keep the internal naming available in docstrings, you can put that in parentheses.

Feature(
self._device,
id="white_lamp_state",
name="White lamp state",

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.

See my comment above, these are user-interfacing names.

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.

I am not sure what is going on here, newline separator changes?

_LOGGER = logging.getLogger(__name__)


class WhiteLamp(SmartCamModule):

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.

Suggested change
class WhiteLamp(SmartCamModule):
class WhiteLamp(SmartCamModule, LightInterface):

It would be nice to inherit from the lightinterface like other light modules do. This will make it also easier to integrate elsewhere.

@rytilahti rytilahti added the enhancement New feature or request label Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants