mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Alarm codes (#3566)
* Handle alarm codes from keyboard input Closes https://github.com/home-assistant/home-assistant-polymer/issues/2602 * remove friendly_name changes * remove unnecessary TS check
This commit is contained in:
parent
1bc2e6fc17
commit
5bfdc98217
@ -21,6 +21,7 @@ import {
|
||||
FORMAT_NUMBER,
|
||||
} from "../../../data/alarm_control_panel";
|
||||
import { AlarmPanelCardConfig } from "./types";
|
||||
import { PaperInputElement } from "@polymer/paper-input/paper-input";
|
||||
|
||||
const ICONS = {
|
||||
armed_away: "hass:shield-lock",
|
||||
@ -144,6 +145,7 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
|
||||
? html``
|
||||
: html`
|
||||
<paper-input
|
||||
id="alarmCode"
|
||||
label="Alarm Code"
|
||||
type="password"
|
||||
.value="${this._code}"
|
||||
@ -198,11 +200,17 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
|
||||
private _handleActionClick(e: MouseEvent): void {
|
||||
const input = this.shadowRoot!.querySelector(
|
||||
"#alarmCode"
|
||||
) as PaperInputElement;
|
||||
const code =
|
||||
this._code ||
|
||||
(input && input.value && input.value.length > 0 ? input.value : "");
|
||||
callAlarmAction(
|
||||
this.hass!,
|
||||
this._config!.entity,
|
||||
(e.currentTarget! as any).action,
|
||||
this._code!
|
||||
code
|
||||
);
|
||||
this._code = "";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user