From 50a4c0f7ce2bd5d2bc250bf88115a29c33355b74 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Mon, 23 Jan 2023 11:56:48 -0800 Subject: [PATCH] Load script field default values into ha-service-control (#14949) fixes undefined --- src/components/ha-service-control.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index 5a3a223618..de71b6adac 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -151,6 +151,14 @@ export class HaServiceControl extends LitElement { updatedDefaultValue = true; this._value!.data![field.key] = false; } + if ( + field.selector && + field.default !== undefined && + this._value!.data![field.key] === undefined + ) { + updatedDefaultValue = true; + this._value!.data![field.key] = field.default; + } }); } if (updatedDefaultValue) {