Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build-scripts/gulp/translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,14 +369,13 @@ gulp.task(
const newData = {};
Object.entries(data).forEach(([key, value]) => {
// Filter out translations without native name.
if (data[key].nativeName) {
newData[key] = data[key];
if (value.nativeName) {
newData[key] = value;
} else {
console.warn(
`Skipping language ${key}. Native name was not translated.`
);
}
if (data[key]) newData[key] = value;
});
return newData;
})
Expand Down
11 changes: 8 additions & 3 deletions hassio/src/addon-store/hassio-addon-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class HassioAddonStore extends LitElement {
if (this.supervisor.addon.repositories) {
repos = this.addonRepositories(
this.supervisor.addon.repositories,
this.supervisor.addon.addons
this.supervisor.addon.addons,
this._filter
);
}

Expand Down Expand Up @@ -140,7 +141,11 @@ class HassioAddonStore extends LitElement {
}

private addonRepositories = memoizeOne(
(repositories: HassioAddonRepository[], addons: HassioAddonInfo[]) => {
(
repositories: HassioAddonRepository[],
addons: HassioAddonInfo[],
filter?: string
) => {
return repositories.sort(sortRepos).map((repo) => {
const filteredAddons = addons.filter(
(addon) => addon.repository === repo.slug
Expand All @@ -152,7 +157,7 @@ class HassioAddonStore extends LitElement {
.hass=${this.hass}
.repo=${repo}
.addons=${filteredAddons}
.filter=${this._filter!}
.filter=${filter!}
></hassio-addon-repository>
`
: html``;
Expand Down
11 changes: 5 additions & 6 deletions hassio/src/addon-view/config/hassio-addon-config-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ class HassioAddonConfigDashboard extends LitElement {
if (!this.addon) {
return html`<ha-circular-progress active></ha-circular-progress>`;
}
const hasOptions =
this.addon.options && Object.keys(this.addon.options).length;
const hasSchema =
hasOptions && this.addon.schema && Object.keys(this.addon.schema).length;
const hasConfiguration =
(this.addon.options && Object.keys(this.addon.options).length) ||
(this.addon.schema && Object.keys(this.addon.schema).length);

return html`
<div class="content">
${hasOptions || hasSchema || this.addon.network || this.addon.audio
${hasConfiguration || this.addon.network || this.addon.audio
? html`
${hasOptions || hasSchema
${hasConfiguration
? html`
<hassio-addon-config
.hass=${this.hass}
Expand Down
10 changes: 4 additions & 6 deletions hassio/src/addon-view/config/hassio-addon-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,10 @@ class HassioAddonConfig extends LitElement {

protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
this._canShowSchema =
Object.keys(this.addon.options).length !== 0 &&
!this.addon.schema!.find(
// @ts-ignore
(entry) => !SUPPORTED_UI_TYPES.includes(entry.type) || entry.multiple
);
this._canShowSchema = !this.addon.schema!.find(
// @ts-ignore
(entry) => !SUPPORTED_UI_TYPES.includes(entry.type) || entry.multiple
);
this._yamlMode = !this._canShowSchema;
}

Expand Down
25 changes: 13 additions & 12 deletions hassio/src/dialogs/addon/dialog-supervisor-addon-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,25 @@ class DialogSupervisorAddonUpdate extends LitElement {

protected render(): TemplateResult {
return html`
<ha-dialog
.heading="Update ${this.addon.name}"
.open=${this._opened}
scrimClickAction
escapeKeyAction
>
<ha-dialog .open=${this._opened} scrimClickAction escapeKeyAction>
${this._action === null
? html`<div>
Are you sure you want to update this add-on to version
${this.addon.version_latest}?
? html`<slot name="heading">
<h2 id="title" class="header_title">
Update ${this.addon.name}
</h2>
</slot>
<div>
Are you sure you want to update the ${this.addon.name} add-on to
version ${this.addon.version_latest}?
</div>

<ha-settings-row>
<span slot="heading">
Snapshot
</span>
<span slot="description">
Create a snapshot of the add-on before updating
Create a snapshot of the ${this.addon.name} add-on before
updating
</span>
<ha-switch
.checked=${this._createSnapshot}
Expand All @@ -100,8 +101,8 @@ class DialogSupervisorAddonUpdate extends LitElement {
</ha-circular-progress>
<p class="progress-text">
${this._action === "update"
? `Update to version ${this.addon.version_latest} in progress`
: "Creating snapshot in progress"}
? `Updating ${this.addon.name} to version ${this.addon.version_latest}`
: "Creating snapshot of Home Assistant Core"}
</p>`}
${this._error ? html`<p class="error">${this._error}</p>` : ""}
</ha-dialog>
Expand Down
18 changes: 9 additions & 9 deletions hassio/src/dialogs/core/dialog-supervisor-core-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ class DialogSupervisorCoreUpdate extends LitElement {

protected render(): TemplateResult {
return html`
<ha-dialog
.open=${this._opened}
heading="Update Home Assistant Core"
scrimClickAction
escapeKeyAction
>
<ha-dialog .open=${this._opened} scrimClickAction escapeKeyAction>
${this._action === null
? html`<div>
? html`<slot name="heading">
<h2 id="title" class="header_title">
Update Home Assistant Core
</h2>
</slot>
<div>
Are you sure you want to update Home Assistant Core to version
${this.core.version_latest}?
</div>
Expand Down Expand Up @@ -98,8 +98,8 @@ class DialogSupervisorCoreUpdate extends LitElement {
</ha-circular-progress>
<p class="progress-text">
${this._action === "update"
? `Update to version ${this.core.version_latest} in progress`
: "Creating snapshot in progress"}
? `Updating Home Assistant Core to version ${this.core.version_latest}`
: "Creating snapshot of Home Assistant Core"}
</p>`}
${this._error ? html`<p class="error">${this._error}</p>` : ""}
</ha-dialog>
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
"license": "Apache-2.0",
"dependencies": {
"@braintree/sanitize-url": "^5.0.0",
"@codemirror/commands": "^0.17.2",
"@codemirror/gutter": "^0.17.2",
"@codemirror/highlight": "^0.17.2",
"@codemirror/history": "^0.17.2",
"@codemirror/legacy-modes": "^0.17.1",
"@codemirror/search": "^0.17.1",
"@codemirror/state": "^0.17.1",
"@codemirror/stream-parser": "^0.17.1",
"@codemirror/text": "^0.17.2",
"@codemirror/view": "^0.17.7",
"@codemirror/commands": "^0.17.0",
"@codemirror/gutter": "^0.17.0",
"@codemirror/highlight": "^0.17.0",
"@codemirror/history": "^0.17.0",
"@codemirror/legacy-modes": "^0.17.0",
"@codemirror/search": "^0.17.0",
"@codemirror/state": "^0.17.0",
"@codemirror/stream-parser": "^0.17.0",
"@codemirror/text": "^0.17.0",
"@codemirror/view": "^0.17.0",
"@formatjs/intl-getcanonicallocales": "^1.4.6",
"@formatjs/intl-pluralrules": "^3.4.10",
"@fullcalendar/common": "5.1.0",
Expand All @@ -56,8 +56,8 @@
"@material/mwc-tab": "^0.20.0",
"@material/mwc-tab-bar": "^0.20.0",
"@material/top-app-bar": "=9.0.0-canary.1c156d69d.0",
"@mdi/js": "5.6.55",
"@mdi/svg": "5.6.55",
"@mdi/js": "5.9.55",
"@mdi/svg": "5.9.55",
"@polymer/app-layout": "^3.0.2",
"@polymer/app-route": "^3.0.2",
"@polymer/app-storage": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="home-assistant-frontend",
version="20210226.0",
version="20210301.0",
description="The Home Assistant frontend",
url="https://github.com/home-assistant/home-assistant-polymer",
author="The Home Assistant Authors",
Expand Down
3 changes: 2 additions & 1 deletion src/components/device/ha-device-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ import {
import { SubscribeMixin } from "../../mixins/subscribe-mixin";
import { PolymerChangedEvent } from "../../polymer-types";
import { HomeAssistant } from "../../types";
import { HaComboBox } from "../ha-combo-box";
import type { HaComboBox } from "../ha-combo-box";
import "../ha-combo-box";

interface Device {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ha-code-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class HaCodeEditor extends UpdatingElement {
...loaded.historyKeymap,
...loaded.tabKeyBindings,
saveKeyBinding,
]),
] as KeyBinding[]),
loaded.tagExtension(modeTag, this._mode),
loaded.theme,
loaded.Prec.fallback(loaded.highlightStyle),
Expand Down
6 changes: 5 additions & 1 deletion src/components/ha-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ class HaSlider extends PaperSliderClass {
}

_setImmediateValue(newImmediateValue) {
super._setImmediateValue(Math.round(newImmediateValue));
super._setImmediateValue(
this.step >= 1
? Math.round(newImmediateValue)
: Math.round(newImmediateValue * 100) / 100
);
}

_calcStep(value) {
Expand Down
15 changes: 11 additions & 4 deletions src/data/logbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ export const getLogbookMessage = (
case "cold":
case "gas":
case "heat":
case "colightld":
case "moisture":
case "motion":
case "occupancy":
Expand Down Expand Up @@ -246,9 +245,17 @@ export const getLogbookMessage = (
}

case "cover":
return state === "open"
? hass.localize(`${LOGBOOK_LOCALIZE_PATH}.was_opened`)
: hass.localize(`${LOGBOOK_LOCALIZE_PATH}.was_closed`);
switch (state) {
case "open":
return hass.localize(`${LOGBOOK_LOCALIZE_PATH}.was_opened`);
case "opening":
return hass.localize(`${LOGBOOK_LOCALIZE_PATH}.is_opening`);
case "closing":
return hass.localize(`${LOGBOOK_LOCALIZE_PATH}.is_closing`);
case "closed":
return hass.localize(`${LOGBOOK_LOCALIZE_PATH}.was_closed`);
}
break;

case "lock":
if (state === "unlocked") {
Expand Down
5 changes: 5 additions & 0 deletions src/data/zha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ export const reconfigureNode = (
ieee: ieeeAddress,
});

export const refreshTopology = (hass: HomeAssistant): Promise<void> =>
hass.callWS({
type: "zha/topology/update",
});

export const fetchAttributesForCluster = (
hass: HomeAssistant,
ieeeAddress: string,
Expand Down
15 changes: 12 additions & 3 deletions src/entrypoints/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,19 @@ const authProm = isExternal
const connProm = async (auth) => {
try {
const conn = await createConnection({ auth });

// Clear url if we have been able to establish a connection
// Clear auth data from url if we have been able to establish a connection
if (location.search.includes("auth_callback=1")) {
history.replaceState(null, "", location.pathname);
const searchParams = new URLSearchParams(location.search);
// https://github.com/home-assistant/home-assistant-js-websocket/blob/master/lib/auth.ts
// Remove all data from QueryCallbackData type
searchParams.delete("auth_callback");
searchParams.delete("code");
searchParams.delete("state");
history.replaceState(
null,
"",
`${location.pathname}?${searchParams.toString()}`
);
}

return { auth, conn };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ export class HaDeviceActionsZha extends LitElement {
"ui.dialogs.zha_device_info.buttons.clusters"
)}
</mwc-button>
<mwc-button @click=${this._onViewInVisualizationClick}>
${this.hass!.localize(
"ui.dialogs.zha_device_info.buttons.view_in_visualization"
)}
</mwc-button>
<mwc-button class="warning" @click=${this._removeDevice}>
${this.hass!.localize(
"ui.dialogs.zha_device_info.buttons.remove"
Expand All @@ -104,6 +109,13 @@ export class HaDeviceActionsZha extends LitElement {
navigate(this, "/config/zha/add/" + this._zhaDevice!.ieee);
}

private _onViewInVisualizationClick() {
navigate(
this,
"/config/zha/visualization/" + this._zhaDevice!.device_reg_id
);
}

private async _handleZigbeeInfoClicked() {
showZHADeviceZigbeeInfoDialog(this, { device: this._zhaDevice! });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class ZHAConfigDashboardRouter extends HassRouterPage {
el.groupId = this.routeTail.path.substr(1);
} else if (this._currentPage === "device") {
el.ieee = this.routeTail.path.substr(1);
} else if (this._currentPage === "visualization") {
el.zoomedDeviceId = this.routeTail.path.substr(1);
}

const searchParams = new URLSearchParams(window.location.search);
Expand Down
Loading