Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20230831.0 #17756

Merged
merged 13 commits into from
Aug 31, 2023
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
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 10 additions & 6 deletions src/components/chart/state-history-chart-line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/chart/state-history-charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
35 changes: 28 additions & 7 deletions src/components/ha-attributes.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions src/data/weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
2 changes: 0 additions & 2 deletions src/data/zwave_js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
<div
class="container"
Expand All @@ -299,9 +305,7 @@ export class HaMoreInfoClimateTemperature extends LitElement {
>
<ha-control-circular-slider
.inactive=${!active}
.mode=${mode === "off" && activeModes.length === 1
? SLIDER_MODES[activeModes[0]]
: SLIDER_MODES[mode]}
.mode=${sliderMode}
.value=${this._targetTemperature.value}
.min=${this._min}
.max=${this._max}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const moreInfoControlStyle = css`
}

ha-attributes {
display: block;
width: 100%;
}
ha-more-info-control-select-container + ha-attributes:not([empty]) {
margin-top: 16px;
}
`;
9 changes: 3 additions & 6 deletions src/dialogs/more-info/controls/more-info-climate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class MoreInfoClimate extends LitElement {
.selected=${this._mainControl === "temperature"}
.disabled=${this.stateObj!.state === UNAVAILABLE}
.label=${this.hass.localize(
"ui.dialogs.more_info_control.light.color"
"ui.dialogs.more_info_control.climate.temperature"
)}
.control=${"temperature"}
@click=${this._setMainControl}
Expand All @@ -153,7 +153,7 @@ class MoreInfoClimate extends LitElement {
.selected=${this._mainControl === "humidity"}
.disabled=${this.stateObj!.state === UNAVAILABLE}
.label=${this.hass.localize(
"ui.dialogs.more_info_control.light.color_temp"
"ui.dialogs.more_info_control.climate.humidity"
)}
.control=${"humidity"}
@click=${this._setMainControl}
Expand All @@ -166,10 +166,7 @@ class MoreInfoClimate extends LitElement {
</div>
<ha-more-info-control-select-container>
<ha-control-select-menu
.label=${this.hass.formatEntityAttributeName(
this.stateObj,
"hvac_mode"
)}
.label=${this.hass.localize("ui.card.climate.mode")}
.value=${stateObj.state}
.disabled=${this.stateObj.state === UNAVAILABLE}
fixedMenuPosition
Expand Down
22 changes: 16 additions & 6 deletions src/dialogs/more-info/controls/more-info-fan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class MoreInfoFan extends LitElement {
}

_handleOscillating(ev) {
const newVal = ev.target.value === "on";
const newVal = ev.target.value === "true";

this.hass.callService("fan", "oscillate", {
entity_id: this.stateObj!.entity_id,
Expand Down Expand Up @@ -269,7 +269,9 @@ class MoreInfoFan extends LitElement {
this.stateObj,
"oscillating"
)}
.value=${this.stateObj.attributes.oscillating ? "on" : "off"}
.value=${this.stateObj.attributes.oscillating
? "true"
: "false"}
.disabled=${this.stateObj.state === UNAVAILABLE}
fixedMenuPosition
naturalMenuWidth
Expand All @@ -280,19 +282,27 @@ class MoreInfoFan extends LitElement {
slot="icon"
.path=${haOscillatingOff}
></ha-svg-icon>
<ha-list-item value="on" graphic="icon">
<ha-list-item value="true" graphic="icon">
<ha-svg-icon
slot="graphic"
.path=${haOscillating}
></ha-svg-icon>
${this.hass.localize("state.default.on")}
${this.hass.formatEntityAttributeValue(
this.stateObj,
"oscillating",
true
)}
</ha-list-item>
<ha-list-item value="off" graphic="icon">
<ha-list-item value="false" graphic="icon">
<ha-svg-icon
slot="graphic"
.path=${haOscillatingOff}
></ha-svg-icon>
${this.hass.localize("state.default.off")}
${this.hass.formatEntityAttributeValue(
this.stateObj,
"oscillating",
false
)}
</ha-list-item>
</ha-control-select-menu>
`
Expand Down
17 changes: 11 additions & 6 deletions src/dialogs/more-info/controls/more-info-water_heater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ class MoreInfoWaterHeater extends LitElement {
${supportOperationMode && stateObj.attributes.operation_list
? html`
<ha-control-select-menu
.label=${this.hass.formatEntityAttributeName(
stateObj,
"operation"
)}
.label=${this.hass.localize("ui.card.water_heater.mode")}
.value=${stateObj.state}
.disabled=${stateObj.state === UNAVAILABLE}
fixedMenuPosition
Expand Down Expand Up @@ -122,11 +119,19 @@ class MoreInfoWaterHeater extends LitElement {
slot="graphic"
.path=${mdiAccountArrowRight}
></ha-svg-icon>
${this.hass.localize("state.default.on")}
${this.hass.formatEntityAttributeValue(
stateObj,
"away_mode",
"on"
)}
</ha-list-item>
<ha-list-item value="off" graphic="icon">
<ha-svg-icon slot="graphic" .path=${mdiAccount}></ha-svg-icon>
${this.hass.localize("state.default.off")}
${this.hass.formatEntityAttributeValue(
stateObj,
"away_mode",
"off"
)}
</ha-list-item>
</ha-control-select-menu>
`
Expand Down
6 changes: 4 additions & 2 deletions src/dialogs/more-info/controls/more-info-weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ class MoreInfoWeather extends LitElement {
${this._showValue(item.templow)
? this.hass.formatEntityAttributeValue(
this.stateObj!,
"templow"
"templow",
item.templow
)
: hourly
? ""
Expand All @@ -262,7 +263,8 @@ class MoreInfoWeather extends LitElement {
${this._showValue(item.temperature)
? this.hass.formatEntityAttributeValue(
this.stateObj!,
"temperature"
"temperature",
item.temperature
)
: "—"}
</div>
Expand Down
Loading
Loading