Lovelace alarm panel respects the code_format attribute on the alarm entity (#2379)

This commit is contained in:
Emil Stjerneman 2019-01-03 23:09:07 +01:00 committed by Paulus Schoutsen
parent 38a2627227
commit adf0c6d891

View File

@ -138,11 +138,21 @@ class HuiAlarmPanelCard extends hassLocalizeLitMixin(LitElement)
}) })
} }
</div> </div>
${
!stateObj.attributes.code_format
? html``
: html`
<paper-input <paper-input
label="Alarm Code" label="Alarm Code"
type="password" type="password"
.value="${this._code}" .value="${this._code}"
></paper-input> ></paper-input>
`
}
${
stateObj.attributes.code_format !== "Number"
? html``
: html`
<div id="keypad"> <div id="keypad">
${ ${
BUTTONS.map((value) => { BUTTONS.map((value) => {
@ -157,13 +167,17 @@ class HuiAlarmPanelCard extends hassLocalizeLitMixin(LitElement)
.value="${value}" .value="${value}"
@click="${this._handlePadClick}" @click="${this._handlePadClick}"
>${ >${
value === "clear" ? this._label("clear_code") : value value === "clear"
? this._label("clear_code")
: value
}</paper-button }</paper-button
> >
`; `;
}) })
} }
</div> </div>
`
}
</ha-card> </ha-card>
`; `;
} }