From 141107f1f3178df8b8bad0225057a9bef5d4be7d Mon Sep 17 00:00:00 2001 From: Matthias Alphart Date: Mon, 22 Apr 2024 09:48:50 +0200 Subject: [PATCH] Apply initial values to forms of device trigger extra fields (#20555) * Apply default values of device trigger extra fields * use computeInitialHaFormData --- .../automation/trigger/types/ha-automation-trigger-device.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts index 1b94ff6138b2..fdd239e0115c 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts @@ -6,6 +6,7 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/device/ha-device-picker"; import "../../../../../components/device/ha-device-trigger-picker"; import "../../../../../components/ha-form/ha-form"; +import { computeInitialHaFormData } from "../../../../../components/ha-form/compute-initial-ha-form-data"; import { fullEntitiesContext } from "../../../../../data/context"; import { deviceAutomationsEqual, @@ -44,7 +45,9 @@ export class HaDeviceTrigger extends LitElement { private _extraFieldsData = memoizeOne( (trigger: DeviceTrigger, capabilities: DeviceCapabilities) => { - const extraFieldsData: Record = {}; + const extraFieldsData = computeInitialHaFormData( + capabilities.extra_fields + ); capabilities.extra_fields.forEach((item) => { if (trigger[item.name] !== undefined) { extraFieldsData![item.name] = trigger[item.name];