Skip to content

Commit db5af69

Browse files
[output] Add set_min_power & set_max_power actions for FloatOutput (#4957)
1 parent 546a305 commit db5af69

File tree

1 file changed

+73
-2
lines changed

1 file changed

+73
-2
lines changed

components/output/index.rst

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ Float outputs only:
4949
- **zero_means_zero** (*Optional*, boolean): Sets the output to use actual 0 instead of ``min_power``.
5050
Defaults to ``false``.
5151

52+
.. note::
53+
54+
The ``min_power`` and ``max_power`` values are automatically clamped to ensure ``0.0 ≤ min_power ≤ max_power ≤ 1.0``.
55+
This prevents invalid configurations and ensures stable output behavior.
5256

5357
.. _output-turn_on_action:
5458

@@ -97,8 +101,13 @@ This action turns the output with the given ID off when executed.
97101
``output.set_level`` Action
98102
***************************
99103

100-
This action sets the float output to the given level when executed. Note: This only
101-
works with floating point outputs like :doc:`/components/output/esp8266_pwm`, :doc:`/components/output/ledc`, :doc:`/components/output/sigma_delta_output`, :doc:`/components/output/slow_pwm`.
104+
This action sets the float output to the given level when executed.
105+
106+
.. note::
107+
108+
This only works with floating point outputs like :doc:`/components/output/ac_dimmer`,
109+
:doc:`/components/output/esp8266_pwm`, :doc:`/components/output/ledc`,
110+
:doc:`/components/output/sigma_delta_output`, :doc:`/components/output/slow_pwm`.
102111

103112
.. code-block:: yaml
104113
@@ -117,6 +126,68 @@ works with floating point outputs like :doc:`/components/output/esp8266_pwm`, :d
117126
// range is 0.0 (off) to 1.0 (on)
118127
id(light_1).set_level(0.5);
119128
129+
.. _output-set_min_power_action:
130+
131+
``output.set_min_power`` Action
132+
*******************************
133+
134+
This action sets the minimum output power level for the specified float output platform.
135+
It allows you to dynamically adjust the ``min_power`` configuration variable at runtime.
136+
137+
.. note::
138+
139+
This only works with floating point outputs like :doc:`/components/output/ac_dimmer`,
140+
:doc:`/components/output/esp8266_pwm`, :doc:`/components/output/ledc`,
141+
:doc:`/components/output/sigma_delta_output`, :doc:`/components/output/slow_pwm`.
142+
143+
.. code-block:: yaml
144+
145+
on_...:
146+
then:
147+
- output.set_min_power:
148+
id: light_1
149+
min_power: 20%
150+
151+
.. note::
152+
153+
This action can also be expressed in :ref:`lambdas <config-lambda>`:
154+
155+
.. code-block:: cpp
156+
157+
// range is 0.0 (off) to 1.0 (on)
158+
id(light_1).set_min_power(0.2);
159+
160+
.. _output-set_max_power_action:
161+
162+
``output.set_max_power`` Action
163+
*******************************
164+
165+
This action sets the maximum output power level for the specified float output platform.
166+
It allows you to dynamically adjust the ``max_power`` configuration variable at runtime.
167+
168+
.. note::
169+
170+
This only works with floating point outputs like :doc:`/components/output/ac_dimmer`,
171+
:doc:`/components/output/esp8266_pwm`, :doc:`/components/output/ledc`,
172+
:doc:`/components/output/sigma_delta_output`, :doc:`/components/output/slow_pwm`.
173+
174+
.. code-block:: yaml
175+
176+
on_...:
177+
then:
178+
- output.set_max_power:
179+
id: light_1
180+
max_power: 80%
181+
182+
.. note::
183+
184+
This action can also be expressed in :ref:`lambdas <config-lambda>`:
185+
186+
.. code-block:: cpp
187+
188+
// range is 0.0 (off) to 1.0 (on)
189+
id(light_1).set_max_power(0.8);
190+
120191
Full Output Index
121192
-----------------
122193

0 commit comments

Comments
 (0)