mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 16:26:43 +00:00
commit
7baf6382ac
File diff suppressed because it is too large
Load Diff
@ -6,12 +6,9 @@ import {
|
||||
PropertyDeclarations,
|
||||
} from "lit-element";
|
||||
import { until } from "lit-html/directives/until";
|
||||
import "@polymer/paper-icon-button";
|
||||
import "@material/mwc-button";
|
||||
import "@polymer/paper-spinner/paper-spinner-lite";
|
||||
import "../../../src/components/ha-card";
|
||||
import "../../../src/components/ha-paper-icon-button-next";
|
||||
import "../../../src/components/ha-paper-icon-button-prev";
|
||||
import { LovelaceCard, Lovelace } from "../../../src/panels/lovelace/types";
|
||||
import { LovelaceCardConfig } from "../../../src/data/lovelace";
|
||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||
@ -49,11 +46,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
||||
return html`
|
||||
<ha-card>
|
||||
<div class="picker">
|
||||
<ha-paper-icon-button-prev
|
||||
@click=${this._prevConfig}
|
||||
.disabled=${this._switching}
|
||||
></ha-paper-icon-button-prev>
|
||||
<div>
|
||||
<div class="label">
|
||||
${this._switching
|
||||
? html`
|
||||
<paper-spinner-lite active></paper-spinner-lite>
|
||||
@ -73,16 +66,15 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
||||
""
|
||||
)}
|
||||
</div>
|
||||
<ha-paper-icon-button-next
|
||||
@click=${this._nextConfig}
|
||||
.disabled=${this._switching}
|
||||
></ha-paper-icon-button-next>
|
||||
<mwc-button @click=${this._nextConfig} .disabled=${this._switching}>
|
||||
Next demo
|
||||
</mwc-button>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="content small-hidden">
|
||||
Welcome home! You've reached the Home Assistant demo where we showcase
|
||||
the best UIs created by our community.
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="actions small-hidden">
|
||||
<a href="https://www.home-assistant.io" target="_blank">
|
||||
<mwc-button>Learn more about Home Assistant</mwc-button>
|
||||
</a>
|
||||
@ -91,14 +83,6 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
||||
`;
|
||||
}
|
||||
|
||||
private _prevConfig() {
|
||||
this._updateConfig(
|
||||
selectedDemoConfigIndex > 0
|
||||
? selectedDemoConfigIndex - 1
|
||||
: demoConfigs.length - 1
|
||||
);
|
||||
}
|
||||
|
||||
private _nextConfig() {
|
||||
this._updateConfig(
|
||||
selectedDemoConfigIndex < demoConfigs.length - 1
|
||||
@ -125,6 +109,10 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.actions a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px;
|
||||
}
|
||||
@ -136,17 +124,27 @@ export class HADemoCard extends LitElement implements LovelaceCard {
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.picker div {
|
||||
text-align: center;
|
||||
.picker mwc-button {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.picker small {
|
||||
.label {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.label small {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.actions {
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 500px) {
|
||||
.small-hidden {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
@ -87,7 +87,7 @@
|
||||
#ha-init-skeleton::before {
|
||||
display: block;
|
||||
content: "";
|
||||
height: 112px;
|
||||
height: 64px;
|
||||
background-color: #03a9f4;
|
||||
}
|
||||
</style>
|
||||
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="home-assistant-frontend",
|
||||
version="20190614.0",
|
||||
version="20190618.0",
|
||||
description="The Home Assistant frontend",
|
||||
url="https://github.com/home-assistant/home-assistant-polymer",
|
||||
author="The Home Assistant Authors",
|
||||
|
@ -4,7 +4,8 @@ import { Map } from "leaflet";
|
||||
export type LeafletModuleType = typeof import("leaflet");
|
||||
|
||||
export const setupLeafletMap = async (
|
||||
mapElement: HTMLElement
|
||||
mapElement: HTMLElement,
|
||||
darkMode = false
|
||||
): Promise<[Map, LeafletModuleType]> => {
|
||||
if (!mapElement.parentNode) {
|
||||
throw new Error("Cannot setup Leaflet map on disconnected element");
|
||||
@ -20,9 +21,9 @@ export const setupLeafletMap = async (
|
||||
mapElement.parentNode.appendChild(style);
|
||||
map.setView([52.3731339, 4.8903147], 13);
|
||||
Leaflet.tileLayer(
|
||||
`https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}${
|
||||
Leaflet.Browser.retina ? "@2x.png" : ".png"
|
||||
}`,
|
||||
`https://{s}.basemaps.cartocdn.com/${
|
||||
darkMode ? "dark_all" : "light_all"
|
||||
}/{z}/{x}/{y}${Leaflet.Browser.retina ? "@2x.png" : ".png"}`,
|
||||
{
|
||||
attribution:
|
||||
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>, © <a href="https://carto.com/attributions">CARTO</a>',
|
||||
|
@ -8,6 +8,7 @@ export interface ZHAEntityReference extends HassEntity {
|
||||
export interface ZHADevice {
|
||||
name: string;
|
||||
ieee: string;
|
||||
nwk: string;
|
||||
manufacturer: string;
|
||||
model: string;
|
||||
quirk_applied: boolean;
|
||||
|
@ -4,12 +4,10 @@ import "@polymer/paper-input/paper-input";
|
||||
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
||||
|
||||
import { EventsMixin } from "../../../mixins/events-mixin";
|
||||
import LocalizeMixin from "../../../mixins/localize-mixin";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
|
||||
class MoreInfoAlarmControlPanel extends LocalizeMixin(
|
||||
EventsMixin(PolymerElement)
|
||||
) {
|
||||
class MoreInfoAlarmControlPanel extends LocalizeMixin(PolymerElement) {
|
||||
static get template() {
|
||||
return html`
|
||||
<style include="iron-flex"></style>
|
||||
@ -187,7 +185,8 @@ class MoreInfoAlarmControlPanel extends LocalizeMixin(
|
||||
},
|
||||
_codeValid: {
|
||||
type: Boolean,
|
||||
computed: "_validateCode(_enteredCode, _codeFormat)",
|
||||
computed:
|
||||
"_validateCode(_enteredCode, _codeFormat, _armVisible, _codeArmRequired)",
|
||||
},
|
||||
_disarmVisible: {
|
||||
type: Boolean,
|
||||
@ -220,6 +219,7 @@ class MoreInfoAlarmControlPanel extends LocalizeMixin(
|
||||
const props = {
|
||||
_codeFormat: newVal.attributes.code_format,
|
||||
_armVisible: state === "disarmed",
|
||||
_codeArmRequired: newVal.attributes.code_arm_required,
|
||||
_disarmVisible:
|
||||
this._armedStates.includes(state) ||
|
||||
state === "pending" ||
|
||||
@ -231,7 +231,7 @@ class MoreInfoAlarmControlPanel extends LocalizeMixin(
|
||||
}
|
||||
if (oldVal) {
|
||||
setTimeout(() => {
|
||||
this.fire("iron-resize");
|
||||
fireEvent(this, "iron-resize");
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
@ -240,8 +240,8 @@ class MoreInfoAlarmControlPanel extends LocalizeMixin(
|
||||
return format === "Number";
|
||||
}
|
||||
|
||||
_validateCode(code, format) {
|
||||
return !format || code.length > 0;
|
||||
_validateCode(code, format, armVisible, codeArmRequired) {
|
||||
return !format || code.length > 0 || (armVisible && !codeArmRequired);
|
||||
}
|
||||
|
||||
_digitClicked(ev) {
|
||||
|
@ -36,10 +36,10 @@ class ZHAAddDevicesPage extends LitElement {
|
||||
|
||||
public connectedCallback(): void {
|
||||
super.connectedCallback();
|
||||
if (this.route && this.route.path && this.route.path !== "") {
|
||||
this._ieeeAddress = this.route.path.substring(1);
|
||||
}
|
||||
this._subscribe(this._ieeeAddress);
|
||||
this.route && this.route.path && this.route.path !== ""
|
||||
? (this._ieeeAddress = this.route.path.substring(1))
|
||||
: (this._ieeeAddress = undefined);
|
||||
this._subscribe();
|
||||
}
|
||||
|
||||
public disconnectedCallback(): void {
|
||||
@ -156,10 +156,10 @@ class ZHAAddDevicesPage extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
private _subscribe(ieeeAddress: string | undefined): void {
|
||||
private _subscribe(): void {
|
||||
const data: any = { type: "zha/devices/permit" };
|
||||
if (ieeeAddress) {
|
||||
data.ieee = ieeeAddress;
|
||||
if (this._ieeeAddress) {
|
||||
data.ieee = this._ieeeAddress;
|
||||
}
|
||||
this._subscribed = this.hass!.connection.subscribeMessage(
|
||||
(message) => this._handleMessage(message),
|
||||
|
@ -36,6 +36,7 @@ import { HomeAssistant } from "../../../types";
|
||||
import { ItemSelectedEvent, NodeServiceData } from "./types";
|
||||
import { navigate } from "../../../common/navigate";
|
||||
import { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||
import { formatAsPaddedHex } from "./functions";
|
||||
|
||||
declare global {
|
||||
// for fire event
|
||||
@ -132,6 +133,8 @@ class ZHADeviceCard extends LitElement {
|
||||
<dl>
|
||||
<dt>IEEE:</dt>
|
||||
<dd class="zha-info">${this.device!.ieee}</dd>
|
||||
<dt>Nwk:</dt>
|
||||
<dd class="zha-info">${formatAsPaddedHex(this.device!.nwk)}</dd>
|
||||
${
|
||||
this.device!.quirk_applied
|
||||
? html`
|
||||
|
@ -180,7 +180,10 @@ class HuiMapCard extends LitElement implements LovelaceCard {
|
||||
}
|
||||
|
||||
private async loadMap(): Promise<void> {
|
||||
[this._leafletMap, this.Leaflet] = await setupLeafletMap(this._mapEl);
|
||||
[this._leafletMap, this.Leaflet] = await setupLeafletMap(
|
||||
this._mapEl,
|
||||
this._config !== undefined ? this._config.dark_mode !== false : false
|
||||
);
|
||||
this._drawEntities();
|
||||
this._leafletMap.invalidateSize();
|
||||
this._fitMap();
|
||||
|
@ -109,6 +109,7 @@ export interface MapCardConfig extends LovelaceCardConfig {
|
||||
default_zoom?: number;
|
||||
entities?: Array<EntityConfig | string>;
|
||||
geo_location_sources?: string[];
|
||||
dark_mode?: boolean;
|
||||
}
|
||||
|
||||
export interface MarkdownCardConfig extends LovelaceCardConfig {
|
||||
|
@ -37,6 +37,7 @@ const cardConfigStruct = struct({
|
||||
title: "string?",
|
||||
aspect_ratio: "string?",
|
||||
default_zoom: "number?",
|
||||
dark_mode: "boolean?",
|
||||
entities: [entitiesConfigStruct],
|
||||
geo_location_sources: "array?",
|
||||
});
|
||||
@ -71,6 +72,10 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
return this._config!.geo_location_sources || [];
|
||||
}
|
||||
|
||||
get _dark_mode(): boolean {
|
||||
return this._config!.dark_mode || false;
|
||||
}
|
||||
|
||||
protected render(): TemplateResult | void {
|
||||
if (!this.hass) {
|
||||
return html``;
|
||||
@ -100,6 +105,12 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
@value-changed="${this._valueChanged}"
|
||||
></paper-input>
|
||||
</div>
|
||||
<paper-toggle-button
|
||||
?checked="${this._dark_mode !== false}"
|
||||
.configValue="${"dark_mode"}"
|
||||
@change="${this._valueChanged}"
|
||||
>Dark Mode?</paper-toggle-button
|
||||
>
|
||||
<hui-entity-editor
|
||||
.hass="${this.hass}"
|
||||
.entities="${this._configEntities}"
|
||||
@ -155,7 +166,8 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor {
|
||||
}
|
||||
this._config = {
|
||||
...this._config,
|
||||
[target.configValue!]: value,
|
||||
[target.configValue]:
|
||||
target.checked !== undefined ? target.checked : value,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "Firmware: {version}",
|
||||
"device_unavailable": "dispositiu no disponible",
|
||||
"entity_unavailable": "entitat no disponible",
|
||||
"no_area": "Sense àrea"
|
||||
"no_area": "Sense àrea",
|
||||
"hub": "Connectat a través de"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "Firmware: {version}",
|
||||
"device_unavailable": "device unavailable",
|
||||
"entity_unavailable": "entity unavailable",
|
||||
"no_area": "No Area"
|
||||
"no_area": "No Area",
|
||||
"hub": "Connected via"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -113,7 +113,7 @@
|
||||
"on": "Caliente"
|
||||
},
|
||||
"window": {
|
||||
"off": "Cerrado",
|
||||
"off": "Cerrada",
|
||||
"on": "Abierta"
|
||||
},
|
||||
"lock": {
|
||||
@ -361,7 +361,7 @@
|
||||
"location_name": "Nombre de tu instalación de Home Assistant",
|
||||
"latitude": "Latitud",
|
||||
"longitude": "Longitud",
|
||||
"elevation": "Elevación",
|
||||
"elevation": "Altitud",
|
||||
"elevation_meters": "metros",
|
||||
"time_zone": "Zona horaria",
|
||||
"unit_system": "Sistema de unidades",
|
||||
@ -619,7 +619,8 @@
|
||||
"firmware": "Firmware: {version}",
|
||||
"device_unavailable": "dispositivo no disponible",
|
||||
"entity_unavailable": "entidad no disponible",
|
||||
"no_area": "Ningún área"
|
||||
"no_area": "Ningún área",
|
||||
"hub": "Conectado a través de"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "קושחה: {version}",
|
||||
"device_unavailable": "התקן אינו זמין",
|
||||
"entity_unavailable": "ישות לא זמינה",
|
||||
"no_area": "ללא אזור"
|
||||
"no_area": "ללא אזור",
|
||||
"hub": "מחובר באמצעות"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
@ -1138,7 +1139,7 @@
|
||||
"dialogs": {
|
||||
"more_info_settings": {
|
||||
"save": "שמור",
|
||||
"name": "שם",
|
||||
"name": "שם חלופי",
|
||||
"entity_id": "מזהה ישות"
|
||||
},
|
||||
"more_info_control": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "Firmware: {version}",
|
||||
"device_unavailable": "eszköz nem érhető el",
|
||||
"entity_unavailable": "entitás nem érhető el",
|
||||
"no_area": "Nincs Terület"
|
||||
"no_area": "Nincs Terület",
|
||||
"hub": "Kapcsolódva"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -298,9 +298,11 @@
|
||||
"stop": "Stöðva"
|
||||
},
|
||||
"core_config": {
|
||||
"location_name": "Nafnið á Home Assistant uppsetningunni",
|
||||
"latitude": "Breiddargráða",
|
||||
"longitude": "Lengdargráða",
|
||||
"elevation": "Hækkun",
|
||||
"elevation_meters": "metrar",
|
||||
"time_zone": "Tímabelti",
|
||||
"save_button": "Vista"
|
||||
}
|
||||
@ -521,7 +523,8 @@
|
||||
"firmware": "Fastbúnaðarútgáfa: {version}",
|
||||
"device_unavailable": "Tæki ekki tiltækt",
|
||||
"entity_unavailable": "Eining ekki tiltæk",
|
||||
"no_area": "Ekkert svæði"
|
||||
"no_area": "Ekkert svæði",
|
||||
"hub": "Tengt gegnum"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
@ -771,6 +774,10 @@
|
||||
"integration": {
|
||||
"more_integrations": "Meira",
|
||||
"finish": "Ljúka"
|
||||
},
|
||||
"core-config": {
|
||||
"location_name_default": "Heima",
|
||||
"finish": "Næsta"
|
||||
}
|
||||
},
|
||||
"lovelace": {
|
||||
@ -841,7 +848,11 @@
|
||||
},
|
||||
"warning": {
|
||||
"entity_not_found": "Eining ekki tiltæk: {entity}"
|
||||
}
|
||||
},
|
||||
"changed_toast": {
|
||||
"refresh": "Endurnýja"
|
||||
},
|
||||
"reload_lovelace": "Endurhlaða Lovelace"
|
||||
}
|
||||
},
|
||||
"sidebar": {
|
||||
@ -871,7 +882,7 @@
|
||||
"not_available": "Mynd ekki tiltæk"
|
||||
},
|
||||
"persistent_notification": {
|
||||
"dismiss": "Hafna"
|
||||
"dismiss": "Vísa frá"
|
||||
},
|
||||
"scene": {
|
||||
"activate": "Virkja"
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "펌웨어: {version}",
|
||||
"device_unavailable": "기기 사용불가",
|
||||
"entity_unavailable": "구성요소 사용불가",
|
||||
"no_area": "영역 없음"
|
||||
"no_area": "영역 없음",
|
||||
"hub": "연결 경유 대상"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "Firmware: {version}",
|
||||
"device_unavailable": "Apparat net erreechbar",
|
||||
"entity_unavailable": "Entitéit net erreechbar",
|
||||
"no_area": "Kee Beräich"
|
||||
"no_area": "Kee Beräich",
|
||||
"hub": "Verbonnen via"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "Fastvare: {version}",
|
||||
"device_unavailable": "enheten er utilgjengelig",
|
||||
"entity_unavailable": "oppføringen er utilgjengelig",
|
||||
"no_area": "Intet område"
|
||||
"no_area": "Intet område",
|
||||
"hub": "Ligado atravez de"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "Oprogramowanie: {version}",
|
||||
"device_unavailable": "urządzenie niedostępne",
|
||||
"entity_unavailable": "encja niedostępna",
|
||||
"no_area": "brak"
|
||||
"no_area": "brak",
|
||||
"hub": "Połączony przez"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "Прошивка: {version}",
|
||||
"device_unavailable": "устройство недоступно",
|
||||
"entity_unavailable": "объект недоступен",
|
||||
"no_area": "Не указано"
|
||||
"no_area": "Не указано",
|
||||
"hub": "Подключено через"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "固件:{version}",
|
||||
"device_unavailable": "设备不可用",
|
||||
"entity_unavailable": "实体不可用",
|
||||
"no_area": "没有区域"
|
||||
"no_area": "没有区域",
|
||||
"hub": "连接于"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
@ -888,7 +889,7 @@
|
||||
"intro": "{name},您好!欢迎来到 Home Assistant。您想怎样命名您的家呢?",
|
||||
"intro_location": "我们想知道您住在哪里。这将用于显示资讯以及设置基于太阳的自动化。此数据永远不会在您的网络以外共享。",
|
||||
"intro_location_detect": "我们可以通过向外部服务发出一个一次性请求来帮助您填写此信息。",
|
||||
"location_name_default": "Home",
|
||||
"location_name_default": "家",
|
||||
"button_detect": "自动检测",
|
||||
"finish": "下一步"
|
||||
}
|
||||
|
@ -619,7 +619,8 @@
|
||||
"firmware": "韌體:{version}",
|
||||
"device_unavailable": "裝置不可用",
|
||||
"entity_unavailable": "物件不可用",
|
||||
"no_area": "無分區"
|
||||
"no_area": "無分區",
|
||||
"hub": "連線:"
|
||||
},
|
||||
"config_flow": {
|
||||
"external_step": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user