mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Fix alarm panel (#5291)
Fixes https://github.com/home-assistant/frontend/issues/5073
This commit is contained in:
parent
0d404e0e37
commit
685a0807d8
@ -12,9 +12,9 @@ export const callAlarmAction = (
|
|||||||
| "arm_night"
|
| "arm_night"
|
||||||
| "arm_custom_bypass"
|
| "arm_custom_bypass"
|
||||||
| "disarm",
|
| "disarm",
|
||||||
code: string
|
code?: string
|
||||||
) => {
|
) => {
|
||||||
hass!.callService("alarm_control_panel", "alarm_" + action, {
|
hass!.callService("alarm_control_panel", `alarm_${action}`, {
|
||||||
entity_id: entity,
|
entity_id: entity,
|
||||||
code,
|
code,
|
||||||
});
|
});
|
||||||
|
@ -248,16 +248,16 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _handleActionClick(e: MouseEvent): void {
|
private _handleActionClick(e: MouseEvent): void {
|
||||||
const input = this._input!;
|
const input = this._input;
|
||||||
const code =
|
|
||||||
input && input.value && input.value.length > 0 ? input.value : "";
|
|
||||||
callAlarmAction(
|
callAlarmAction(
|
||||||
this.hass!,
|
this.hass!,
|
||||||
this._config!.entity,
|
this._config!.entity,
|
||||||
(e.currentTarget! as any).action,
|
(e.currentTarget! as any).action,
|
||||||
code
|
input?.value || undefined
|
||||||
);
|
);
|
||||||
input.value = "";
|
if (input) {
|
||||||
|
input.value = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _handleMoreInfo() {
|
private _handleMoreInfo() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user