From e0448be24d0022568eb9e960563935651a23c5f0 Mon Sep 17 00:00:00 2001 From: alvinchen1 <26409535+alvinchen1@users.noreply.github.com> Date: Sat, 13 Aug 2022 17:29:33 -0400 Subject: [PATCH] Add initial field to the helper input_number in UI (#13378) --- .../config/helpers/forms/ha-input_number-form.ts | 13 +++++++++++++ src/translations/en.json | 1 + 2 files changed, 14 insertions(+) diff --git a/src/panels/config/helpers/forms/ha-input_number-form.ts b/src/panels/config/helpers/forms/ha-input_number-form.ts index 759d96a507..9fa309e54a 100644 --- a/src/panels/config/helpers/forms/ha-input_number-form.ts +++ b/src/panels/config/helpers/forms/ha-input_number-form.ts @@ -26,6 +26,8 @@ class HaInputNumberForm extends LitElement { @state() private _min?: number; + @state() private _initial?: number; + @state() private _mode?: string; @state() private _step?: number; @@ -42,6 +44,7 @@ class HaInputNumberForm extends LitElement { this._min = item.min ?? 0; this._mode = item.mode || "slider"; this._step = item.step ?? 1; + this._initial = item.initial ?? 0; this._unit_of_measurement = item.unit_of_measurement; } else { this._item = { @@ -54,6 +57,7 @@ class HaInputNumberForm extends LitElement { this._min = 0; this._mode = "slider"; this._step = 1; + this._initial = 0; } } @@ -112,6 +116,15 @@ class HaInputNumberForm extends LitElement { "ui.dialogs.helper_settings.input_number.max" )} > + ${this.hass.userData?.showAdvanced ? html`
diff --git a/src/translations/en.json b/src/translations/en.json index 9e5b4d5a4e..cf62a4996c 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -916,6 +916,7 @@ "pattern": "Regex pattern for client-side validation" }, "input_number": { + "initial": "Initial value", "min": "Minimum value", "max": "Maximum value", "mode": "Display mode",