diff --git a/src/uiprotect/cli/lights.py b/src/uiprotect/cli/lights.py index 373ebe83..e3324e4c 100644 --- a/src/uiprotect/cli/lights.py +++ b/src/uiprotect/cli/lights.py @@ -117,3 +117,12 @@ def set_duration( obj: Light = ctx.obj.device base.run(ctx, obj.set_duration(timedelta(seconds=duration))) + + +@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)) diff --git a/src/uiprotect/data/devices.py b/src/uiprotect/data/devices.py index 62924f8a..3bf6d728 100644 --- a/src/uiprotect/data/devices.py +++ b/src/uiprotect/data/devices.py @@ -171,6 +171,14 @@ async def set_paired_camera(self, camera: Camera | None) -> None: self.camera_id = camera.id await self.save_device(data_before_changes, force_emit=True) + 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) + async def set_status_light(self, enabled: bool) -> None: """Sets the status indicator light for the light"""