Skip to content

Commit

Permalink
20240104.0 (#19284)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Jan 4, 2024
2 parents b99b132 + 456c011 commit 7ce9a93
Show file tree
Hide file tree
Showing 20 changed files with 124 additions and 46 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"leaflet-draw": "1.0.4",
"lit": "2.8.0",
"luxon": "3.4.4",
"marked": "11.1.0",
"marked": "11.1.1",
"memoize-one": "6.0.0",
"node-vibrant": "3.2.1-alpha.1",
"proxy-polyfill": "0.3.2",
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 = "20240103.3"
version = "20240104.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion src/auth/ha-auth-textfield.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class HaAuthTextField extends HaTextField {
// TODO: live() directive needs casting for lit-analyzer
// https://github.com/runem/lit-analyzer/pull/91/files
// TODO: lit-analyzer labels min/max as (number|string) instead of string
return html` <input
return html`<input
aria-labelledby=${ifDefined(ariaLabelledbyOrUndef)}
aria-controls=${ifDefined(ariaControlsOrUndef)}
aria-describedby=${ifDefined(ariaDescribedbyOrUndef)}
Expand Down
2 changes: 2 additions & 0 deletions src/common/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export const DOMAINS_INPUT_ROW = [
"text",
"time",
"vacuum",
"valve",
];

/** States that we consider "off". */
Expand All @@ -272,6 +273,7 @@ export const DOMAINS_TOGGLE = new Set([
"group",
"automation",
"humidifier",
"valve",
]);

/** Domains that have a dynamic entity image / picture. */
Expand Down
1 change: 1 addition & 0 deletions src/common/entity/get_states.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const FIXED_DOMAIN_STATES = {
timer: ["active", "idle", "paused"],
update: ["on", "off"],
vacuum: ["cleaning", "docked", "error", "idle", "paused", "returning"],
valve: ["closed", "closing", "open", "opening"],
weather: [
"clear-night",
"cloudy",
Expand Down
2 changes: 1 addition & 1 deletion src/components/media-player/ha-media-upload-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class MediaUploadButton extends LitElement {
${this._uploading > 0
? html`
<ha-circular-progress
size="tiny"
size="small"
indeterminate
area-label="Uploading"
slot="icon"
Expand Down
10 changes: 8 additions & 2 deletions src/data/valve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ export const enum ValveEntityFeature {
}

export function isFullyOpen(stateObj: ValveEntity) {
if (stateObj.attributes.current_position !== undefined) {
if (
stateObj.attributes.current_position !== undefined &&
stateObj.attributes.current_position !== null
) {
return stateObj.attributes.current_position === 100;
}
return stateObj.state === "open";
}

export function isFullyClosed(stateObj: ValveEntity) {
if (stateObj.attributes.current_position !== undefined) {
if (
stateObj.attributes.current_position !== undefined &&
stateObj.attributes.current_position !== null
) {
return stateObj.attributes.current_position === 0;
}
return stateObj.state === "closed";
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/repairs/dialog-system-information.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ class DialogSystemInformation extends LitElement {
value = html`
<ha-circular-progress
indeterminate
size="tiny"
size="small"
></ha-circular-progress>
`;
} else if (info.type === "failed") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class AssistPipelineRunDebug extends LitElement {
}

// Play audio when we're done.
if (updatedRun.stage === "done") {
if (updatedRun.stage === "done" && !updatedRun.error) {
const url = updatedRun.tts!.tts_output!.url;
const audio = new Audio(url);
audio.addEventListener("ended", () => {
Expand All @@ -261,7 +261,10 @@ export class AssistPipelineRunDebug extends LitElement {
}
});
audio.play();
} else if (updatedRun.stage === "error") {
} else if (
(updatedRun.stage === "done" && updatedRun.error) ||
updatedRun.stage === "error"
) {
this._finished = true;
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const renderProgress = (
return html`❌`;
}
return html`
<ha-circular-progress size="tiny" indeterminate></ha-circular-progress>
<ha-circular-progress size="small" indeterminate></ha-circular-progress>
`;
}

Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/cards/hui-todo-list-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
const due = item.due
? item.due.includes("T")
? new Date(item.due)
: endOfDay(new Date(item.due))
: endOfDay(new Date(`${item.due}T00:00:00`))
: undefined;
const today =
due && !item.due!.includes("T") && isSameDay(new Date(), due);
Expand Down
3 changes: 3 additions & 0 deletions src/panels/lovelace/common/entity/turn-on-off-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export const turnOnOffEntity = (
case "scene":
service = "turn_on";
break;
case "valve":
service = turnOn ? "open_valve" : "close_valve";
break;
default:
service = turnOn ? "turn_on" : "turn_off";
}
Expand Down
21 changes: 16 additions & 5 deletions src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { stopPropagation } from "../../../../common/dom/stop_propagation";
import { createCloseHeading } from "../../../../components/ha-dialog";
import "../../../../components/ha-icon";
import "../../../../components/ha-select";
import "../../../../components/ha-alert";
import {
fetchConfig,
LovelaceConfig,
Expand Down Expand Up @@ -104,8 +105,15 @@ export class HuiDialogSelectView extends LitElement {
})}
</ha-select>`
: ""}
${this._config
? this._config.views.length > 1
${!this._config || (this._config.views || []).length < 1
? html`<ha-alert alert-type="error"
>${this.hass.localize(
this._config
? "ui.panel.lovelace.editor.select_view.no_views"
: "ui.panel.lovelace.editor.select_view.no_config"
)}</ha-alert
>`
: this._config.views.length > 1
? html`
<mwc-list dialogInitialFocus>
${this._config.views.map(
Expand All @@ -125,16 +133,19 @@ export class HuiDialogSelectView extends LitElement {
)}
</mwc-list>
`
: ""
: html`<div>No config found.</div>`}
: ""}
<mwc-button
slot="secondaryAction"
@click=${this.closeDialog}
dialogInitialFocus
>
${this.hass!.localize("ui.common.cancel")}
</mwc-button>
<mwc-button slot="primaryAction" @click=${this._selectView}>
<mwc-button
slot="primaryAction"
.disabled=${!this._config || (this._config.views || []).length < 1}
@click=${this._selectView}
>
${this._params.actionLabel || this.hass!.localize("ui.common.move")}
</mwc-button>
</ha-dialog>
Expand Down
1 change: 0 additions & 1 deletion src/panels/profile/ha-panel-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ class HaPanelProfile extends LitElement {
max-width: 600px;
margin: 0 auto;
padding-bottom: env(safe-area-inset-bottom);
overflow: hidden;
}
.content > * {
Expand Down
4 changes: 3 additions & 1 deletion src/panels/todo/dialog-todo-item-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ class DialogTodoItemEditor extends LitElement {
this._checked = entry.status === TodoItemStatus.Completed;
this._summary = entry.summary;
this._description = entry.description || "";
this._due = entry.due ? new Date(entry.due) : undefined;
this._hasTime = entry.due?.includes("T") || false;
this._due = entry.due
? new Date(this._hasTime ? entry.due : `${entry.due}T00:00:00`)
: undefined;
} else {
this._hasTime = false;
this._checked = false;
Expand Down
43 changes: 31 additions & 12 deletions src/state-control/climate/ha-state-control-climate-temperature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,20 @@ export class HaStateControlClimateTemperature extends LitElement {

const action = this.stateObj.attributes.hvac_action;

const isTemperatureDisplayed =
(this.stateObj.attributes.current_temperature != null &&
this.showCurrentAsPrimary) ||
((this._supportsTargetTemperature ||
this._supportsTargetTemperatureRange) &&
!this.showCurrentAsPrimary);

return html`
<p class="label">
${action
${action && action !== "off"
? this.hass.formatEntityAttributeValue(this.stateObj, "hvac_action")
: this.hass.formatEntityState(this.stateObj)}
: isTemperatureDisplayed
? this.hass.formatEntityState(this.stateObj)
: nothing}
</p>
`;
}
Expand Down Expand Up @@ -315,6 +324,14 @@ export class HaStateControlClimateTemperature extends LitElement {
`;
}

if (this.stateObj.state !== UNAVAILABLE) {
return html`
<p class="primary-state">
${this.hass.formatEntityState(this.stateObj)}
</p>
`;
}

return nothing;
}

Expand Down Expand Up @@ -373,6 +390,14 @@ export class HaStateControlClimateTemperature extends LitElement {
return html`<p class="label"></p>`;
}

private _renderInfo() {
return html`
<div class="info">
${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()}
</div>
`;
}

get _supportsTargetTemperature() {
return (
supportsFeature(this.stateObj, ClimateEntityFeature.TARGET_TEMPERATURE) &&
Expand Down Expand Up @@ -447,10 +472,7 @@ export class HaStateControlClimateTemperature extends LitElement {
@value-changing=${this._valueChanging}
>
</ha-control-circular-slider>
<div class="info">
${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()}
</div>
${this._renderTemperatureButtons("value")}
${this._renderInfo()} ${this._renderTemperatureButtons("value")}
</div>
`;
}
Expand Down Expand Up @@ -484,9 +506,7 @@ export class HaStateControlClimateTemperature extends LitElement {
@high-changing=${this._valueChanging}
>
</ha-control-circular-slider>
<div class="info">
${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()}
</div>
${this._renderInfo()}
${this._renderTemperatureButtons(this._selectTargetTemperature, true)}
</div>
`;
Expand All @@ -497,6 +517,7 @@ export class HaStateControlClimateTemperature extends LitElement {
class="container${containerSizeClass}"
style=${styleMap({
"--state-color": stateColor,
"--action-color": actionColor,
})}
>
<ha-control-circular-slider
Expand All @@ -510,9 +531,7 @@ export class HaStateControlClimateTemperature extends LitElement {
.disabled=${!active}
>
</ha-control-circular-slider>
<div class="info">
${this._renderLabel()} ${this._renderSecondary()}
</div>
${this._renderInfo()}
</div>
`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,18 @@ export class HaStateControlHumidifierHumidity extends LitElement {

const action = this.stateObj.attributes.action;

const isHumidityDisplayed =
(this.stateObj.attributes.current_humidity != null &&
this.showCurrentAsPrimary) ||
(this._targetHumidity != null && !this.showCurrentAsPrimary);

return html`
<p class="label">
${action
${action && action !== "off"
? this.hass.formatEntityAttributeValue(this.stateObj, "action")
: this.hass.formatEntityState(this.stateObj)}
: isHumidityDisplayed
? this.hass.formatEntityState(this.stateObj)
: nothing}
</p>
`;
}
Expand Down Expand Up @@ -144,6 +151,14 @@ export class HaStateControlHumidifierHumidity extends LitElement {
return this._renderTarget(this._targetHumidity!, "big");
}

if (this.stateObj.state !== UNAVAILABLE) {
return html`
<p class="primary-state">
${this.hass.formatEntityState(this.stateObj)}
</p>
`;
}

return nothing;
}

Expand Down Expand Up @@ -225,6 +240,14 @@ export class HaStateControlHumidifierHumidity extends LitElement {
`;
}

private _renderInfo() {
return html`
<div class="info">
${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()}
</div>
`;
}

protected render() {
const stateColor = stateColorCss(this.stateObj);
const active = stateActive(this.stateObj);
Expand Down Expand Up @@ -272,10 +295,7 @@ export class HaStateControlHumidifierHumidity extends LitElement {
@value-changing=${this._valueChanging}
>
</ha-control-circular-slider>
<div class="info">
${this._renderLabel()}${this._renderPrimary()}${this._renderSecondary()}
</div>
${this._renderButtons()}
${this._renderInfo()} ${this._renderButtons()}
</div>
`;
}
Expand All @@ -284,6 +304,7 @@ export class HaStateControlHumidifierHumidity extends LitElement {
<div
class="container${containerSizeClass}"
style=${styleMap({
"--state-color": stateColor,
"--action-color": actionColor,
})}
>
Expand All @@ -296,9 +317,7 @@ export class HaStateControlHumidifierHumidity extends LitElement {
disabled
>
</ha-control-circular-slider>
<div class="info">
${this._renderLabel()} ${this._renderSecondary()}
</div>
${this._renderInfo()}
</div>
`;
}
Expand Down
Loading

0 comments on commit 7ce9a93

Please sign in to comment.