Skip to content

Commit

Permalink
Use "limit" instead of "mode" for Numeric state trigger and condition (
Browse files Browse the repository at this point in the history
  • Loading branch information
NoRi2909 authored Dec 22, 2024
1 parent 5cd6f22 commit 8b63824
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
);
Expand Down Expand Up @@ -158,7 +158,7 @@ export default class HaNumericStateCondition extends LitElement {
},
},
{
name: "mode_above",
name: "lower_limit",
type: "select",
required: true,
options: [
Expand Down Expand Up @@ -199,7 +199,7 @@ export default class HaNumericStateCondition extends LitElement {
},
] as const)),
{
name: "mode_below",
name: "upper_limit",
type: "select",
required: true,
options: [
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export class HaNumericStateTrigger extends LitElement {
},
},
{
name: "mode_above",
name: "lower_limit",
type: "select",
required: true,
options: [
Expand Down Expand Up @@ -176,7 +176,7 @@ export class HaNumericStateTrigger extends LitElement {
},
] as const)),
{
name: "mode_below",
name: "upper_limit",
type: "select",
required: true,
options: [
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3177,8 +3177,8 @@
"label": "Numeric state",
"above": "Above",
"below": "Below",
"mode_above": "Above mode",
"mode_below": "Below mode",
"lower_limit": "Lower limit",
"upper_limit": "Upper limit",
"value_template": "Value template",
"type_value": "Fixed number",
"type_input": "Numeric value of another entity",
Expand Down Expand Up @@ -3380,8 +3380,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.",
Expand Down

0 comments on commit 8b63824

Please sign in to comment.