-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: add option to force on flood light for light devices #154
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe recent changes introduce a new command in the CLI application for light devices, allowing users to enable or disable the flood light feature. This functionality is supported by an asynchronous method in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
|
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.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/uiprotect/cli/lights.py (1 hunks)
- src/uiprotect/data/devices.py (1 hunks)
Additional context used
GitHub Check: codecov/patch
src/uiprotect/data/devices.py
[warning] 177-178: src/uiprotect/data/devices.py#L177-L178
Added lines #L177 - L178 were not covered by tests
[warning] 180-180: src/uiprotect/data/devices.py#L180
Added line #L180 was not covered by tests
Additional comments not posted (2)
src/uiprotect/cli/lights.py (1)
123-128
: LGTM!The code changes are approved.
src/uiprotect/data/devices.py (1)
174-180
: LGTM!The code changes are approved.
Tools
GitHub Check: codecov/patch
[warning] 177-178: src/uiprotect/data/devices.py#L177-L178
Added lines #L177 - L178 were not covered by tests
[warning] 180-180: src/uiprotect/data/devices.py#L180
Added line #L180 was not covered by tests
@app.command() | ||
def set_flood_light(ctx: typer.Context, enabled: bool) -> None: | ||
"""Sets flood light (force on) for light device.""" | ||
base.require_device_id(ctx) | ||
obj: Light = ctx.obj.device | ||
|
||
base.run(ctx, obj.set_flood_light(enabled)) |
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.
Reminder: Add tests.
The new function set_flood_light
lacks unit tests.
Do you want me to generate the unit testing code or open a GitHub issue to track this task?
async def set_flood_light(self, enabled: bool) -> None: | ||
"""Sets the flood light (force on) for the light""" | ||
|
||
def callback() -> None: | ||
self.light_on_settings.is_led_force_on = enabled | ||
|
||
await self.queue_update(callback) |
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.
Reminder: Add tests.
The new method set_flood_light
lacks unit tests.
Do you want me to generate the unit testing code or open a GitHub issue to track this task?
Tools
GitHub Check: codecov/patch
[warning] 177-178: src/uiprotect/data/devices.py#L177-L178
Added lines #L177 - L178 were not covered by tests
[warning] 180-180: src/uiprotect/data/devices.py#L180
Added line #L180 was not covered by tests
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.
@zevmela Thanks for the PR. Can you add some test coverage to get the CI passing?
Description of change
The Ubiquiti Protect UI has an option to "force on" the flood light. I added the command and tested on a UDM Pro and a UNVR running current software and UP Floodlight.
Pull-Request Checklist
main
branchFixes #0000
Summary by CodeRabbit
These enhancements improve user control over their light devices through expanded command-line functionalities.