Skip to content

Commit

Permalink
Voice wizard local: Add error message, fix hostname (#23103)
Browse files Browse the repository at this point in the history
Add error message, fix hostname
  • Loading branch information
bramkragten authored Dec 2, 2024
1 parent a0f3e4f commit f4ef4c6
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {

@state() private _detailState?: string;

@state() private _error?: string;

@state() private _localTts?: EntityRegistryDisplayEntry[];

@state() private _localStt?: EntityRegistryDisplayEntry[];
Expand All @@ -62,6 +64,7 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
alt="Casita Home Assistant error logo"
/>
<h1>Failed to install add-ons</h1>
<p>${this._error}</p>
<p>
We could not automatically install a local TTS and STT provider
for you. Read the documentation to learn how to install them.
Expand Down Expand Up @@ -179,8 +182,9 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
}
this._detailState = "Creating assistant";
await this._findEntitiesAndCreatePipeline();
} catch (e) {
} catch (e: any) {
this._state = "ERROR";
this._error = e.message;
}
}

Expand All @@ -199,11 +203,13 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
private async _setupConfigEntry(addon: string) {
const configFlow = await createConfigFlow(this.hass, "wyoming");
const step = await handleConfigFlowStep(this.hass, configFlow.flow_id, {
host: `core_${addon}`,
host: `core-${addon}`,
port: addon === "piper" ? 10200 : 10300,
});
if (step.type !== "create_entry") {
throw new Error("Failed to create entry");
throw new Error(
`Failed to create entry for ${addon}${"errors" in step ? `: ${step.errors.base}` : ""}`
);
}
}

Expand Down Expand Up @@ -321,7 +327,7 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
this._findLocalEntities();
if (!this._localTts?.length || !this._localStt?.length) {
if (tryNo > 3) {
throw new Error("Timeout searching for local TTS and STT entities");
throw new Error("Could not find local TTS and STT entities");
}
await new Promise<void>((resolve) => {
setTimeout(resolve, 2000);
Expand Down

0 comments on commit f4ef4c6

Please sign in to comment.