Skip to content

Commit 205bf68

Browse files
committed
Fix hardcoded temperature related terms
1 parent d73b0d3 commit 205bf68

12 files changed

Lines changed: 125 additions & 56 deletions

source/_conditions/temperature.is_value.markdown

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@ When you target more than one entity, the condition's **Condition passes if** op
1919
areas="bedroom or living room"
2020
reading="temperature"
2121
value_long="a fixed temperature directly, for example `20` for 20°C"
22-
has_unit="true" %}
22+
has_unit="true"
23+
unit_label="temperature unit"
24+
unit_options="°C or °F" %}
2325

2426
### Options in the UI
2527

2628
{% include conditions/threshold_value_options_ui.md
2729
reading="temperature"
2830
value_short="a fixed temperature value"
29-
has_unit="true" %}
31+
has_unit="true"
32+
unit_label="temperature unit"
33+
unit_options_code="`°C` or `°F`"
34+
unit_default="°C" %}
3035

3136
{% include conditions/yaml_header.md %}
3237

@@ -92,6 +97,9 @@ This passes when the living room temperature sensor reads between 20 and 22°C.
9297
{% include conditions/threshold_value_options_yaml.md
9398
reading="temperature"
9499
has_unit="true"
100+
unit_default="°C"
101+
unit_example_entity="input_number.comfort_temperature_min"
102+
unit_example_value="22"
95103
threshold_required="true" %}
96104

97105
{% include conditions/targets.md %}

source/_includes/conditions/threshold_value_options_ui.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,22 @@ Reusable "Options in the UI" block for entity conditions that test a reading
33
against the threshold-mapping schema.
44

55
Parameters:
6-
reading quantity noun, e.g. "humidity"
7-
value_short Number-entry phrasing, e.g. "a fixed percentage (0–100)"
8-
has_unit set (to anything) to add a "Unit" row for the temperature unit
6+
reading quantity noun, e.g. "humidity"
7+
value_short Number-entry phrasing, e.g. "a fixed percentage (0–100)"
8+
has_unit set (to anything) to add a "Unit" row (requires unit_label,
9+
unit_options_code, unit_default)
10+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
11+
unit_options_code inline-code list of allowed units, e.g. "`°C` or `°F`"
12+
unit_default default unit, e.g. "°C"
913
{% endcomment %}
1014
{% options_ui %}
1115
Threshold type:
1216
description: |
1317
The {{ include.reading }} level the entity has to meet for the condition to pass. **Above** and **Below** are exclusive: a reading equal to the threshold does not pass. **In range** is exclusive at both bounds. **Outside range** is inclusive: a reading equal to either bound passes. Choose **Number** to enter {{ include.value_short }}, or **Entity** to use a sensor or number helper as a dynamic threshold.
1418
{% if include.has_unit %}
1519
Unit:
16-
description: The temperature unit to use for threshold comparison. Accepts `°C` or `°F`. Required when using numerical thresholds (not required when using entity references).
17-
default: °C
20+
description: The {{ include.unit_label }} to use for threshold comparison. Accepts {{ include.unit_options_code }}. Required when using numerical thresholds (not required when using entity references).
21+
default: {{ include.unit_default }}
1822
{% endif %}
1923
Condition passes if:
2024
description: |

source/_includes/conditions/threshold_value_options_yaml.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
Reusable "Options in YAML" block for entity conditions that test a reading
33
against the threshold-mapping schema. The `behavior` description is shared
44
across the family. Unitless members (humidity, brightness, counter) get the
5-
per-type "Provide value..." guidance; members with a temperature unit get the
6-
unit_of_measurement guidance and a unit-style example instead.
5+
per-type "Provide value..." guidance; members with a unit (temperature, energy,
6+
etc.) get the unit_of_measurement guidance and a unit-style example instead.
77

