Skip to content

Commit

Permalink
20240802.0 (#21562)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Aug 2, 2024
2 parents da75eec + 88718bc commit b368f88
Show file tree
Hide file tree
Showing 18 changed files with 149 additions and 81 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@codemirror/legacy-modes": "6.4.0",
"@codemirror/search": "6.5.6",
"@codemirror/state": "6.4.1",
"@codemirror/view": "6.29.0",
"@codemirror/view": "6.29.1",
"@egjs/hammerjs": "2.0.17",
"@formatjs/intl-datetimeformat": "6.12.5",
"@formatjs/intl-displaynames": "6.6.8",
Expand Down Expand Up @@ -213,14 +213,14 @@
"gulp-rename": "2.0.0",
"gulp-zopfli-green": "6.0.2",
"html-minifier-terser": "7.2.0",
"husky": "9.1.3",
"husky": "9.1.4",
"instant-mocha": "1.5.2",
"jszip": "3.10.1",
"lint-staged": "15.2.7",
"lit-analyzer": "2.0.3",
"lodash.merge": "4.6.2",
"lodash.template": "4.5.0",
"magic-string": "0.30.10",
"magic-string": "0.30.11",
"map-stream": "0.0.7",
"mocha": "10.5.0",
"object-hash": "3.0.0",
Expand Down
39 changes: 1 addition & 38 deletions public/static/icons/ohf.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 = "20240731.0"
version = "20240802.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions src/components/ha-control-number-buttons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ export class HaControlNumberButton extends LitElement {
--control-number-buttons-background-opacity: 0.2;
--control-number-buttons-border-radius: 10px;
--mdc-icon-size: 16px;
height: 40px;
width: 200px;
height: var(--feature-height);
width: 100%;
color: var(--primary-text-color);
-webkit-tap-highlight-color: transparent;
font-style: normal;
Expand Down
42 changes: 38 additions & 4 deletions src/components/ha-selector/ha-selector-template.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { css, html, nothing, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { HomeAssistant } from "../../types";
import { documentationUrl } from "../../util/documentation-url";
import "../ha-code-editor";
import "../ha-input-helper-text";
import "../ha-alert";

const WARNING_STRINGS = [
"template:",
"sensor:",
"state:",
"platform: template",
];

@customElement("ha-selector-template")
export class HaTemplateSelector extends LitElement {
Expand All @@ -19,9 +28,33 @@ export class HaTemplateSelector extends LitElement {

@property({ type: Boolean }) public required = true;

@state() private warn: string | undefined = undefined;

protected render() {
return html`
${this.label ? html`<p>${this.label}${this.required ? "*" : ""}</p>` : ""}
${this.warn
? html`<ha-alert alert-type="warning"
>${this.hass.localize(
"ui.components.selectors.template.yaml_warning",
{ string: this.warn }
)}
<br />
<a
target="_blank"
rel="noopener noreferrer"
href=${documentationUrl(
this.hass,
"/docs/configuration/templating/"
)}
>${this.hass.localize(
"ui.components.selectors.template.learn_more"
)}</a
></ha-alert
>`
: nothing}
${this.label
? html`<p>${this.label}${this.required ? "*" : ""}</p>`
: nothing}
<ha-code-editor
mode="jinja2"
.hass=${this.hass}
Expand All @@ -36,7 +69,7 @@ export class HaTemplateSelector extends LitElement {
></ha-code-editor>
${this.helper
? html`<ha-input-helper-text>${this.helper}</ha-input-helper-text>`
: ""}
: nothing}
`;
}

Expand All @@ -45,6 +78,7 @@ export class HaTemplateSelector extends LitElement {
if (this.value === value) {
return;
}
this.warn = WARNING_STRINGS.find((str) => value.includes(str));
fireEvent(this, "value-changed", { value });
}

Expand Down
4 changes: 4 additions & 0 deletions src/data/conversation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { ensureArray } from "../common/array/ensure-array";
import { HomeAssistant } from "../types";

export const enum ConversationEntityFeature {
CONTROL = 1,
}

interface IntentTarget {
type: "area" | "device" | "entity" | "domain" | "device_class" | "custom";
name: string;
Expand Down
26 changes: 22 additions & 4 deletions src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ import { AudioRecorder } from "../../util/audio-recorder";
import { documentationUrl } from "../../util/documentation-url";
import { showAlertDialog } from "../generic/show-dialog-box";
import { VoiceCommandDialogParams } from "./show-ha-voice-command-dialog";
import { supportsFeature } from "../../common/entity/supports-feature";
import { ConversationEntityFeature } from "../../data/conversation";

interface Message {
who: string;
Expand Down Expand Up @@ -136,6 +138,12 @@ export class HaVoiceCommandDialog extends LitElement {
return nothing;
}

const controlHA = !this._pipeline
? false
: supportsFeature(
this.hass.states[this._pipeline?.conversation_engine],
ConversationEntityFeature.CONTROL
);
const supportsMicrophone = AudioRecorder.isSupported;
const supportsSTT = this._pipeline?.stt_engine;

Expand Down Expand Up @@ -212,6 +220,15 @@ export class HaVoiceCommandDialog extends LitElement {
></ha-icon-button>
</a>
</ha-dialog-header>
${controlHA
? nothing
: html`
<ha-alert>
${this.hass.localize(
"ui.dialogs.voice_command.conversation_no_control"
)}
</ha-alert>
`}
<div class="messages">
<div class="messages-container" id="scroll-container">
${this._conversation!.map(
Expand Down Expand Up @@ -469,10 +486,11 @@ export class HaVoiceCommandDialog extends LitElement {
who: "user",
text: "…",
};
this._audioRecorder.start().then(() => {
this._addMessage(userMessage);
this.requestUpdate("_audioRecorder");
});
await this._audioRecorder.start();

this._addMessage(userMessage);
this.requestUpdate("_audioRecorder");

const hassMessage: Message = {
who: "hass",
text: "…",
Expand Down
12 changes: 10 additions & 2 deletions src/panels/config/entities/entity-registry-settings-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ import {
updateEntityRegistryEntry,
} from "../../../data/entity_registry";
import { entityIcon, entryIcon } from "../../../data/icons";
import { domainToName } from "../../../data/integration";
import {
domainToName,
fetchIntegrationManifest,
} from "../../../data/integration";
import { getNumberDeviceClassConvertibleUnits } from "../../../data/number";
import {
createOptionsFlow,
Expand Down Expand Up @@ -1459,7 +1462,12 @@ export class EntityRegistrySettingsEditor extends LitElement {
}

private async _showOptionsFlow() {
showOptionsFlowDialog(this, this.helperConfigEntry!);
showOptionsFlowDialog(this, this.helperConfigEntry!, {
manifest: await fetchIntegrationManifest(
this.hass,
this.helperConfigEntry!.domain
),
});
}

private _switchAsDomainsSorted = memoizeOne(
Expand Down
6 changes: 5 additions & 1 deletion src/panels/config/helpers/dialog-helper-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ import { createInputDateTime } from "../../../data/input_datetime";
import { createInputNumber } from "../../../data/input_number";
import { createInputSelect } from "../../../data/input_select";
import { createInputText } from "../../../data/input_text";
import { domainToName } from "../../../data/integration";
import {
domainToName,
fetchIntegrationManifest,
} from "../../../data/integration";
import { createSchedule } from "../../../data/schedule";
import { createTimer } from "../../../data/timer";
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
Expand Down Expand Up @@ -325,6 +328,7 @@ export class DialogHelperDetail extends LitElement {
} else {
showConfigFlowDialog(this, {
startFlowHandler: domain,
manifest: await fetchIntegrationManifest(this.hass, domain),
dialogClosedCallback: this._params!.dialogClosedCallback,
});
this.closeDialog();
Expand Down
2 changes: 2 additions & 0 deletions src/panels/config/helpers/ha-config-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import {
import {
IntegrationManifest,
domainToName,
fetchIntegrationManifest,
fetchIntegrationManifests,
} from "../../../data/integration";
import {
Expand Down Expand Up @@ -1026,6 +1027,7 @@ ${rejected
}
showConfigFlowDialog(this, {
startFlowHandler: domain,
manifest: await fetchIntegrationManifest(this.hass, domain),
showAdvanced: this.hass.userData?.showAdvanced,
});
}
Expand Down
2 changes: 2 additions & 0 deletions src/panels/config/script/ha-script-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
getScriptEditorInitData,
getScriptStateConfig,
hasScriptFields,
migrateAutomationAction,
showScriptEditor,
triggerScript,
} from "../../../data/script";
Expand Down Expand Up @@ -487,6 +488,7 @@ export class HaScriptEditor extends KeyboardShortcutMixin(LitElement) {
if (value && !Array.isArray(value)) {
config.sequence = [value];
}
config.sequence = migrateAutomationAction(config.sequence);
return config;
}

Expand Down
2 changes: 1 addition & 1 deletion src/panels/lovelace/components/hui-action-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class HuiActionEditor extends LitElement {
ev.stopPropagation();
const value = {
...this.config!,
perform_action: ev.detail.value.service || "",
perform_action: ev.detail.value.action || "",
data: ev.detail.value.data,
target: ev.detail.value.target || {},
};
Expand Down
Loading

0 comments on commit b368f88

Please sign in to comment.