Skip to content

Commit

Permalink
20241127.4 (#23137)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Dec 4, 2024
2 parents 191feed + dbda1d7 commit 1016c87
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 48 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"lit": "2.8.0",
"lit-html": "2.8.0",
"luxon": "3.5.0",
"marked": "15.0.2",
"marked": "15.0.3",
"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 = "20241127.3"
version = "20241127.4"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
19 changes: 1 addition & 18 deletions src/common/datetime/format_duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const formatDurationDigital = (
duration: HaDurationData
) => formatDigitalDurationMem(locale).format(duration);

export const DURATION_UNITS = ["s", "min", "h", "d"] as const;
export const DURATION_UNITS = ["min", "h", "d"] as const;

type DurationUnit = (typeof DURATION_UNITS)[number];

Expand Down Expand Up @@ -99,14 +99,6 @@ const formatDurationMinuteMem = memoizeOne(
})
);

const formatDurationSecondMem = memoizeOne(
(locale: FrontendLocaleData) =>
new Intl.DurationFormat(locale.language, {
style: "narrow",
secondsDisplay: "always",
})
);

export const formatDuration = (
locale: FrontendLocaleData,
duration: string,
Expand Down Expand Up @@ -146,15 +138,6 @@ export const formatDuration = (
};
return formatDurationMinuteMem(locale).format(input);
}
case "s": {
const seconds = Math.floor(value);
const milliseconds = Math.floor((value - seconds) * 1000);
const input: DurationInput = {
seconds,
milliseconds,
};
return formatDurationSecondMem(locale).format(input);
}
default:
throw new Error("Invalid duration unit");
}
Expand Down
1 change: 0 additions & 1 deletion src/components/ha-badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export class HaBadge extends LitElement {
align-items: flex-start;
padding-inline-start: initial;
text-align: center;
font-family: Roboto;
}
.label {
font-size: 10px;
Expand Down
2 changes: 2 additions & 0 deletions src/data/assist_pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,14 @@ interface PipelineIntentStartEvent extends PipelineEventBase {
data: {
engine: string;
language: string;
prefer_local_intents: boolean;
intent_input: string;
};
}
interface PipelineIntentEndEvent extends PipelineEventBase {
type: "intent-end";
data: {
processed_locally: boolean;
intent_output: ConversationResult;
};
}
Expand Down
8 changes: 7 additions & 1 deletion src/dialogs/more-info/controls/more-info-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "../../../components/buttons/ha-progress-button";
import { UNAVAILABLE } from "../../../data/entity";
import { fileDownload } from "../../../util/file_download";
import { showToast } from "../../../util/toast";
import { slugify } from "../../../common/string/slugify";

class MoreInfoCamera extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
Expand Down Expand Up @@ -69,9 +70,14 @@ class MoreInfoCamera extends LitElement {
throw new Error("No response from API");
}

const contentType = result.headers.get("content-type");
const ext = contentType === "image/png" ? "png" : "jpg";
const date = new Date().toLocaleString();
const filename = `snapshot_${slugify(this.stateObj!.entity_id)}_${date}.${ext}`;

const blob = await result.blob();
const url = window.URL.createObjectURL(blob);
fileDownload(url);
fileDownload(url, filename);
} catch (err) {
this._waiting = false;
button.actionError();
Expand Down
9 changes: 7 additions & 2 deletions src/dialogs/more-info/controls/more-info-media_player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ class MoreInfoMediaPlayer extends LitElement {

static get styles(): CSSResultGroup {
return css`
ha-icon-button[action="turn_off"],
ha-icon-button[action="turn_on"],
ha-slider {
flex-grow: 1;
}
ha-icon-button[action="turn_off"],
ha-icon-button[action="turn_on"] {
margin-inline-end: auto;
margin-right: auto;
margin-left: inherit;
}
.controls {
display: flex;
flex-wrap: wrap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import type { HomeAssistant } from "../../types";
import { documentationUrl } from "../../util/documentation-url";
import { AssistantSetupStyles } from "./styles";
import { STEP } from "./voice-assistant-setup-dialog";
import { nextRender } from "../../common/util/render-status";

@customElement("ha-voice-assistant-setup-step-local")
export class HaVoiceAssistantSetupStepLocal extends LitElement {
Expand Down Expand Up @@ -253,9 +252,6 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
this._localTts[0].entity_id,
this._localStt[0].entity_id
);

// wait a render so the `hui-select-entity-row` is also updated and doesn't undo the select action
await nextRender();
}

await this.hass.callService(
Expand Down Expand Up @@ -337,9 +333,6 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
this._localStt[0].entity_id
);

// wait a render so the `hui-select-entity-row` is also updated and doesn't undo the select action
await nextRender();

await this.hass.callService(
"select",
"select_option",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type { HomeAssistant } from "../../types";
import { AssistantSetupStyles } from "./styles";
import { STEP } from "./voice-assistant-setup-dialog";
import { documentationUrl } from "../../util/documentation-url";
import { nextRender } from "../../common/util/render-status";

@customElement("ha-voice-assistant-setup-step-pipeline")
export class HaVoiceAssistantSetupStepPipeline extends LitElement {
Expand Down Expand Up @@ -241,9 +240,6 @@ export class HaVoiceAssistantSetupStepPipeline extends LitElement {
wake_word_entity: null,
wake_word_id: null,
});

// wait a render so the `hui-select-entity-row` is also updated and doesn't undo the select action
await nextRender();
}

await this.hass.callService(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,18 @@ export class AssistPipelineDebug extends LitElement {
</div>`
: ""}`
: ""}
<div class="row">
<div>Prefer handling locally</div>
<div>
${this.pipelineRun.intent.prefer_local_intents}
</div>
</div>
<div class="row">
<div>Processed locally</div>
<div>
${this.pipelineRun.intent.processed_locally}
</div>
</div>
${dataMinusKeysRender(
this.pipelineRun.intent,
INTENT_DATA
Expand Down
1 change: 1 addition & 0 deletions src/panels/config/zone/ha-config-zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ export class HaConfigZone extends SubscribeMixin(LitElement) {
title: this.hass!.localize("ui.panel.config.zone.confirm_delete"),
dismissText: this.hass!.localize("ui.common.cancel"),
confirmText: this.hass!.localize("ui.common.delete"),
destructive: true,
}))
) {
return false;
Expand Down
6 changes: 4 additions & 2 deletions src/panels/lovelace/entity-rows/hui-select-entity-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
.value=${stateObj.state}
.disabled=${stateObj.state === UNAVAILABLE}
naturalMenuWidth
@selected=${this._selectedChanged}
@action=${this._handleAction}
@click=${stopPropagation}
@closed=${stopPropagation}
>
Expand Down Expand Up @@ -94,11 +94,13 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
`;
}

private _selectedChanged(ev): void {
private _handleAction(ev): void {
const stateObj = this.hass!.states[
this._config!.entity
] as InputSelectEntity;

const option = ev.target.value;

if (
option === stateObj.state ||
!stateObj.attributes.options.includes(option)
Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/views/hui-sections-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
<ha-sortable
group="card"
@item-added=${this._handleCardAdded}
filter="button"
draggable-selector=".card"
.rollback=${false}
>
<div class="create-section-container">
Expand Down
5 changes: 0 additions & 5 deletions test/common/datetime/format_duration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ const LOCALE: FrontendLocaleData = {

describe("formatDuration", () => {
it("works", () => {
assert.strictEqual(formatDuration(LOCALE, "0.5", "s"), "0s 500ms");
assert.strictEqual(formatDuration(LOCALE, "1", "s"), "1s");
assert.strictEqual(formatDuration(LOCALE, "1.1", "s"), "1s 100ms");
assert.strictEqual(formatDuration(LOCALE, "65", "s"), "65s");

assert.strictEqual(formatDuration(LOCALE, "0.25", "min"), "0m 15s");
assert.strictEqual(formatDuration(LOCALE, "0.5", "min"), "0m 30s");
assert.strictEqual(formatDuration(LOCALE, "1", "min"), "1m");
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9646,7 +9646,7 @@ __metadata:
luxon: "npm:3.5.0"
magic-string: "npm:0.30.13"
map-stream: "npm:0.0.7"
marked: "npm:15.0.2"
marked: "npm:15.0.3"
memoize-one: "npm:6.0.0"
node-vibrant: "npm:3.2.1-alpha.1"
object-hash: "npm:3.0.0"
Expand Down Expand Up @@ -11371,12 +11371,12 @@ __metadata:
languageName: node
linkType: hard

"marked@npm:15.0.2":
version: 15.0.2
resolution: "marked@npm:15.0.2"
"marked@npm:15.0.3":
version: 15.0.3
resolution: "marked@npm:15.0.3"
bin:
marked: bin/marked.js
checksum: 10/dde3d918bb3938906d7a874b990cbfb193514a5fef4b41bca102db3b63d50235afb517dd70429525b6e0a5cff43abd827e7bd2b18617f8bd4776db745e75e973
checksum: 10/821c1af0e527b3f6f4684a68802a0fa5e91cd2b0887d0600ce9035896f8b0fbad180a3f8c5be91de25bdc20323abbd674351832c40d48820b6f0d888fd77cd59
languageName: node
linkType: hard

Expand Down

0 comments on commit 1016c87

Please sign in to comment.