88
Parameters:
9-
reading quantity noun, e.g. "humidity"
9+
reading quantity noun, e.g. "humidity", "temperature"
1010
range_note parenthetical range for above/below (unitless), e.g. "0–100"
1111
number_final closing number guidance (unitless), e.g. "a percentage value (0–100)"
12-
has_unit set (to anything) for temperature unit_of_measurement guidance + example
12+
has_unit set (to anything) for unit_of_measurement guidance + example
13+
(requires unit_default, unit_example_entity, unit_example_value)
14+
unit_default default unit used in the example, e.g. "°C"
15+
unit_example_entity entity reference used in the example, e.g.
16+
"input_number.comfort_temperature_min"
17+
unit_example_value literal number used in the example, e.g. "22"
1318
threshold_required "true" or "false" for the threshold field (default "false")
1419
{% endcomment %}
1520
{% options_yaml %}
@@ -29,13 +34,13 @@ threshold:
2934
threshold:
3035
type: between
3136
value_min:
32-
entity: input_number.comfort_temperature_min
37+
entity: {{ include.unit_example_entity }}
3338
value_max:
34-
number: 22
35-
unit_of_measurement: °C
39+
number: {{ include.unit_example_value }}
40+
unit_of_measurement: {{ include.unit_default }}
3641
```
3742

38-
When using an `entity`, its current reading is used as the threshold at the moment the condition is evaluated, which lets you compare two temperature readings dynamically.
43+
When using an `entity`, its current reading is used as the threshold at the moment the condition is evaluated, which lets you compare two {{ include.reading }} readings dynamically.
3944
{% else %}
4045

4146
For the `number` key, use {{ include.number_final }}. For the `entity` key, use an `input_number`, `number`, or `sensor` entity.

source/_includes/conditions/threshold_value_steps.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ range). Used by humidity.is_value; reusable by climate.target_humidity,
55
light.is_brightness, counter.is_value, and similar.
66

77
Parameters:
8-
title UI display name, e.g. "Relative humidity"
9-
sensor sensor noun, e.g. "humidity sensor"
10-
areas example areas, e.g. "bedroom or bathroom"
11-
reading quantity noun, e.g. "humidity"
12-
value_long Number-entry phrasing, e.g. "a fixed percentage directly, for example `65` for 65%"
13-
has_unit set (to anything) to add a "Unit" step for the temperature unit
8+
title UI display name, e.g. "Relative humidity"
9+
sensor sensor noun, e.g. "humidity sensor"
10+
areas example areas, e.g. "bedroom or bathroom"
11+
reading quantity noun, e.g. "humidity"
12+
value_long Number-entry phrasing, e.g. "a fixed percentage directly, for example `65` for 65%"
13+
has_unit set (to anything) to add a "Unit" step (requires unit_label, unit_options)
14+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
15+
unit_options bare list of allowed units for prose, e.g. "°C or °F"
1416
{% endcomment %}
1517
To use **{{ include.title }}** in an automation:
1618

@@ -29,7 +31,7 @@ To use **{{ include.title }}** in an automation:
2931
- For **In range** or **Outside range**, you need two entities: one for the lower bound and one for the upper bound (for example, two separate number helpers).
3032
- If you don't have a number helper, you can create one by selecting **Create a new number helper**.
3133
{%- if include.has_unit %}
32-
7. Under **Unit**, select the temperature unit (°C or °F) to use for the threshold comparison.
34+
7. Under **Unit**, select the {{ include.unit_label }} ({{ include.unit_options }}) to use for the threshold comparison.
3335
{%- endif %}
3436
8. Under **Condition passes if** (see [Behavior](#behavior-with-multiple-targets)), pick **Any** or **All**.
3537
9. Select **Save**.

source/_includes/triggers/threshold_changed_options_ui.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ Reusable "Options in the UI" block for "changed" entity triggers that use the
33
threshold-mapping schema.
44

55
Parameters:
6-
unit_phrase_ui value-entry phrasing, e.g. "a fixed percentage (0–100%)"
7-
has_unit set (to anything) to add a "Unit" row for the temperature unit
6+
unit_phrase_ui value-entry phrasing, e.g. "a fixed percentage (0–100%)"
7+
has_unit set (to anything) to add a "Unit" row (requires unit_label,
8+
unit_options_code, unit_default)
9+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
10+
unit_options_code inline-code list of allowed units, e.g. "`°C` or `°F`"
11+
unit_default default unit, e.g. "°C"
812
{% endcomment %}
913
{% options_ui %}
1014
Threshold type:
@@ -19,6 +23,6 @@ Threshold type:
1923
For each mode you can enter {{ include.unit_phrase_ui }} or reference a sensor entity or a [number helper](/integrations/input_number/) entity.
2024
{% if include.has_unit %}
2125
Unit:
22-
description: The temperature unit to use for threshold comparison. Accepts `°C` or `°F`. Required when using numerical thresholds (not required when using entity references). Default is `°C`.
26+
description: The {{ include.unit_label }} to use for threshold comparison. Accepts {{ include.unit_options_code }}. Required when using numerical thresholds (not required when using entity references). Default is `{{ include.unit_default }}`.
2327
{% endif %}
2428
{% endoptions_ui %}

source/_includes/triggers/threshold_changed_options_yaml.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ Reusable "Options in YAML" block for "changed" entity triggers that use the
33
threshold-mapping schema.
44

55
Parameters:
6-
reading quantity noun, e.g. "humidity"
7-
unit_phrase_yaml literal-value phrasing, e.g. "literal percentage 0–100"
8-
has_unit set (to anything) to add the temperature unit_of_measurement note
6+
reading quantity noun, e.g. "humidity", "temperature"
7+
unit_phrase_yaml literal-value phrasing, e.g. "literal percentage 0–100"
8+
has_unit set (to anything) to add unit_of_measurement guidance + example
9+
(requires unit_label, unit_options_code, unit_default,
10+
unit_example_entity, unit_example_value)
11+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
12+
unit_options_code inline-code list of allowed units, e.g. "`°C` or `°F`"
13+
unit_default default unit used in the example, e.g. "°C"
14+
unit_example_entity entity reference used in the example, e.g.
15+
"input_number.comfort_temperature_min"
16+
unit_example_value literal number used in the example, e.g. "24"
917
{% endcomment %}
1018
{% options_yaml %}
1119
threshold:
@@ -19,21 +27,21 @@ threshold:
1927
- `type: outside` (inclusive): Defines an outside-range. Fires when the reading is at or below `value_min`, or at or above `value_max`. Readings equal to either bound fire the trigger. Provide `value_min` and `value_max`, each with a `number` key (for a {{ include.unit_phrase_yaml }}) or an `entity` key (for an `input_number`, `number`, or `sensor` entity).
2028
{% if include.has_unit %}
2129

22-
When using the `number` key, you must also include `unit_of_measurement` to specify the temperature unit (`°C` or `°F`). When using the `entity` key, the unit is taken from the entity itself, or assumed to be the system temperature unit if the entity has no unit.
30+
When using the `number` key, you must also include `unit_of_measurement` to specify the {{ include.unit_label }} ({{ include.unit_options_code }}). When using the `entity` key, the unit is taken from the entity itself, or assumed to be the system {{ include.unit_label }} if the entity has no unit.
2331

2432
For example:
2533

2634
```yaml
2735
threshold:
2836
type: outside
2937
value_min:
30-
entity: input_number.comfort_temperature_min
38+
entity: {{ include.unit_example_entity }}
3139
value_max:
32-
number: 24
33-
unit_of_measurement: °C
40+
number: {{ include.unit_example_value }}
41+
unit_of_measurement: {{ include.unit_default }}
3442
```
3543

36-
A `sensor` or `number` entity's current value is used as the threshold, which lets you compare two temperature readings dynamically.
44+
A `sensor` or `number` entity's current value is used as the threshold, which lets you compare two {{ include.reading }} readings dynamically.
3745
{% endif %}
3846
required: true
3947
type: map

source/_includes/triggers/threshold_changed_steps.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Parameters:
99
sensor sensor noun, e.g. "humidity sensor"
1010
areas example areas, e.g. "bathroom or bedroom"
1111
unit_phrase_ui value-entry phrasing, e.g. "a fixed percentage (0–100%)"
12-
has_unit set (to anything) to add a "Unit" step for the temperature unit
12+
has_unit set (to anything) to add a "Unit" step (requires unit_label, unit_options)
13+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
14+
unit_options bare list of allowed units for prose, e.g. "°C or °F"
1315
{% endcomment %}
1416
To use **{{ include.title }}** in an automation:
1517

@@ -26,6 +28,6 @@ To use **{{ include.title }}** in an automation:
2628
- For each option, you can enter {{ include.unit_phrase_ui }}, pick a sensor entity or a [number helper](/integrations/input_number/) entity as the threshold.
2729
- If you don't have a number helper, you can create one by selecting **Create a new number helper**.
2830
{%- if include.has_unit %}
29-
7. Under **Unit**, select the temperature unit (°C or °F) to use for the threshold comparison.
31+
7. Under **Unit**, select the {{ include.unit_label }} ({{ include.unit_options }}) to use for the threshold comparison.
3032
{%- endif %}
3133
8. Select **Save**.

source/_includes/triggers/threshold_crossed_options_ui.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@ Reusable "Options in the UI" block for "crossed threshold" entity triggers that
33
use the threshold-mapping schema.
44

55
Parameters:
6-
unit_phrase_ui value-entry phrasing, e.g. "a fixed percentage (0–100%)"
7-
has_unit set (to anything) to add a "Unit" row for the temperature unit
6+
unit_phrase_ui value-entry phrasing, e.g. "a fixed percentage (0–100%)"
7+
has_unit set (to anything) to add a "Unit" row (requires unit_label,
8+
unit_options_code, unit_default)
9+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
10+
unit_options_code inline-code list of allowed units, e.g. "`°C` or `°F`"
11+
unit_default default unit, e.g. "°C"
812
{% endcomment %}
913
{% options_ui %}
1014
Threshold type:
@@ -19,7 +23,7 @@ Threshold type:
1923
For each mode you can enter {{ include.unit_phrase_ui }} or reference a sensor entity or a [number helper](/integrations/input_number/) entity.
2024
{% if include.has_unit %}
2125
Unit:
22-
description: The temperature unit to use for threshold comparison. Accepts `°C` or `°F`. Required when using numerical thresholds (not required when using entity references). Default is `°C`.
26+
description: The {{ include.unit_label }} to use for threshold comparison. Accepts {{ include.unit_options_code }}. Required when using numerical thresholds (not required when using entity references). Default is `{{ include.unit_default }}`.
2327
{% endif %}
2428
Trigger when:
2529
description: |

source/_includes/triggers/threshold_crossed_options_yaml.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22
Reusable "Options in YAML" block for "crossed threshold" entity triggers that
33
use the threshold-mapping schema. The `behavior` and `for` field descriptions
44
are identical across the whole family. Suited to unitless members (humidity,
5-
brightness, battery); members with a temperature unit need an added
6-
unit_of_measurement note in the threshold description.
5+
brightness, battery); members with a unit (temperature, energy, etc.) get an
6+
added unit_of_measurement note in the threshold description.
77

88
Parameters:
9-
unit_phrase_yaml literal-value phrasing, e.g. "literal percentage 0–100"
10-
example_value value used in the inline example (unitless members), e.g. "70"
11-
has_unit set (to anything) for the temperature unit note + a unit-style example
9+
reading quantity noun, e.g. "humidity", "temperature"
10+
unit_phrase_yaml literal-value phrasing, e.g. "literal percentage 0–100"
11+
example_value value used in the inline example (unitless members), e.g. "70"
12+
has_unit set (to anything) for unit_of_measurement note + a unit-style
13+
example (requires unit_label, unit_options_code, unit_default,
14+
unit_example_entity, unit_example_value)
15+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
16+
unit_options_code inline-code list of allowed units, e.g. "`°C` or `°F`"
17+
unit_default default unit used in the example, e.g. "°C"
18+
unit_example_entity entity reference used in the example, e.g.
19+
"input_number.max_comfort_temperature"
20+
unit_example_value literal number used in the example, e.g. "18"
1221
{% endcomment %}
1322
{% options_yaml %}
1423
threshold:
@@ -22,21 +31,21 @@ threshold:
2231

2332
{% if include.has_unit %}
2433

25-
When using the `number` key, you must also include `unit_of_measurement` to specify the temperature unit (`°C` or `°F`). When using the `entity` key, the unit is taken from the entity itself, or assumed to be the system temperature unit if the entity has no unit.
34+
When using the `number` key, you must also include `unit_of_measurement` to specify the {{ include.unit_label }} ({{ include.unit_options_code }}). When using the `entity` key, the unit is taken from the entity itself, or assumed to be the system {{ include.unit_label }} if the entity has no unit.
2635

2736
For example:
2837

2938
```yaml
3039
threshold:
3140
type: between
3241
value_min:
33-
number: 18
34-
unit_of_measurement: °C
42+
number: {{ include.unit_example_value }}
43+
unit_of_measurement: {{ include.unit_default }}
3544
value_max:
36-
entity: input_number.max_comfort_temperature
45+
entity: {{ include.unit_example_entity }}
3746
```
3847

39-
A `sensor` or `number` entity's current value is used as the threshold, which lets you compare two temperature readings dynamically.
48+
A `sensor` or `number` entity's current value is used as the threshold, which lets you compare two {{ include.reading }} readings dynamically.
4049
{% else %}
4150

4251
For example:

source/_includes/triggers/threshold_crossed_steps.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Parameters:
99
sensor sensor noun, e.g. "humidity sensor"
1010
areas example areas, e.g. "bathroom or basement"
1111
unit_phrase_ui value-entry phrasing, e.g. "a fixed percentage (0–100%)"
12-
has_unit set (to anything) to add a "Unit" step for the temperature unit
12+
has_unit set (to anything) to add a "Unit" step (requires unit_label, unit_options)
13+
unit_label unit-kind label, e.g. "temperature unit", "energy unit"
14+
unit_options bare list of allowed units for prose, e.g. "°C or °F"
1315
{% endcomment %}
1416
To use **{{ include.title }}** in an automation:
1517

@@ -25,7 +27,7 @@ To use **{{ include.title }}** in an automation:
2527
- For each option, you can enter {{ include.unit_phrase_ui }}, pick a sensor entity or a [number helper](/integrations/input_number/) entity as the threshold.
2628
- If you don't have a number helper, you can create one by selecting **Create a new number helper**.
2729
{%- if include.has_unit %}
28-
7. Under **Unit**, select the temperature unit (°C or °F) to use for the threshold comparison.
30+
7. Under **Unit**, select the {{ include.unit_label }} ({{ include.unit_options }}) to use for the threshold comparison.
2931
{%- endif %}
3032
8. Under **Trigger when** (see [Behavior](#behavior-with-multiple-targets)), pick **Each**, **First**, or **All** to control how the trigger behaves when multiple entities are targeted.
3133
9. Under **For at least**, set how long the reading must stay past the threshold before the trigger fires. Leave it at zero to fire immediately.

0 commit comments

Comments
 (0)