Skip to content

Commit

Permalink
Add stop_dimming method
Browse files Browse the repository at this point in the history
To stop a dimming transition the DimmingDeltaFeaturePut can be used to
set a stop action. This can be useful if someone wants to dim a light to
the max/min value within a dedicated transition time but stop when for
example a btn was released.
  • Loading branch information
olsen-sorensen committed Oct 3, 2024
1 parent 3821a01 commit f7b4892
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions aiohue/v2/controllers/lights.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
ColorFeaturePut,
ColorPoint,
ColorTemperatureFeaturePut,
DeltaAction,
DimmingFeaturePut,
DimmingDeltaFeaturePut,
DynamicsFeaturePut,
EffectsFeaturePut,
EffectStatus,
Expand Down Expand Up @@ -100,3 +102,11 @@ async def set_state(
elif effect is not None:
update_obj.effects = EffectsFeaturePut(effect=effect)
await self.update(id, update_obj)

async def stop_dimming(
self, id: str
) -> None:
"""Stop dimming action."""
update_obj = LightPut()
update_obj.dimming = DimmingDeltaFeaturePut(action=DeltaAction.STOP)
await self.update(id, update_obj)

0 comments on commit f7b4892

Please sign in to comment.