Load script field default values into ha-service-control (#14949)

fixes undefined
This commit is contained in:
karwosts 2023-01-23 11:56:48 -08:00 committed by GitHub
parent dfee6c9b5b
commit 50a4c0f7ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {