From a703aa1dffed528cea9f606e09368c89aae7a53f Mon Sep 17 00:00:00 2001 From: Ty Parker Date: Sat, 4 Feb 2023 16:14:25 -0700 Subject: [PATCH] Add repeat options to tplink sequence effect service (#86040) Add repeat options to sequence effect service --- homeassistant/components/tplink/light.py | 6 +++++- homeassistant/components/tplink/services.yaml | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/tplink/light.py b/homeassistant/components/tplink/light.py index c8944b7add2..08e5507baf4 100644 --- a/homeassistant/components/tplink/light.py +++ b/homeassistant/components/tplink/light.py @@ -66,6 +66,9 @@ SEQUENCE_EFFECT_DICT: Final = { vol.Length(min=1, max=16), [vol.All(vol.Coerce(tuple), HSV_SEQUENCE)], ), + vol.Optional("repeat_times", default=0): vol.All( + vol.Coerce(int), vol.Range(min=0, max=10) + ), vol.Optional("spread", default=1): vol.All( vol.Coerce(int), vol.Range(min=1, max=16) ), @@ -397,6 +400,7 @@ class TPLinkSmartLightStrip(TPLinkSmartBulb): transition: int, segments: list[int], sequence: Sequence[tuple[int, int, int]], + repeat_times: int, spread: int, direction: int, ) -> None: @@ -405,7 +409,7 @@ class TPLinkSmartLightStrip(TPLinkSmartBulb): **_async_build_base_effect(brightness, duration, transition, segments), "type": "sequence", "sequence": sequence, - "repeat_times": 0, + "repeat_times": repeat_times, "spread": spread, "direction": direction, } diff --git a/homeassistant/components/tplink/services.yaml b/homeassistant/components/tplink/services.yaml index 9b98018e771..128c5c3a493 100644 --- a/homeassistant/components/tplink/services.yaml +++ b/homeassistant/components/tplink/services.yaml @@ -43,6 +43,16 @@ sequence_effect: step: 1 max: 5000 unit_of_measurement: "ms" + repeat_times: + description: Repetitions (0 for continuous) + example: 0 + default: 0 + required: false + selector: + number: + min: 0 + step: 1 + max: 10 transition: description: Transition example: 2000