From ed3da1358b3ade6bb8782ad8e863aa11a89f5e83 Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Fri, 20 Dec 2024 15:29:05 +0100 Subject: [PATCH 1/4] Use "limit" instead of "mode" for Numeric state trigger and condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the labels for "Above" and "Below" sections of the Numeric state trigger and condition are called "Above mode" and "Below mode". As modes are always exclusive – you can't have two modes enabled at the same time – this labeling is misleading as you can specify both a lower and an upper limit. By changing them to "Lower limit" and "Upper limit" it becomes clear that the user can specify either or both at the same time. As the field labels remain "Above" and "Below" and the summary also explains it that way it remains clear the limits are exclusive. --- src/translations/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/translations/en.json b/src/translations/en.json index 3c837c68ca29..ac229b4d711e 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3166,8 +3166,8 @@ "label": "Numeric state", "above": "Above", "below": "Below", - "mode_above": "Above mode", - "mode_below": "Below mode", + "mode_above": "Lower limit", + "mode_below": "Upper limit", "value_template": "Value template", "type_value": "Fixed number", "type_input": "Numeric value of another entity", From 9d2cbc8a3d43c5ab28b56c73c57b22cbda9cf611 Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Sun, 22 Dec 2024 16:08:28 +0100 Subject: [PATCH 2/4] Change key names to lower_limit and upper_limit in strings.json --- src/translations/en.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/translations/en.json b/src/translations/en.json index ac229b4d711e..f210b162cc82 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -3166,8 +3166,8 @@ "label": "Numeric state", "above": "Above", "below": "Below", - "mode_above": "Lower limit", - "mode_below": "Upper limit", + "lower_limit": "Lower limit", + "upper_limit": "Upper limit", "value_template": "Value template", "type_value": "Fixed number", "type_input": "Numeric value of another entity", @@ -3369,8 +3369,8 @@ "label": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::label%]", "above": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::above%]", "below": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::below%]", - "mode_above": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::mode_above%]", - "mode_below": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::mode_below%]", + "lower_limit": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::lower_limit%]", + "upper_limit": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::upper_limit%]", "value_template": "[%key:ui::panel::config::automation::editor::triggers::type::numeric_state::value_template%]", "description": { "picker": "If the numeric value of an entity''s state (or attribute''s value) is above or below a given threshold.", From bbd5dcf9ec628a390e00a004e818a2eaf71e4e6a Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Sun, 22 Dec 2024 16:47:09 +0100 Subject: [PATCH 3/4] Update ha-automation-trigger-numeric_state.ts --- .../types/ha-automation-trigger-numeric_state.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts index 6613180591d4..db78f6fcd440 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-numeric_state.ts @@ -135,7 +135,7 @@ export class HaNumericStateTrigger extends LitElement { }, }, { - name: "mode_above", + name: "lower_limit", type: "select", required: true, options: [ @@ -176,7 +176,7 @@ export class HaNumericStateTrigger extends LitElement { }, ] as const)), { - name: "mode_below", + name: "upper_limit", type: "select", required: true, options: [ @@ -264,8 +264,8 @@ export class HaNumericStateTrigger extends LitElement { inputBelowIsEntity: boolean, trigger: NumericStateTrigger ) => ({ - mode_above: inputAboveIsEntity ? "input" : "value", - mode_below: inputBelowIsEntity ? "input" : "value", + lower_limit: inputAboveIsEntity ? "input" : "value", + upper_limit: inputBelowIsEntity ? "input" : "value", ...trigger, entity_id: ensureArray(trigger.entity_id), for: createDurationData(trigger.for), @@ -302,11 +302,11 @@ export class HaNumericStateTrigger extends LitElement { ev.stopPropagation(); const newTrigger = { ...ev.detail.value }; - this._inputAboveIsEntity = newTrigger.mode_above === "input"; - this._inputBelowIsEntity = newTrigger.mode_below === "input"; + this._inputAboveIsEntity = newTrigger.lower_limit === "input"; + this._inputBelowIsEntity = newTrigger.upper_limit === "input"; - delete newTrigger.mode_above; - delete newTrigger.mode_below; + delete newTrigger.lower_limit; + delete newTrigger.upper_limit; if (newTrigger.value_template === "") { delete newTrigger.value_template; From c0dde90d60e60b62c2fea989d43b581ec101f78f Mon Sep 17 00:00:00 2001 From: Norbert Rittel Date: Sun, 22 Dec 2024 16:48:10 +0100 Subject: [PATCH 4/4] Update ha-automation-condition-numeric_state.ts --- .../ha-automation-condition-numeric_state.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts b/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts index e55f015a4564..04e2de7cd262 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-numeric_state.ts @@ -67,8 +67,8 @@ export default class HaNumericStateCondition extends LitElement { inputBelowIsEntity: boolean, condition: NumericStateCondition ) => ({ - mode_above: inputAboveIsEntity ? "input" : "value", - mode_below: inputBelowIsEntity ? "input" : "value", + lower_limit: inputAboveIsEntity ? "input" : "value", + upper_limit: inputBelowIsEntity ? "input" : "value", ...condition, }) ); @@ -158,7 +158,7 @@ export default class HaNumericStateCondition extends LitElement { }, }, { - name: "mode_above", + name: "lower_limit", type: "select", required: true, options: [ @@ -199,7 +199,7 @@ export default class HaNumericStateCondition extends LitElement { }, ] as const)), { - name: "mode_below", + name: "upper_limit", type: "select", required: true, options: [ @@ -290,11 +290,11 @@ export default class HaNumericStateCondition extends LitElement { ev.stopPropagation(); const newCondition = { ...ev.detail.value }; - this._inputAboveIsEntity = newCondition.mode_above === "input"; - this._inputBelowIsEntity = newCondition.mode_below === "input"; + this._inputAboveIsEntity = newCondition.lower_limit === "input"; + this._inputBelowIsEntity = newCondition.upper_limit === "input"; - delete newCondition.mode_above; - delete newCondition.mode_below; + delete newCondition.lower_limit; + delete newCondition.upper_limit; if (newCondition.value_template === "") { delete newCondition.value_template;