Merge pull request #3358 from home-assistant/dev

20190712.0
This commit is contained in:
Paulus Schoutsen 2019-07-12 14:58:22 -07:00 committed by GitHub
commit e7e3edfd97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 387 additions and 164 deletions

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="home-assistant-frontend",
version="20190710.0",
version="20190712.0",
description="The Home Assistant frontend",
url="https://github.com/home-assistant/home-assistant-polymer",
author="The Home Assistant Authors",

View File

@ -412,6 +412,17 @@ class HaSidebar extends LitElement {
display: initial;
}
paper-listbox::-webkit-scrollbar {
width: 0.4rem;
height: 0.4rem;
}
paper-listbox::-webkit-scrollbar-thumb {
-webkit-border-radius: 4px;
border-radius: 4px;
background: var(--scrollbar-thumb-color);
}
paper-listbox {
padding: 4px 0;
display: flex;
@ -420,6 +431,8 @@ class HaSidebar extends LitElement {
height: calc(100% - 196px);
overflow-y: auto;
overflow-x: hidden;
scrollbar-color: var(--scrollbar-thumb-color) transparent;
scrollbar-width: thin;
}
a {

18
src/data/zwave.ts Normal file
View File

@ -0,0 +1,18 @@
import { HomeAssistant } from "../types";
export interface ZWaveNetworkStatus {
state: number;
}
export const ZWAVE_NETWORK_STATE_STOPPED = 0;
export const ZWAVE_NETWORK_STATE_FAILED = 1;
export const ZWAVE_NETWORK_STATE_STARTED = 5;
export const ZWAVE_NETWORK_STATE_AWAKED = 7;
export const ZWAVE_NETWORK_STATE_READY = 10;
export const fetchNetworkStatus = (
hass: HomeAssistant
): Promise<ZWaveNetworkStatus> =>
hass.callWS({
type: "zwave/network_status",
});

View File

@ -112,7 +112,7 @@ class HaConfigPerson extends LitElement {
<paper-fab
?is-wide=${this.isWide}
icon="hass:plus"
title="Create Area"
title="Add Person"
@click=${this._createPerson}
></paper-fab>
`;

View File

@ -1,4 +1,5 @@
import "@polymer/paper-icon-button/paper-icon-button";
import "@polymer/paper-spinner/paper-spinner";
import {
css,
@ -9,14 +10,24 @@ import {
property,
TemplateResult,
} from "lit-element";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { haStyle } from "../../../resources/styles";
import { HomeAssistant } from "../../../types";
import {
fetchNetworkStatus,
ZWaveNetworkStatus,
ZWAVE_NETWORK_STATE_STOPPED,
ZWAVE_NETWORK_STATE_STARTED,
ZWAVE_NETWORK_STATE_AWAKED,
ZWAVE_NETWORK_STATE_READY,
} from "../../../data/zwave";
import "../../../components/buttons/ha-call-api-button";
import "../../../components/buttons/ha-call-service-button";
import "../../../components/ha-service-description";
import "../../../components/ha-card";
import "../../../components/ha-icon";
import "../ha-config-section";
@customElement("zwave-network")
@ -24,12 +35,28 @@ export class ZwaveNetwork extends LitElement {
@property() public hass!: HomeAssistant;
@property() public isWide!: boolean;
@property() private _showHelp = false;
@property() private _networkStatus?: ZWaveNetworkStatus;
@property() private _unsubs: Array<Promise<UnsubscribeFunc>> = [];
public disconnectedCallback(): void {
this._unsubscribe();
}
protected firstUpdated(changedProps): void {
super.firstUpdated(changedProps);
this._getNetworkStatus();
this._subscribe();
}
protected render(): TemplateResult | void {
return html`
<ha-config-section .isWide="${this.isWide}">
<div style="position: relative" slot="header">
<span>Z-Wave Network Management</span>
<span>
${this.hass!.localize(
"ui.panel.config.zwave.network_management.header"
)}
</span>
<paper-icon-button
class="toggle-help-icon"
@click="${this._onHelpTap}"
@ -37,162 +64,168 @@ export class ZwaveNetwork extends LitElement {
></paper-icon-button>
</div>
<span slot="introduction">
Run commands that affect the Z-Wave network. You won't get feedback on
whether the command succeeded, but you can look in the OZW Log to try
to figure out.
${this.hass!.localize(
"ui.panel.config.zwave.network_management.introduction"
)}
</span>
<ha-card class="content">
<div class="card-actions">
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="add_node_secure"
>
Add Node Secure
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="add_node_secure"
?hidden=${!this._showHelp}
>
</ha-service-description>
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="add_node"
>
Add Node
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="add_node"
?hidden=${!this._showHelp}
>
</ha-service-description>
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="remove_node"
>
Remove Node
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="remove_node"
?hidden=${!this._showHelp}
>
</ha-service-description>
</div>
<div class="card-actions warning">
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="cancel_command"
>
Cancel Command
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="cancel_command"
?hidden=${!this._showHelp}
>
</ha-service-description>
</div>
<div class="card-actions">
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="heal_network"
>
Heal Network
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="heal_network"
?hidden=${!this._showHelp}
></ha-service-description>
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="start_network"
>
Start Network
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="start_network"
?hidden=${!this._showHelp}
>
</ha-service-description>
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="stop_network"
>
Stop Network
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="stop_network"
?hidden=${!this._showHelp}
>
</ha-service-description>
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="soft_reset"
>
Soft Reset
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="soft_reset"
?hidden=${!this._showHelp}
>
</ha-service-description>
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="test_network"
>
Test Network
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="test_network"
?hidden=${!this._showHelp}
>
</ha-service-description>
<ha-call-api-button .hass=${this.hass} path="zwave/saveconfig">
Save Config
</ha-call-api-button>
</div>
</ha-card>
${this._networkStatus
? html`
<ha-card class="content network-status">
<div class="details">
${this._networkStatus.state === ZWAVE_NETWORK_STATE_STOPPED
? html`
<ha-icon icon="hass:close"></ha-icon>
${this.hass!.localize(
"ui.panel.config.zwave.network_status.network_stopped"
)}
`
: this._networkStatus.state === ZWAVE_NETWORK_STATE_STARTED
? html`
<paper-spinner active></paper-spinner>
${this.hass!.localize(
"ui.panel.config.zwave.network_status.network_starting"
)}<br />
<small>
${this.hass!.localize(
"ui.panel.config.zwave.network_status.network_starting_note"
)}
</small>
`
: this._networkStatus.state === ZWAVE_NETWORK_STATE_AWAKED
? html`
<ha-icon icon="hass:checkbox-marked-circle"> </ha-icon>
${this.hass!.localize(
"ui.panel.config.zwave.network_status.network_started"
)}<br />
<small>
${this.hass!.localize(
"ui.panel.config.zwave.network_status.network_started_note_some_queried"
)}
</small>
`
: this._networkStatus.state === ZWAVE_NETWORK_STATE_READY
? html`
${this.hass!.localize(
"ui.panel.config.zwave.network_status.network_started"
)}<br />
<small>
${this.hass!.localize(
"ui.panel.config.zwave.network_status.network_started_note_all_queried"
)}
</small>
`
: ""}
</div>
<div class="card-actions">
${this._networkStatus.state >= ZWAVE_NETWORK_STATE_AWAKED
? html`
${this._generateServiceButton("stop_network")}
${this._generateServiceButton("heal_network")}
${this._generateServiceButton("test_network")}
`
: html`
${this._generateServiceButton("start_network")}
`}
</div>
${this._networkStatus.state >= ZWAVE_NETWORK_STATE_AWAKED
? html`
<div class="card-actions">
${this._generateServiceButton("soft_reset")}
<ha-call-api-button
.hass=${this.hass}
path="zwave/saveconfig"
>
${this.hass!.localize(
"ui.panel.config.zwave.services.save_config"
)}
</ha-call-api-button>
</div>
`
: ""}
</ha-card>
${this._networkStatus.state >= ZWAVE_NETWORK_STATE_AWAKED
? html`
<ha-card class="content">
<div class="card-actions">
${this._generateServiceButton("add_node_secure")}
${this._generateServiceButton("add_node")}
${this._generateServiceButton("remove_node")}
</div>
<div class="card-actions">
${this._generateServiceButton("cancel_command")}
</div>
</ha-card>
`
: ""}
`
: ""}
</ha-config-section>
`;
}
private async _getNetworkStatus(): Promise<void> {
this._networkStatus = await fetchNetworkStatus(this.hass!);
}
private _subscribe(): void {
this._unsubs = [
"zwave.network_start",
"zwave.network_stop",
"zwave.network_ready",
"zwave.network_complete",
"zwave.network_complete_some_dead",
].map((e) =>
this.hass!.connection.subscribeEvents(
(event) => this._handleEvent(event),
e
)
);
}
private _unsubscribe(): void {
while (this._unsubs.length) {
this._unsubs.pop()!.then((unsub) => unsub());
}
}
private _handleEvent(event) {
if (event.event_type === "zwave.network_start") {
// Optimistically set the state, wait 1s and poll the backend
// The backend will still report a state of 0 when the 'network_start'
// event is first fired.
if (this._networkStatus) {
this._networkStatus = { ...this._networkStatus, state: 5 };
}
setTimeout(() => this._getNetworkStatus, 1000);
} else {
this._getNetworkStatus();
}
}
private _onHelpTap(): void {
this._showHelp = !this._showHelp;
}
private _generateServiceButton(service: string) {
return html`
<ha-call-service-button
.hass=${this.hass}
domain="zwave"
service="${service}"
>
${this.hass!.localize("ui.panel.config.zwave.services." + service)}
</ha-call-service-button>
<ha-service-description
.hass=${this.hass}
domain="zwave"
service="${service}"
?hidden=${!this._showHelp}
>
</ha-service-description>
`;
}
static get styles(): CSSResult[] {
return [
haStyle,
@ -201,6 +234,26 @@ export class ZwaveNetwork extends LitElement {
margin-top: 24px;
}
.network-status {
text-align: center;
}
.network-status div.details {
font-size: 1.5rem;
padding: 24px;
}
.network-status ha-icon {
display: block;
margin: 0px auto 16px;
width: 48px;
height: 48px;
}
.network-status small {
font-size: 1rem;
}
ha-card {
margin: 0 auto;
max-width: 600px;

View File

@ -14,7 +14,8 @@ import "./system-log-card";
import "./error-log-card";
import "./system-health-card";
const JS_VERSION = __BUILD__;
const JS_TYPE = __BUILD__;
const JS_VERSION = __VERSION__;
const OPT_IN_PANEL = "states";
class HaPanelDevInfo extends LitElement {
@ -92,7 +93,7 @@ class HaPanelDevInfo extends LitElement {
>.
</p>
<p>
Frontend JavaScript version: ${JS_VERSION}
Frontend version: ${JS_VERSION} - ${JS_TYPE}
${customUiList.length > 0
? html`
<div>

View File

@ -31,6 +31,8 @@ documentContainer.innerHTML = `<custom-style>
--accent-color: #ff9800;
--divider-color: rgba(0, 0, 0, .12);
--scrollbar-thumb-color: rgb(194, 194, 194);
/* states and badges */
--state-icon-color: #44739e;
--state-icon-active-color: #FDD835;

View File

@ -921,7 +921,31 @@
},
"zwave": {
"caption": "Z-Wave",
"description": "Manage your Z-Wave network"
"description": "Manage your Z-Wave network",
"network_management": {
"header": "Z-Wave Network Management",
"introduction": "Run commands that affect the Z-Wave network. You won't get feedback on whether most commands succeeded, but you can check the OZW Log to try to find out."
},
"network_status": {
"network_stopped": "Z-Wave Network Stopped",
"network_starting": "Starting Z-Wave Network...",
"network_starting_note": "This may take a while depending on the size of your network.",
"network_started": "Z-Wave Network Started",
"network_started_note_some_queried": "Awake nodes have been queried. Sleeping nodes will be queried when they wake.",
"network_started_note_all_queried": "All nodes have been queried."
},
"services": {
"start_network": "Start Network",
"stop_network": "Stop Network",
"heal_network": "Heal Network",
"test_network": "Test Network",
"soft_reset": "Soft Reset",
"save_config": "Save Config",
"add_node_secure": "Add Node Secure",
"add_node": "Add Node",
"remove_node": "Remove Node",
"cancel_command": "Cancel Command"
}
}
},
"history": {

View File

@ -143,7 +143,8 @@
"high_demand": "Galw uchel",
"heat_pump": "Pwmp gwres",
"gas": "Nwy",
"manual": "Llawlyfr"
"manual": "Llawlyfr",
"heat_cool": "Awto"
},
"configurator": {
"configure": "Ffurfweddu",
@ -560,8 +561,25 @@
"caption": "Z-Wave",
"description": "Rheoli eich rhwydwaith Z-Wave"
},
"cloud": {
"description_login": "Wedi mewngofnodi fel {email}",
"description_not_login": "Heb fewngofnodi",
"description_features": "Rheolaeth oddi cartref, integreiddio gyda Alexa a Google Assistant."
},
"integrations": {
"caption": "Integreiddiadau",
"description": "Rheoli dyfeisiau a gwasanaethau cysylltiedig",
"discovered": "Darganfuwyd",
"configured": "Wedi'i ffurfweddu",
"new": "Sefydlu integreiddiad newydd",
"configure": "Ffurfweddu",
"none": "Dim byd wedi'i ffurfweddu eto.",
"config_entry": {
"no_devices": "Tydi'r integreiddad yma ddim efo dyfeisiadau.",
"no_device": "Endidau heb ddyfeisiau",
"delete_confirm": "A ydych yn siŵr bod chi eisiau dileu'r integreiddiad yma?",
"restart_confirm": "Ailgychwyn Home Assistant i ddarfod dileu'r integreiddiad hwn",
"manuf": "gan {manufacturer}",
"via": "Cysylltiad drwy",
"firmware": "Cadarnwedd: {version}",
"device_unavailable": "Dyfais ddim ar gael",
@ -653,9 +671,6 @@
"password": "Cyfrinair",
"create": "Creu"
}
},
"cloud": {
"description_features": "Rheolaeth oddi cartref, integreiddio gyda Alexa a Google Assistant."
}
},
"lovelace": {
@ -669,6 +684,14 @@
"title": "Croeso Gartref",
"no_devices": "Mae'r dudalen hon yn eich galluogi i reoli'ch dyfeisiau, ond mae'n edrych fel nad oes gennych ddyfeisiau wedi eu sefydlu eto. Ewch i'r dudalen integreiddio i ddechrau.",
"go_to_integrations_page": "Ewch i'r dudalen integreiddio."
},
"picture-elements": {
"hold": "Disgwyl",
"tap": "Tarwch:",
"navigate_to": "Ewch i {location}",
"toggle": "Toglo {enw}",
"call_service": "Galw gwasanaeth {name}",
"more_info": "Dangos mwy o wybodaeth: {name}"
}
},
"editor": {
@ -783,6 +806,9 @@
"page-demo": {
"cards": {
"demo": {
"demo_by": "gan {name}",
"next_demo": "Demo nesaf",
"introduction": "Croeso adre! Rydych wedi cyrraedd demo Home Assistant lle rydym yn arddangos y UIs gorau a grewyd gan ein cymuned.",
"learn_more": "Dysgwch fwy am Home Assistant"
}
},
@ -891,6 +917,9 @@
"arm_night": "Larwm nos",
"armed_custom_bypass": "Ffordd osgoi personol",
"arm_custom_bypass": "Ffordd osgoi personol"
},
"climate": {
"preset_mode": "Rhagosodiad"
}
},
"components": {
@ -978,6 +1007,16 @@
"off": "Off",
"on": "Ar",
"auto": "Awto"
},
"preset_mode": {
"none": "Dim",
"eco": "Eco",
"away": "I ffwrdd",
"boost": "Cynydd",
"comfort": "Cyfforddus",
"home": "Cartref",
"sleep": "Cysgu",
"activity": "Gweithgaredd"
}
}
},

View File

@ -145,7 +145,8 @@
"high_demand": "Alta Demanda",
"heat_pump": "Bomba de Calor",
"gas": "Gas",
"manual": "Manual"
"manual": "Manual",
"heat_cool": "Automático"
},
"configurator": {
"configure": "Configurar",
@ -619,7 +620,8 @@
"firmware": "Firmware: {version}",
"device_unavailable": "dispositivo no disponible",
"entity_unavailable": "entidad no disponible",
"no_area": "Ninguna área"
"no_area": "Ninguna área",
"hub": "Conectado a través de"
},
"config_flow": {
"external_step": {
@ -970,6 +972,49 @@
"refresh": "Actualizar"
},
"reload_lovelace": "Recargar Lovelace"
},
"page-demo": {
"cards": {
"demo": {
"demo_by": "por {name}",
"next_demo": "Siguiente demostración",
"introduction": "¡Bienvenido a casa! Ha llegado a la demostración de Home Assistant donde mostramos las mejores interfaces de usuario creadas por nuestra comunidad.",
"learn_more": "Aprenda más sobre Home Assistant"
}
},
"config": {
"arsaboo": {
"names": {
"upstairs": "Piso de arriba",
"family_room": "Habitación familiar",
"kitchen": "Cocina",
"patio": "Patio",
"hallway": "Pasillo",
"master_bedroom": "Recamara principal",
"left": "Izquierda",
"right": "Derecha",
"mirror": "Espejo"
},
"labels": {
"lights": "Luces",
"information": "Información",
"morning_commute": "Viaje de mañana",
"commute_home": "Viaje a casa",
"entertainment": "Entretenimiento",
"activity": "Actividad",
"hdmi_input": "Entrada HDMI",
"hdmi_switcher": "Conmutador HDMI",
"volume": "Volumen",
"total_tv_time": "Tiempo total de TV",
"turn_tv_off": "Apagar la televisión",
"air": "Aire"
},
"unit": {
"watching": "viendo",
"minutes_abbr": "mín."
}
}
}
}
},
"sidebar": {
@ -1078,7 +1123,8 @@
"fan_mode": "Modo del ventilador",
"swing_mode": "Modo de oscilación",
"away_mode": "Fuera de Casa",
"aux_heat": "Calor auxiliar"
"aux_heat": "Calor auxiliar",
"preset_mode": "Preestablecido"
},
"lock": {
"code": "Código",
@ -1223,6 +1269,16 @@
"off": "Apagado",
"on": "Encendido",
"auto": "Auto"
},
"preset_mode": {
"none": "Ninguno",
"eco": "Eco",
"away": "Fuera de casa",
"boost": "Aumentar",
"comfort": "Comodidad",
"home": "En Casa",
"sleep": "Dormir",
"activity": "Actividad"
}
}
},

View File

@ -145,7 +145,8 @@
"high_demand": "Forte demande",
"heat_pump": "Pompe à chaleur",
"gas": "Gaz",
"manual": "Manuel"
"manual": "Manuel",
"heat_cool": "Automatique"
},
"configurator": {
"configure": "Configurer",
@ -297,7 +298,7 @@
},
"device_tracker": {
"home": "Maison",
"not_home": "Absent.e"
"not_home": "Absent(e)"
},
"person": {
"home": "Présent",
@ -1122,7 +1123,8 @@
"fan_mode": "Mode de ventilation",
"swing_mode": "Mode de balancement",
"away_mode": "Mode \"Absent\"",
"aux_heat": "Chauffage d'appoint"
"aux_heat": "Chauffage d'appoint",
"preset_mode": "Préréglage"
},
"lock": {
"code": "Code",
@ -1267,6 +1269,16 @@
"off": "Off",
"on": "On",
"auto": "Auto"
},
"preset_mode": {
"none": "Aucun",
"eco": "Eco",
"away": "Absent",
"boost": "Renforcer",
"comfort": "Confort",
"home": "Accueil",
"sleep": "Veille",
"activity": "Activité"
}
}
},

View File

@ -1123,7 +1123,8 @@
"fan_mode": "Sebesség",
"swing_mode": "Forgási mód",
"away_mode": "Távoli mód",
"aux_heat": "Külső melegítő"
"aux_heat": "Külső melegítő",
"preset_mode": "Beállítási mód"
},
"lock": {
"code": "Kód",
@ -1273,6 +1274,7 @@
"none": "Nincs",
"eco": "Takarékos",
"away": "Távol",
"boost": "Turbo",
"comfort": "Komfort",
"home": "Otthon",
"sleep": "Alvás",

View File

@ -122,7 +122,8 @@
"eco": "Sparnaður",
"heat_pump": "Hitadæla",
"gas": "Gas",
"manual": "Handvirkt"
"manual": "Handvirkt",
"heat_cool": "Sjálfvirkt"
},
"cover": {
"open": "Opin",
@ -393,6 +394,7 @@
"zone": {
"label": "Öryggissvæði",
"entity": "Eining með staðsetningu",
"zone": "Svæði",
"event": "Viðburður:",
"enter": "Koma",
"leave": "Brottför"
@ -1094,6 +1096,7 @@
},
"domain": {
"automation": "Sjálfvirkni",
"binary_sensor": "Tvíundar skynjari",
"calendar": "Dagatal",
"camera": "Myndavél",
"climate": "Loftslag",