mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
Fix gauge card gallery demo (#2688)
This commit is contained in:
parent
bd0bc2047d
commit
7a344c865f
@ -2,6 +2,19 @@ import { html } from "@polymer/polymer/lib/utils/html-tag";
|
|||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||||
|
|
||||||
import "../components/demo-cards";
|
import "../components/demo-cards";
|
||||||
|
import { getEntity } from "../../../src/fake_data/entity";
|
||||||
|
import { provideHass } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
|
const ENTITIES = [
|
||||||
|
getEntity("sensor", "brightness", "12", {}),
|
||||||
|
getEntity("plant", "bonsai", "ok", {}),
|
||||||
|
getEntity("sensor", "outside_humidity", "54", {
|
||||||
|
unit_of_measurement: "%",
|
||||||
|
}),
|
||||||
|
getEntity("sensor", "outside_temperature", "15.6", {
|
||||||
|
unit_of_measurement: "°C",
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
const CONFIGS = [
|
const CONFIGS = [
|
||||||
{
|
{
|
||||||
@ -66,7 +79,7 @@ const CONFIGS = [
|
|||||||
class DemoGaugeEntity extends PolymerElement {
|
class DemoGaugeEntity extends PolymerElement {
|
||||||
static get template() {
|
static get template() {
|
||||||
return html`
|
return html`
|
||||||
<demo-cards configs="[[_configs]]"></demo-cards>
|
<demo-cards id="demos" configs="[[_configs]]"></demo-cards>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,6 +91,12 @@ class DemoGaugeEntity extends PolymerElement {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ready() {
|
||||||
|
super.ready();
|
||||||
|
const hass = provideHass(this.$.demos);
|
||||||
|
hass.addEntities(ENTITIES);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
customElements.define("demo-hui-gauge-card", DemoGaugeEntity);
|
customElements.define("demo-hui-gauge-card", DemoGaugeEntity);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user