Skip to content

Commit 15b189b

Browse files
EPMattNicolai-
andauthored
light.yaml use min_brightness and max_brightness as conditions instead of "while true" loops (#715)
* light.yaml use min_brightness and max_brightness as conditions instead of "while true" loops * light.yaml fixed version * docs(light): bump version to 2025.03.18 * docs(light): update changelog * chore: fix formatting --------- Co-authored-by: Nicolai- <[email protected]>
1 parent 67d9f57 commit 15b189b

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

blueprints/hooks/light/light.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ blueprint:
1414
1515
## More Info
1616
17-
ℹ️ Version 2025.02.16
17+
ℹ️ Version 2025.03.18
1818
📝 [Changelog](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/light/#changelog)
1919
📕 Full documentation regarding this blueprint is available [here](https://epmatt.github.io/awesome-ha-blueprints/docs/blueprints/hooks/light).
2020
@@ -456,9 +456,9 @@ actions:
456456
entity_id: !input light
457457
- delay:
458458
milliseconds: !input light_transition
459-
# else move on to the loop for increasing the light brightness
459+
# else move on to the loop for increasing the light brightness until the maximum brightness is reached
460460
- repeat:
461-
while: '{{ true }}'
461+
while: '{{ state_attr(light,"brightness") < max_brightness }}'
462462
sequence:
463463
- action: light.turn_on
464464
data:
@@ -498,8 +498,8 @@ actions:
498498
milliseconds: 250
499499
default:
500500
- repeat:
501-
# continue lowering brightness until the light turns off
502-
while: '{{ states(light) != "off" }}'
501+
# continue lowering brightness until the light hits the minimum brightness
502+
while: '{{ state_attr(light,"brightness") > min_brightness }}'
503503
sequence:
504504
# lower the light's brightness. since smooth power off is disabled, never let the brightness move below the user-provided minimum
505505
- action: light.turn_on

website/docs/blueprints/hooks/light.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,5 @@ If you want to link multiple lights to the same controller you can either use [L
183183

184184
If you had configured the `controller_model` input to `Xiaomi WXKG11LM Aqara Wireless Switch Mini`, please change it to `Aqara WXKG11LM Wireless Mini Switch`.
185185
The change has been implemented to match the controller with the correct manufacturer name (Aqara).
186+
187+
- **2025-03-18**: use min_brightness and max_brightness as conditions instead of "while true" loops [@Nicolai-](https://github.com/Nicolai-).

0 commit comments

Comments
 (0)