diff --git a/src/dialogs/more-info/controls/more-info-alarm_control_panel.js b/src/dialogs/more-info/controls/more-info-alarm_control_panel.js index eecf605762..c233807645 100644 --- a/src/dialogs/more-info/controls/more-info-alarm_control_panel.js +++ b/src/dialogs/more-info/controls/more-info-alarm_control_panel.js @@ -6,31 +6,59 @@ import { PolymerElement } from '@polymer/polymer/polymer-element.js'; import EventsMixin from '../../../mixins/events-mixin.js'; -/* - * @appliesMixin EventsMixin - */ class MoreInfoAlarmControlPanel extends EventsMixin(PolymerElement) { static get template() { return html` - + + -
- -
-
- Disarm - Arm Home - Arm Away -
-`; +
+ +
+ + + +
+ Disarm + Arm Home + Arm Away +
+ `; } static get properties() { return { - hass: { - type: Object, - }, - + hass: Object, stateObj: { type: Object, observer: 'stateObjChanged', @@ -39,6 +67,10 @@ class MoreInfoAlarmControlPanel extends EventsMixin(PolymerElement) { type: String, value: '', }, + numericPin: { + type: Boolean, + value: false, + }, disarmButtonVisible: { type: Boolean, value: false, @@ -78,6 +110,7 @@ class MoreInfoAlarmControlPanel extends EventsMixin(PolymerElement) { if (newVal) { const props = { codeFormat: newVal.attributes.code_format, + numericPin: newVal.attributes.code_format === '^\\d+$', armHomeButtonVisible: newVal.state === 'disarmed', armAwayButtonVisible: newVal.state === 'disarmed', }; @@ -98,6 +131,14 @@ class MoreInfoAlarmControlPanel extends EventsMixin(PolymerElement) { } } + numberPadClicked(ev) { + this.enteredCode += ev.target.getAttribute('data-digit'); + } + + clearCode() { + this.enteredCode = ''; + } + handleDisarmTap() { this.callService('alarm_disarm', { code: this.enteredCode }); }