1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-27 14:09:19 +00:00
Files
frontend/src/more-infos/more-info-alarm_control_panel.js
2015-09-15 20:17:43 +02:00

34 lines
926 B
JavaScript

import { serviceActions } from '../util/home-assistant-js-instance';
import Polymer from '../polymer';
import attributeClassNames from '../util/attribute-class-names';
const ATTRIBUTE_CLASSES = [];
export default new Polymer({
is: 'more-info-alarm_control_panel',
handleDisarmTap(number) {
this.callService('alarm_disarm', {code: this.entered_code});
},
handleHomeTap(number) {
this.callService('alarm_arm_home', {code: this.entered_code});
},
handleAwayTap(number) {
this.callService('alarm_arm_away', {code: this.entered_code});
},
properties: {
entered_code: {
type: String,
value: '',
},
},
enteredCodeChanged(ev) {
this.entered_code = ev.target.value;
},
callService(service, data) {
const serviceData = data || {};
serviceData.entity_id = this.stateObj.entityId;
serviceActions.callService('alarm_control_panel', service, serviceData);
},
});