diff --git a/package.json b/package.json index 8452d18e26..38d22cf82d 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,6 @@ "@material/web": "=1.0.0-pre.16", "@mdi/js": "7.2.96", "@mdi/svg": "7.2.96", - "@polymer/app-layout": "3.1.0", "@polymer/iron-flex-layout": "3.0.1", "@polymer/iron-input": "3.0.1", "@polymer/iron-resizable-behavior": "3.0.1", diff --git a/pyproject.toml b/pyproject.toml index 811c039f25..72d455d5d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20230830.0" +version = "20230831.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" diff --git a/src/components/chart/state-history-chart-line.ts b/src/components/chart/state-history-chart-line.ts index 3474c1eb5b..46243893a3 100644 --- a/src/components/chart/state-history-chart-line.ts +++ b/src/components/chart/state-history-chart-line.ts @@ -137,12 +137,16 @@ export class StateHistoryChartLine extends LitElement { `${context.dataset.label}: ${formatNumber( context.parsed.y, this.hass.locale, - getNumberFormatOptions( - this.hass.states[this.data[context.datasetIndex].entity_id], - this.hass.entities[ - this.data[context.datasetIndex].entity_id - ] - ) + this.data[context.datasetIndex]?.entity_id + ? getNumberFormatOptions( + this.hass.states[ + this.data[context.datasetIndex].entity_id + ], + this.hass.entities[ + this.data[context.datasetIndex].entity_id + ] + ) + : undefined )} ${this.unit}`, }, }, diff --git a/src/components/chart/state-history-charts.ts b/src/components/chart/state-history-charts.ts index b1debf7870..d9dd0d983e 100644 --- a/src/components/chart/state-history-charts.ts +++ b/src/components/chart/state-history-charts.ts @@ -84,8 +84,8 @@ export class StateHistoryCharts extends LitElement { // @ts-ignore @restoreScroll(".container") private _savedScrollPos?: number; - @queryAll("state-history-chart-line, state-history-chart-timeline") - private _charts?: StateHistoryChartLine[] | StateHistoryChartTimeline[]; + @queryAll("state-history-chart-line") + private _charts?: StateHistoryChartLine[]; public resize = (options?: ChartResizeOptions): void => { this._charts?.forEach( diff --git a/src/components/ha-attributes.ts b/src/components/ha-attributes.ts index 80cc25031c..ab277ed726 100644 --- a/src/components/ha-attributes.ts +++ b/src/components/ha-attributes.ts @@ -1,12 +1,19 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + nothing, + PropertyValues, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeAttributeNameDisplay } from "../common/entity/compute_attribute_display"; import { STATE_ATTRIBUTES } from "../data/entity_attributes"; import { haStyle } from "../resources/styles"; import { HomeAssistant } from "../types"; -import "./ha-expansion-panel"; import "./ha-attribute-value"; +import "./ha-expansion-panel"; @customElement("ha-attributes") class HaAttributes extends LitElement { @@ -18,16 +25,30 @@ class HaAttributes extends LitElement { @state() private _expanded = false; + private get _filteredAttributes() { + return this.computeDisplayAttributes( + STATE_ATTRIBUTES.concat( + this.extraFilters ? this.extraFilters.split(",") : [] + ) + ); + } + + protected willUpdate(changedProperties: PropertyValues): void { + if ( + changedProperties.has("extraFilters") || + changedProperties.has("stateObj") + ) { + this.toggleAttribute("empty", this._filteredAttributes.length === 0); + } + } + protected render() { if (!this.stateObj) { return nothing; } - const attributes = this.computeDisplayAttributes( - STATE_ATTRIBUTES.concat( - this.extraFilters ? this.extraFilters.split(",") : [] - ) - ); + const attributes = this._filteredAttributes; + if (attributes.length === 0) { return nothing; } diff --git a/src/data/weather.ts b/src/data/weather.ts index 4efa71b0c7..9e66ada7f3 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -649,11 +649,11 @@ export const getDefaultForecastType = (stateObj: HassEntityBase) => { if (supportsFeature(stateObj, WeatherEntityFeature.FORECAST_DAILY)) { return "daily"; } - if (supportsFeature(stateObj, WeatherEntityFeature.FORECAST_HOURLY)) { - return "hourly"; - } if (supportsFeature(stateObj, WeatherEntityFeature.FORECAST_TWICE_DAILY)) { return "twice_daily"; } + if (supportsFeature(stateObj, WeatherEntityFeature.FORECAST_HOURLY)) { + return "hourly"; + } return undefined; }; diff --git a/src/data/zwave_js.ts b/src/data/zwave_js.ts index bb93308fd0..623516ce59 100644 --- a/src/data/zwave_js.ts +++ b/src/data/zwave_js.ts @@ -404,8 +404,6 @@ export interface RequestedGrant { clientSideAuth: boolean; } -export const nodeStatus = ["unknown", "asleep", "awake", "dead", "alive"]; - export const fetchZwaveNetworkStatus = ( hass: HomeAssistant, device_or_entry_id: { diff --git a/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts b/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts index 9207bda5e9..25a18f810d 100644 --- a/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts +++ b/src/dialogs/more-info/components/climate/ha-more-info-climate-temperature.ts @@ -280,15 +280,21 @@ export class HaMoreInfoClimateTemperature extends LitElement { ); } - const activeModes = this.stateObj.attributes.hvac_modes.filter( - (m) => m !== "off" - ); - if ( supportsTargetTemperature && this._targetTemperature.value != null && this.stateObj.state !== UNAVAILABLE ) { + const heatCoolModes = this.stateObj.attributes.hvac_modes.filter((m) => + ["heat", "cool", "heat_cool"].includes(m) + ); + const sliderMode = + SLIDER_MODES[ + heatCoolModes.length === 1 && ["off", "auto"].includes(mode) + ? heatCoolModes[0] + : mode + ]; + return html`
- + - ${this.hass.localize("state.default.on")} + ${this.hass.formatEntityAttributeValue( + this.stateObj, + "oscillating", + true + )} - + - ${this.hass.localize("state.default.off")} + ${this.hass.formatEntityAttributeValue( + this.stateObj, + "oscillating", + false + )} ` diff --git a/src/dialogs/more-info/controls/more-info-water_heater.ts b/src/dialogs/more-info/controls/more-info-water_heater.ts index 1e59453b45..99269b6e2c 100644 --- a/src/dialogs/more-info/controls/more-info-water_heater.ts +++ b/src/dialogs/more-info/controls/more-info-water_heater.ts @@ -73,10 +73,7 @@ class MoreInfoWaterHeater extends LitElement { ${supportOperationMode && stateObj.attributes.operation_list ? html` - ${this.hass.localize("state.default.on")} + ${this.hass.formatEntityAttributeValue( + stateObj, + "away_mode", + "on" + )} - ${this.hass.localize("state.default.off")} + ${this.hass.formatEntityAttributeValue( + stateObj, + "away_mode", + "off" + )} ` diff --git a/src/dialogs/more-info/controls/more-info-weather.ts b/src/dialogs/more-info/controls/more-info-weather.ts index f7afd68086..123d3ca4de 100644 --- a/src/dialogs/more-info/controls/more-info-weather.ts +++ b/src/dialogs/more-info/controls/more-info-weather.ts @@ -252,7 +252,8 @@ class MoreInfoWeather extends LitElement { ${this._showValue(item.templow) ? this.hass.formatEntityAttributeValue( this.stateObj!, - "templow" + "templow", + item.templow ) : hourly ? "" @@ -262,7 +263,8 @@ class MoreInfoWeather extends LitElement { ${this._showValue(item.temperature) ? this.hass.formatEntityAttributeValue( this.stateObj!, - "temperature" + "temperature", + item.temperature ) : "—"}
diff --git a/src/layouts/ha-app-layout.js b/src/layouts/ha-app-layout.js deleted file mode 100644 index b937574f3b..0000000000 --- a/src/layouts/ha-app-layout.js +++ /dev/null @@ -1,103 +0,0 @@ -/* eslint-plugin-disable lit */ -/** -@license -Copyright (c) 2015 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt -The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt -The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt -Code distributed by Google as part of the polymer project is also -subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -*/ -/* -This code is copied from app-header-layout. -'fullbleed' support is removed as Home Assisstant doesn't use it. -transform: translate(0) is added. -*/ -/* - FIXME(polymer-modulizer): the above comments were extracted - from HTML and may be out of place here. Review them and - then delete this comment! -*/ -import "@polymer/app-layout/app-header-layout/app-header-layout"; -import { html } from "@polymer/polymer/lib/utils/html-tag"; -import "@polymer/polymer/polymer-element"; - -class HaAppLayout extends customElements.get("app-header-layout") { - static get template() { - return html` - - -
- - -
- -
- `; - } -} -customElements.define("ha-app-layout", HaAppLayout); diff --git a/src/onboarding/onboarding-core-config.ts b/src/onboarding/onboarding-core-config.ts index 6306e8ba64..efbaacc5d2 100644 --- a/src/onboarding/onboarding-core-config.ts +++ b/src/onboarding/onboarding-core-config.ts @@ -32,10 +32,6 @@ class OnboardingCoreConfig extends LitElement { private _elevation = "0"; - private _unitSystem: ConfigUpdateValues["unit_system"] = "metric"; - - private _currency: ConfigUpdateValues["currency"] = "EUR"; - private _timeZone: ConfigUpdateValues["time_zone"] = Intl.DateTimeFormat?.().resolvedOptions?.().timeZone; @@ -43,6 +39,10 @@ class OnboardingCoreConfig extends LitElement { @state() private _country?: ConfigUpdateValues["country"]; + private _unitSystem?: ConfigUpdateValues["unit_system"]; + + private _currency?: ConfigUpdateValues["currency"]; + @state() private _error?: string; @state() private _skipCore = false; diff --git a/src/onboarding/onboarding-location.ts b/src/onboarding/onboarding-location.ts index b4b3209a9f..fa5fb385ad 100644 --- a/src/onboarding/onboarding-location.ts +++ b/src/onboarding/onboarding-location.ts @@ -336,7 +336,7 @@ class OnboardingLocation extends LitElement { ); try { this._places = await searchPlaces(address, this.hass, true, 3); - if (this._places?.length === 1) { + if (this._places?.length) { this._highlightedMarker = this._places[0].place_id; this._location = [ Number(this._places[0].lat), diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts index 06e0cad8dc..64d9d0145b 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts @@ -1,4 +1,3 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { css, CSSResultGroup, @@ -16,9 +15,7 @@ import { import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; import { fetchZwaveNodeStatus, - nodeStatus, SecurityClass, - subscribeZwaveNodeStatus, ZWaveJSNodeStatus, } from "../../../../../../data/zwave_js"; import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; @@ -44,21 +41,6 @@ export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { } } - public hassSubscribe(): Array> { - return [ - subscribeZwaveNodeStatus(this.hass, this.device!.id, (message) => { - if (!this._node) { - return; - } - this._node = { - ...this._node, - status: message.status, - ready: message.ready, - }; - }), - ]; - } - protected async _fetchNodeDetails() { if (!this.device) { return; @@ -112,16 +94,6 @@ export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { ${!this._node.is_controller_node ? html` -
- ${this.hass.localize( - "ui.panel.config.zwave_js.device_info.node_status" - )}: - ${this.hass.localize( - `ui.panel.config.zwave_js.node_status.${ - nodeStatus[this._node.status] - }` - )} -
${this.hass.localize( "ui.panel.config.zwave_js.device_info.node_ready" diff --git a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts index 96f69ed914..9e99c11ca7 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts @@ -130,7 +130,7 @@ export class HuiEnergyDevicesGraphCard }, }, }, - elements: { bar: { borderWidth: 1.5, borderRadius: 4 } }, + elements: { bar: { borderWidth: 1, borderRadius: 4 } }, plugins: { tooltip: { mode: "nearest", @@ -292,6 +292,7 @@ export class HuiEnergyDevicesGraphCard }); this._chartData = { + labels: chartData.map((d) => d.y), datasets, }; await this.updateComplete; diff --git a/src/panels/lovelace/tile-features/hui-climate-hvac-modes-tile-feature.ts b/src/panels/lovelace/tile-features/hui-climate-hvac-modes-tile-feature.ts index c04f24c102..55c6b907cf 100644 --- a/src/panels/lovelace/tile-features/hui-climate-hvac-modes-tile-feature.ts +++ b/src/panels/lovelace/tile-features/hui-climate-hvac-modes-tile-feature.ts @@ -121,10 +121,7 @@ class HuiClimateHvacModeTileFeature .value=${this._currentHvacMode} @value-changed=${this._valueChanged} hide-label - .ariaLabel=${this.hass.formatEntityAttributeName( - this.stateObj, - "hvac_mode" - )} + .ariaLabel=${this.hass.localize("ui.card.climate.mode")} style=${styleMap({ "--control-select-color": color, })} diff --git a/src/panels/lovelace/tile-features/hui-water-heater-operation-modes-tile-feature.ts b/src/panels/lovelace/tile-features/hui-water-heater-operation-modes-tile-feature.ts index e537b60401..632b3ecdb5 100644 --- a/src/panels/lovelace/tile-features/hui-water-heater-operation-modes-tile-feature.ts +++ b/src/panels/lovelace/tile-features/hui-water-heater-operation-modes-tile-feature.ts @@ -125,10 +125,7 @@ class HuiWaterHeaterOperationModeTileFeature .value=${this._currentOperationMode} @value-changed=${this._valueChanged} hide-label - .ariaLabel=${this.hass.formatEntityAttributeName( - this.stateObj, - "hvac_mode" - )} + .ariaLabel=${this.hass.localize("ui.card.water_heater.mode")} style=${styleMap({ "--control-select-color": color, })} diff --git a/src/panels/mailbox/ha-panel-mailbox.ts b/src/panels/mailbox/ha-panel-mailbox.ts index 0d0159902e..04c155fde5 100644 --- a/src/panels/mailbox/ha-panel-mailbox.ts +++ b/src/panels/mailbox/ha-panel-mailbox.ts @@ -12,7 +12,6 @@ import { formatDateTime } from "../../common/datetime/format_date_time"; import "../../components/ha-card"; import "../../components/ha-menu-button"; import "../../components/ha-tabs"; -import "../../layouts/ha-app-layout"; import "@polymer/paper-item/paper-item"; import "@polymer/paper-item/paper-item-body"; import "@polymer/paper-tabs/paper-tab"; diff --git a/src/translations/en.json b/src/translations/en.json index 051837943b..0a8d9c6ed7 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -15,8 +15,6 @@ }, "state": { "default": { - "on": "On", - "off": "Off", "unknown": "Unknown", "unavailable": "Unavailable" } @@ -107,8 +105,7 @@ "cooling": "{name} cooling", "high": "high", "low": "low", - "operation": "Operation", - "away_mode": "Away mode" + "mode": "Mode" }, "counter": { "actions": { @@ -228,8 +225,8 @@ "currently": "Currently", "on_off": "On / off", "target_temperature": "Target temperature", - "operation": "Operation", - "away_mode": "Away mode" + "away_mode": "Away mode", + "mode": "Mode" }, "weather": { "attributes": { @@ -1021,7 +1018,9 @@ "climate": { "target_label": "{action} to target", "target": "Target", - "humidity_target": "Humidity target" + "humidity_target": "Humidity target", + "temperature": "Temperature", + "humidity": "Humidity" }, "humidifier": { "target_label": "[%key:ui::dialogs::more_info_control::climate::target_label%]", @@ -3960,7 +3959,6 @@ "device_info": { "zwave_info": "Z-Wave info", "node_id": "ID", - "node_status": "Status", "node_ready": "Ready", "device_config": "Configure", "reinterview_device": "Re-interview", @@ -4067,13 +4065,6 @@ "parameter": "Parameter", "bitmask": "Bitmask" }, - "node_status": { - "unknown": "Unknown", - "asleep": "Asleep", - "awake": "Awake", - "dead": "Dead", - "alive": "Alive" - }, "network_status": { "connected": "Connected", "connecting": "Connecting", diff --git a/yarn.lock b/yarn.lock index 3452e95561..7d662c6dbf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3418,19 +3418,6 @@ __metadata: languageName: node linkType: hard -"@polymer/app-layout@npm:3.1.0": - version: 3.1.0 - resolution: "@polymer/app-layout@npm:3.1.0" - dependencies: - "@polymer/iron-flex-layout": ^3.0.0-pre.26 - "@polymer/iron-media-query": ^3.0.0-pre.26 - "@polymer/iron-resizable-behavior": ^3.0.0-pre.26 - "@polymer/iron-scroll-target-behavior": ^3.0.0-pre.26 - "@polymer/polymer": ^3.0.0 - checksum: 0da7158de7a44db6f25482ef28a75a4a9372706b0d6a0d08f7b45eb4f75d60dd2e769275bf926f986588bc8273545b55f90a68429c6081cb5cb3f16b1e1f9746 - languageName: node - linkType: hard - "@polymer/font-roboto@npm:^3.0.1": version: 3.0.2 resolution: "@polymer/font-roboto@npm:3.0.2" @@ -3548,15 +3535,6 @@ __metadata: languageName: node linkType: hard -"@polymer/iron-media-query@npm:^3.0.0-pre.26": - version: 3.0.1 - resolution: "@polymer/iron-media-query@npm:3.0.1" - dependencies: - "@polymer/polymer": ^3.0.0 - checksum: 15d7c77608925adea02bf12af1f1eb7dd70abc3349bdff88906a3f0fa5bdfe41171bda1b346f9b7ccfd6de9550ac2a34278a74182ce1407097d3972c23984c5e - languageName: node - linkType: hard - "@polymer/iron-menu-behavior@npm:^3.0.0-pre.26": version: 3.0.2 resolution: "@polymer/iron-menu-behavior@npm:3.0.2" @@ -3608,15 +3586,6 @@ __metadata: languageName: node linkType: hard -"@polymer/iron-scroll-target-behavior@npm:^3.0.0-pre.26": - version: 3.0.1 - resolution: "@polymer/iron-scroll-target-behavior@npm:3.0.1" - dependencies: - "@polymer/polymer": ^3.0.0 - checksum: abf2864aee6049b336aa303110a65cd51cda75247b89edc4f21a6b5290062eb19cd8d2d125198354497df53368bbd305b30d9d31475fd327833cd549d83eb7b9 - languageName: node - linkType: hard - "@polymer/iron-selector@npm:^3.0.0-pre.26": version: 3.0.1 resolution: "@polymer/iron-selector@npm:3.0.1" @@ -9679,7 +9648,6 @@ __metadata: "@octokit/plugin-retry": 6.0.0 "@octokit/rest": 20.0.1 "@open-wc/dev-server-hmr": 0.1.4 - "@polymer/app-layout": 3.1.0 "@polymer/iron-flex-layout": 3.0.1 "@polymer/iron-input": 3.0.1 "@polymer/iron-resizable-behavior": 3.0.1