FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add WhiteLamp SmartCam module for outdoor cameras (e.g. C325WB) by ijardillier · Pull Request #1713 · python-kasa/python-kasa · GitHub

Repository navigation

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

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

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

Conversation

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.

codecov Bot commented Jun 24, 2026 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.47%. Comparing base (2a81f74) to head (1df9048).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1713      +/-   ##
==========================================
+ Coverage   93.42%   93.47%   +0.04%     
==========================================
  Files         160      161       +1     
  Lines       10091    10168      +77     
  Branches     1041     1050       +9     
==========================================
+ Hits         9428     9505      +77     
  Misses        471      471              
  Partials      192      192              

☔ 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.

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread kasa/smartcam/modules/whitelamp.py Outdated
@@ -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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 thread kasa/smartcam/modules/whitelamp.py Outdated
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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
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.

Comment thread kasa/smartcam/modules/whitelamp.py Outdated
@@ -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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
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.

Comment thread kasa/smartcam/modules/whitelamp.py Outdated
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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Comment thread kasa/smartcam/modules/whitelamp.py Outdated
_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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
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 added the enhancement New feature or request label Jul 5, 2026
ijardillier and others added 2 commits October 17, 2026 15:58
- 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
  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"
ijardillier force-pushed the add-smartcam-whitelamp branch from 2c10b1e to 16da3a6 Compare October 17, 2026 14:25

Copy link
Copy Markdown
Author

Hi @rytilahti

Thanks for the review ans sorry for the delay!
Renamed the module to FloodLight (floodlight.py) and the features to floodlight / floodlight_brightness, applied the docstring suggestions, and made it implement the light interface.
The newline issue came from my side and is fixed by the rebase.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL