Ensure explicit `false` values from customize form get stored (#10381)

This commit is contained in:
Philip Allgaier 2021-10-25 20:33:26 +02:00 committed by GitHub
parent a12c2eea5d
commit b9bde1960b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -25,7 +25,7 @@ class HaConfigCustomize extends LitElement {
protected render(): TemplateResult {
return html`
<hass-tabs-subpage
.hass=${this.hass}
.hass=${this.hass}
.narrow=${this.narrow}
.route=${this.route}
back-path="/config"

View File

@ -180,10 +180,16 @@ export class HaFormCustomize extends LocalizeMixin(PolymerElement) {
this.newAttributes
);
attrs.forEach((attr) => {
if (attr.closed || attr.secondary || !attr.attribute || !attr.value)
if (
attr.closed ||
attr.secondary ||
!attr.attribute ||
attr.value === null ||
attr.value === undefined
)
return;
const value = attr.type === "json" ? JSON.parse(attr.value) : attr.value;
if (!value) return;
if (value === null || value === undefined) return;
data[attr.attribute] = value;
});