Adding Alarm Panel to Lovelace (#1758)

* Adding Alarm Panel

* Updating error in Lint

* Review Changes

* Using label-badge for upper right icon

* Resolving Reviews

* Prettier Fixes

* Updating style to fix overlapping state badge

* Adding Alarm Card back to create element

* Resolving reviews and reposition of Icon

* Updating to Localize Labels
This commit is contained in:
Zack Arnett
2018-10-15 19:14:43 +02:00
committed by Paulus Schoutsen
parent 97e1aae9c0
commit 48f6d1dfec
3 changed files with 335 additions and 0 deletions
@@ -0,0 +1,75 @@
import { html } from "@polymer/polymer/lib/utils/html-tag.js";
import { PolymerElement } from "@polymer/polymer/polymer-element.js";
import getEntity from "../data/entity.js";
import provideHass from "../data/provide_hass.js";
import "../components/demo-cards.js";
const ENTITIES = [
getEntity("alarm_control_panel", "alarm", "disarmed", {
friendly_name: "Alarm",
}),
getEntity("alarm_control_panel", "alarm_armed", "armed_home", {
friendly_name: "Alarm",
}),
];
const CONFIGS = [
{
heading: "Basic Example",
config: `
- type: alarm-panel
entity: alarm_control_panel.alarm
`,
},
{
heading: "With Title",
config: `
- type: alarm-panel
entity: alarm_control_panel.alarm_armed
title: My Alarm
`,
},
{
heading: "Using only Arm_Home State",
config: `
- type: alarm-panel
entity: alarm_control_panel.alarm
states:
- arm_home
`,
},
{
heading: "Invalid Entity",
config: `
- type: alarm-panel
entity: alarm_control_panel.alarm1
`,
},
];
class DemoAlarmPanelEntity extends PolymerElement {
static get template() {
return html`
<demo-cards id='demos' hass='[[hass]]' configs="[[_configs]]"></demo-cards>
`;
}
static get properties() {
return {
_configs: {
type: Object,
value: CONFIGS,
},
hass: Object,
};
}
ready() {
super.ready();
const hass = provideHass(this.$.demos);
hass.addEntities(ENTITIES);
}
}
customElements.define("demo-hui-alarm-panel-card", DemoAlarmPanelEntity);