mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 13:27:22 +00:00
Merge branch 'master' into glance-column-change
This commit is contained in:
commit
a113c71de7
12
package.json
12
package.json
@ -91,7 +91,6 @@
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.2",
|
||||
"@babel/plugin-external-helpers": "^7.0.0",
|
||||
"@babel/plugin-proposal-class-properties": "7.0.0",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-transform-react-jsx": "^7.0.0",
|
||||
@ -165,9 +164,14 @@
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,json,css,md}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
"linters": {
|
||||
"*.{js,json,css,md}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"ignore": [
|
||||
"translations/**"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
|
@ -28,7 +28,7 @@ mkdir -p ${LOCAL_DIR}
|
||||
|
||||
docker run \
|
||||
-v ${LOCAL_DIR}:/opt/dest/locale \
|
||||
lokalise/lokalise-cli@sha256:ddf5677f58551261008342df5849731c88bcdc152ab645b133b21819aede8218 lokalise \
|
||||
lokalise/lokalise-cli@sha256:b8329d20280263cad04f65b843e54b9e8e6909a348a678eac959550b5ef5c75f lokalise \
|
||||
--token ${LOKALISE_TOKEN} \
|
||||
export ${PROJECT_ID} \
|
||||
--export_empty skip \
|
||||
|
2
setup.py
2
setup.py
@ -1,7 +1,7 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(name='home-assistant-frontend',
|
||||
version='20181014.0',
|
||||
version='20181017.0',
|
||||
description='The Home Assistant frontend',
|
||||
url='https://github.com/home-assistant/home-assistant-polymer',
|
||||
author='The Home Assistant Authors',
|
||||
|
@ -11,13 +11,13 @@ import {
|
||||
LocalizeMixin,
|
||||
} from "./localize-base-mixin";
|
||||
|
||||
export const HassLocalizeLitMixin = (
|
||||
superClass: Constructor<LitElement>
|
||||
): Constructor<LitElement & LocalizeMixin> =>
|
||||
export const HassLocalizeLitMixin = <T extends LitElement>(
|
||||
superClass: Constructor<T>
|
||||
): Constructor<T & LocalizeMixin> =>
|
||||
// @ts-ignore
|
||||
class extends LocalizeBaseMixin(superClass) {
|
||||
protected hass?: HomeAssistant;
|
||||
protected localize?: LocalizeFunc;
|
||||
protected localize!: LocalizeFunc;
|
||||
|
||||
static get properties(): PropertyDeclarations {
|
||||
return {
|
||||
|
@ -199,15 +199,23 @@ class HaConfigCloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
|
||||
}
|
||||
|
||||
_formatSubscription(subInfo) {
|
||||
return subInfo === null
|
||||
? "Fetching subscription…"
|
||||
: subInfo.human_description.replace(
|
||||
"{periodEnd}",
|
||||
formatDateTime(
|
||||
new Date(subInfo.subscription.current_period_end * 1000),
|
||||
this.language
|
||||
)
|
||||
);
|
||||
if (subInfo === null) {
|
||||
return "Fetching subscription…";
|
||||
}
|
||||
|
||||
let description = subInfo.human_description;
|
||||
|
||||
if (subInfo.plan_renewal_date) {
|
||||
description = description.replace(
|
||||
"{periodEnd}",
|
||||
formatDateTime(
|
||||
new Date(subInfo.plan_renewal_date * 1000),
|
||||
this.language
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
_alexaChanged(ev) {
|
||||
|
@ -107,8 +107,9 @@ class HaConfigCloud extends NavigateMixin(PolymerElement) {
|
||||
timeOut.after(0),
|
||||
() => {
|
||||
if (
|
||||
!this.cloudStatus.logged_in &&
|
||||
!NOT_LOGGED_IN_URLS.includes(route.path)
|
||||
!this.cloudStatus ||
|
||||
(!this.cloudStatus.logged_in &&
|
||||
!NOT_LOGGED_IN_URLS.includes(route.path))
|
||||
) {
|
||||
this.navigate("/config/cloud/login", true);
|
||||
} else if (
|
||||
|
@ -8,6 +8,7 @@ import isValidEntityId from "../../../common/entity/valid_entity_id.js";
|
||||
import stateIcon from "../../../common/entity/state_icon.js";
|
||||
import computeStateDomain from "../../../common/entity/compute_state_domain.js";
|
||||
import computeStateName from "../../../common/entity/compute_state_name.js";
|
||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element.js";
|
||||
import { styleMap } from "lit-html/directives/styleMap.js";
|
||||
import { HomeAssistant } from "../../../types.js";
|
||||
import { HassLocalizeLitMixin } from "../../../mixins/lit-localize-mixin";
|
||||
@ -17,34 +18,36 @@ interface Config extends LovelaceConfig {
|
||||
entity: string;
|
||||
name?: string;
|
||||
icon?: string;
|
||||
theme?: string;
|
||||
tap_action?: "toggle" | "call-service" | "more-info";
|
||||
service?: string;
|
||||
service_data?: object;
|
||||
}
|
||||
|
||||
class HuiEntityButtonCard extends HassLocalizeLitMixin(LitElement)
|
||||
implements LovelaceCard {
|
||||
static get properties(): PropertyDeclarations {
|
||||
return {
|
||||
hass: {}
|
||||
};
|
||||
}
|
||||
|
||||
class HuiEntityButtonCard extends HassLocalizeLitMixin(LitElement)
|
||||
implements LovelaceCard {
|
||||
protected hass?: HomeAssistant;
|
||||
protected config?: Config;
|
||||
|
||||
static get properties(): PropertyDeclarations {
|
||||
return {
|
||||
hass: {},
|
||||
config: {},
|
||||
};
|
||||
}
|
||||
|
||||
public getCardSize() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public setConfig(config: Config) {
|
||||
if(!isValidEntityId(config.entity)) {
|
||||
if (!isValidEntityId(config.entity)) {
|
||||
throw new Error("Invalid Entity");
|
||||
}
|
||||
|
||||
this.config = config;
|
||||
this.config = { theme: "default", ...config };
|
||||
|
||||
if(this.hass) {
|
||||
if (this.hass) {
|
||||
this.requestUpdate();
|
||||
}
|
||||
}
|
||||
@ -54,26 +57,36 @@ implements LovelaceCard {
|
||||
return html``;
|
||||
}
|
||||
const stateObj = this.hass!.states[this.config.entity];
|
||||
|
||||
|
||||
applyThemesOnElement(this, this.hass!.themes, this.config.theme);
|
||||
|
||||
return html`
|
||||
${this.renderStyle()}
|
||||
<ha-card @click="${this.handleClick}">
|
||||
${
|
||||
!stateObj
|
||||
? html`<div class="not-found">Entity not available: ${this.config.entity}</div>`
|
||||
: html`
|
||||
!stateObj
|
||||
? html`<div class="not-found">Entity not available: ${
|
||||
this.config.entity
|
||||
}</div>`
|
||||
: html`
|
||||
<paper-button>
|
||||
<div>
|
||||
<ha-icon
|
||||
data-domain="${computeStateDomain(stateObj)}"
|
||||
data-state="${stateObj.state}"
|
||||
.icon="${this.config.icon ? this.config.icon : stateIcon(stateObj)}"
|
||||
style="${styleMap({filter: this._computeBrightness(stateObj), color: this._computeColor(stateObj)})}"
|
||||
.icon="${
|
||||
this.config.icon ? this.config.icon : stateIcon(stateObj)
|
||||
}"
|
||||
style="${styleMap({
|
||||
filter: this._computeBrightness(stateObj),
|
||||
color: this._computeColor(stateObj),
|
||||
})}"
|
||||
></ha-icon>
|
||||
<span>
|
||||
${this.config.name
|
||||
? this.config.name
|
||||
: computeStateName(stateObj)
|
||||
${
|
||||
this.config.name
|
||||
? this.config.name
|
||||
: computeStateName(stateObj)
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@ -131,15 +144,15 @@ implements LovelaceCard {
|
||||
const brightness = stateObj.attributes.brightness;
|
||||
return `brightness(${(brightness + 245) / 5}%)`;
|
||||
}
|
||||
|
||||
|
||||
private _computeColor(stateObj) {
|
||||
if (!stateObj.attributes.hs_color) {
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
const hue = stateObj.attributes.hs_color[0];
|
||||
const sat = stateObj.attributes.hs_color[1];
|
||||
if (sat <= 10) {
|
||||
return '';
|
||||
if (sat <= 10) {
|
||||
return "";
|
||||
}
|
||||
return `hsl(${hue}, 100%, ${100 - sat / 2}%)`;
|
||||
}
|
||||
@ -150,7 +163,7 @@ implements LovelaceCard {
|
||||
return;
|
||||
}
|
||||
const stateObj = this.hass!.states[config.entity];
|
||||
if(!stateObj) {
|
||||
if (!stateObj) {
|
||||
return;
|
||||
}
|
||||
const entityId = stateObj.entity_id;
|
||||
@ -159,7 +172,7 @@ implements LovelaceCard {
|
||||
toggleEntity(this.hass, entityId);
|
||||
break;
|
||||
case "call-service": {
|
||||
if(!config.service){
|
||||
if (!config.service) {
|
||||
return;
|
||||
}
|
||||
const [domain, service] = config.service.split(".", 2);
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { html, LitElement, PropertyDeclarations } from "@polymer/lit-element";
|
||||
import { html, LitElement } from "@polymer/lit-element";
|
||||
import { classMap } from "lit-html/directives/classMap.js";
|
||||
import { repeat } from "lit-html/directives/repeat";
|
||||
|
||||
import computeStateDisplay from "../../../common/entity/compute_state_display.js";
|
||||
import computeStateName from "../../../common/entity/compute_state_name.js";
|
||||
import processConfigEntities from "../common/process-config-entities";
|
||||
import applyThemesOnElement from "../../../common/dom/apply_themes_on_element.js";
|
||||
|
||||
import toggleEntity from "../common/entity/toggle-entity.js";
|
||||
|
||||
@ -30,27 +31,30 @@ interface Config extends LovelaceConfig {
|
||||
show_name?: boolean;
|
||||
show_state?: boolean;
|
||||
title?: string;
|
||||
theming?: "primary";
|
||||
column_width?: string;
|
||||
theme?: string;
|
||||
entities: EntityConfig[];
|
||||
}
|
||||
|
||||
class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
|
||||
export class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
|
||||
implements LovelaceCard {
|
||||
static get properties(): PropertyDeclarations {
|
||||
return {
|
||||
hass: {},
|
||||
};
|
||||
}
|
||||
protected hass?: HomeAssistant;
|
||||
protected config?: Config;
|
||||
protected configEntities?: EntityConfig[];
|
||||
|
||||
static get properties() {
|
||||
return {
|
||||
hass: {},
|
||||
config: {},
|
||||
};
|
||||
}
|
||||
|
||||
public getCardSize() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public setConfig(config: Config) {
|
||||
this.config = config;
|
||||
this.config = { theme: "default", ...config };
|
||||
const entities = processConfigEntities(config.entities);
|
||||
|
||||
for (const entity of entities) {
|
||||
@ -66,13 +70,6 @@ class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
|
||||
|
||||
this.style.setProperty("--glance-column-width", columnWidth);
|
||||
|
||||
if (config.theming) {
|
||||
if (typeof config.theming !== "string") {
|
||||
throw new Error("Incorrect theming config.");
|
||||
}
|
||||
this.classList.add(`theme-${config.theming}`);
|
||||
}
|
||||
|
||||
this.configEntities = entities;
|
||||
|
||||
if (this.hass) {
|
||||
@ -90,6 +87,8 @@ class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
|
||||
(conf) => conf.entity in states
|
||||
);
|
||||
|
||||
applyThemesOnElement(this, this.hass!.themes, this.config.theme);
|
||||
|
||||
return html`
|
||||
${this.renderStyle()}
|
||||
<ha-card .header="${title}">
|
||||
@ -107,11 +106,6 @@ class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
|
||||
private renderStyle() {
|
||||
return html`
|
||||
<style>
|
||||
:host(.theme-primary) {
|
||||
--paper-card-background-color:var(--primary-color);
|
||||
--paper-item-icon-color:var(--text-primary-color);
|
||||
color:var(--text-primary-color);
|
||||
}
|
||||
.entities {
|
||||
display: flex;
|
||||
padding: 0 16px 4px;
|
||||
|
@ -13,7 +13,7 @@ class HuiVerticalStackCard extends PolymerElement {
|
||||
flex-direction: column;
|
||||
}
|
||||
#root > * {
|
||||
margin: 4px 0 8px 0;
|
||||
margin: 4px 0 4px 0;
|
||||
}
|
||||
#root > *:first-child {
|
||||
margin-top: 0;
|
||||
|
1828
translations/cs.json
1828
translations/cs.json
File diff suppressed because it is too large
Load Diff
@ -13,7 +13,8 @@
|
||||
"dev-templates": "Skabeloner",
|
||||
"dev-mqtt": "MQTT",
|
||||
"dev-info": "Udvikler Information",
|
||||
"calendar": "Kalender"
|
||||
"calendar": "Kalender",
|
||||
"profile": "Profil"
|
||||
},
|
||||
"state": {
|
||||
"default": {
|
||||
@ -379,7 +380,8 @@
|
||||
"state": {
|
||||
"label": "Tilstand",
|
||||
"from": "Fra",
|
||||
"to": "Til"
|
||||
"to": "Til",
|
||||
"for": "Varighed"
|
||||
},
|
||||
"homeassistant": {
|
||||
"label": "Home Assistant",
|
||||
@ -524,6 +526,31 @@
|
||||
"deactivate_user": "Deaktiver bruger",
|
||||
"delete_user": "Slet bruger"
|
||||
}
|
||||
},
|
||||
"cloud": {
|
||||
"caption": "Home Assistant Cloud",
|
||||
"description_login": "Logget ind som {email}",
|
||||
"description_not_login": "Ikke logget ind"
|
||||
},
|
||||
"integrations": {
|
||||
"caption": "Integrationer",
|
||||
"description": "Administrer tilsluttede enheder og tjenester",
|
||||
"discovered": "Opdaget",
|
||||
"configured": "Konfigureret",
|
||||
"new": "Opret en ny integration",
|
||||
"configure": "Konfigurer",
|
||||
"none": "Ikke konfigureret",
|
||||
"config_entry": {
|
||||
"no_devices": "Denne integration har ingen enheder",
|
||||
"no_device": "Entiteter uden enhed",
|
||||
"delete_confirm": "Er du sikker på, at du vil fjerne denne integration?",
|
||||
"restart_confirm": "Genstart Home Assistant for at afslutte fjernelsen af denne integration",
|
||||
"manuf": "af {manufacturer}",
|
||||
"hub": "Forbundet via",
|
||||
"firmware": "Firmware: {version}",
|
||||
"device_unavailable": "enhed utilgængelig",
|
||||
"entity_unavailable": "entitet utilgængelig"
|
||||
}
|
||||
}
|
||||
},
|
||||
"profile": {
|
||||
@ -571,6 +598,16 @@
|
||||
"empty_state": "Du har ingen langtids adgangstokens endnu.",
|
||||
"last_used": "Sidst anvendt den {date} af {location}",
|
||||
"not_used": "Har aldrig været brugt"
|
||||
},
|
||||
"current_user": "Du er logget ind som {fullName} .",
|
||||
"is_owner": "Du er ejer.",
|
||||
"logout": "Log af",
|
||||
"mfa_setup": {
|
||||
"title_aborted": "Afbrudt",
|
||||
"title_success": "Succes!",
|
||||
"step_done": "Opsætning af {step} færdig",
|
||||
"close": "Luk",
|
||||
"submit": "Gem og afslut"
|
||||
}
|
||||
},
|
||||
"page-authorize": {
|
||||
@ -762,6 +799,7 @@
|
||||
"target_humidity": "Ønsket luftfugtighed",
|
||||
"operation": "Drift",
|
||||
"fan_mode": "Ventilator tilstand",
|
||||
"swing_mode": "Swing tilstand",
|
||||
"away_mode": "Ude af huset-modus",
|
||||
"aux_heat": "Støtte-varme"
|
||||
},
|
||||
@ -778,6 +816,13 @@
|
||||
"turn_on": "Tænd",
|
||||
"turn_off": "Sluk"
|
||||
}
|
||||
},
|
||||
"water_heater": {
|
||||
"currently": "Lige nu",
|
||||
"on_off": "Tænd \/ sluk",
|
||||
"target_temperature": "Ønsket temperatur",
|
||||
"operation": "Drift",
|
||||
"away_mode": "Ikke til stede"
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
|
@ -833,7 +833,7 @@
|
||||
},
|
||||
"water_heater": {
|
||||
"currently": "Aktuell",
|
||||
"on_off": "An \/ aus",
|
||||
"on_off": "An \/ Aus",
|
||||
"target_temperature": "Solltemperatur",
|
||||
"operation": "Betrieb",
|
||||
"away_mode": "Abwesend-Modus"
|
||||
|
1747
translations/fi.json
1747
translations/fi.json
File diff suppressed because it is too large
Load Diff
1828
translations/fr.json
1828
translations/fr.json
File diff suppressed because it is too large
Load Diff
1818
translations/he.json
1818
translations/he.json
File diff suppressed because it is too large
Load Diff
1828
translations/hu.json
1828
translations/hu.json
File diff suppressed because it is too large
Load Diff
1828
translations/it.json
1828
translations/it.json
File diff suppressed because it is too large
Load Diff
1828
translations/ko.json
1828
translations/ko.json
File diff suppressed because it is too large
Load Diff
1828
translations/nl.json
1828
translations/nl.json
File diff suppressed because it is too large
Load Diff
1828
translations/ro.json
1828
translations/ro.json
File diff suppressed because it is too large
Load Diff
@ -391,7 +391,7 @@
|
||||
},
|
||||
"mqtt": {
|
||||
"label": "MQTT",
|
||||
"topic": "Заголовок",
|
||||
"topic": "Топик",
|
||||
"payload": "Значение (опционально)"
|
||||
},
|
||||
"numeric_state": {
|
||||
@ -427,7 +427,7 @@
|
||||
},
|
||||
"conditions": {
|
||||
"header": "Условия",
|
||||
"introduction": "Условия являются необязательной частью правила автоматизации и могут использоваться для предотвращения действия при срабатывании. С первого взгляда может показаться, что условия и триггеры – это одно и то же, однако это не так. Триггер срабатывает непосредственно в момент, когда произошло событие, а условие лишь проверяет состояние системы в данный момент. Триггер может заметить, как был включен выключатель, условие же может видеть только текущее его состояние. \n\n[Подробнее об условиях.] (https:\/\/home-assistant.io\/docs\/scripts\/conditions\/)",
|
||||
"introduction": "Условия являются необязательной частью правила автоматизации и могут использоваться для предотвращения действия при срабатывании. С первого взгляда может показаться, что условия и триггеры – это одно и то же, однако это не так. Триггер срабатывает непосредственно в момент, когда произошло событие, а условие лишь проверяет состояние системы в данный момент. Триггер может заметить, как был включен выключатель, условие же может видеть только текущее его состояние. \n\n[Подробнее об условиях.](https:\/\/home-assistant.io\/docs\/scripts\/conditions\/)",
|
||||
"add": "Добавить условие",
|
||||
"duplicate": "Дублировать",
|
||||
"delete": "Удалить",
|
||||
@ -443,7 +443,7 @@
|
||||
"label": "Числовое состояние",
|
||||
"above": "Выше",
|
||||
"below": "Ниже",
|
||||
"value_template": "Значение шаблона (опционально)"
|
||||
"value_template": "Шаблон значения (опционально)"
|
||||
},
|
||||
"sun": {
|
||||
"label": "Солнце",
|
||||
@ -497,8 +497,8 @@
|
||||
"label": "Условие"
|
||||
},
|
||||
"event": {
|
||||
"label": "Событие",
|
||||
"event": "Событие",
|
||||
"label": "Создание события",
|
||||
"event": "Событие:",
|
||||
"service_data": "Данные службы"
|
||||
}
|
||||
}
|
||||
@ -836,7 +836,7 @@
|
||||
"on_off": "Вкл \/ Выкл",
|
||||
"target_temperature": "Заданная температура",
|
||||
"operation": "Операция",
|
||||
"away_mode": "Режим ожидания"
|
||||
"away_mode": "Режим \"не дома\""
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
|
1828
translations/sl.json
1828
translations/sl.json
File diff suppressed because it is too large
Load Diff
1424
translations/uk.json
1424
translations/uk.json
File diff suppressed because it is too large
Load Diff
1732
translations/vi.json
1732
translations/vi.json
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,6 @@
|
||||
"noUnusedParameters": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"experimentalDecorators": true,
|
||||
"strict": true,
|
||||
"noImplicitAny": false
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
"rules": {
|
||||
"interface-name": false,
|
||||
"no-submodule-imports": false,
|
||||
"ordered-imports": false
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user