mirror of
https://github.com/esphome/esphome-docs.git
synced 2025-02-28 03:41:57 +01:00
Document how to return 'no value' from a lambda filter (#2761)
* Document how to filter out values in a lambda filter * Fix the code example
This commit is contained in:
parent
58454811ae
commit
437a19218f
@ -493,6 +493,16 @@ the result of the lambda is used as the output (use ``return``).
|
||||
Make sure to add ``.0`` to all values in the lambda, otherwise divisions of integers will
|
||||
result in integers (not floating point values).
|
||||
|
||||
To prevent values from being published, return ``{}``:
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
filters:
|
||||
- lambda: !lambda |-
|
||||
if (x < 10) return {};
|
||||
return x-10;
|
||||
|
||||
|
||||
Example: Converting Celsius to Fahrenheit
|
||||
-----------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user