mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 12:56:37 +00:00
Use action instead of selected for select entity row (#23135)
This commit is contained in:
parent
8f4e65d392
commit
fbff95345c
@ -24,7 +24,6 @@ import type { HomeAssistant } from "../../types";
|
|||||||
import { documentationUrl } from "../../util/documentation-url";
|
import { documentationUrl } from "../../util/documentation-url";
|
||||||
import { AssistantSetupStyles } from "./styles";
|
import { AssistantSetupStyles } from "./styles";
|
||||||
import { STEP } from "./voice-assistant-setup-dialog";
|
import { STEP } from "./voice-assistant-setup-dialog";
|
||||||
import { nextRender } from "../../common/util/render-status";
|
|
||||||
|
|
||||||
@customElement("ha-voice-assistant-setup-step-local")
|
@customElement("ha-voice-assistant-setup-step-local")
|
||||||
export class HaVoiceAssistantSetupStepLocal extends LitElement {
|
export class HaVoiceAssistantSetupStepLocal extends LitElement {
|
||||||
@ -253,9 +252,6 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
|
|||||||
this._localTts[0].entity_id,
|
this._localTts[0].entity_id,
|
||||||
this._localStt[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(
|
await this.hass.callService(
|
||||||
@ -337,9 +333,6 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
|
|||||||
this._localStt[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(
|
await this.hass.callService(
|
||||||
"select",
|
"select",
|
||||||
"select_option",
|
"select_option",
|
||||||
|
@ -17,7 +17,6 @@ import type { HomeAssistant } from "../../types";
|
|||||||
import { AssistantSetupStyles } from "./styles";
|
import { AssistantSetupStyles } from "./styles";
|
||||||
import { STEP } from "./voice-assistant-setup-dialog";
|
import { STEP } from "./voice-assistant-setup-dialog";
|
||||||
import { documentationUrl } from "../../util/documentation-url";
|
import { documentationUrl } from "../../util/documentation-url";
|
||||||
import { nextRender } from "../../common/util/render-status";
|
|
||||||
|
|
||||||
@customElement("ha-voice-assistant-setup-step-pipeline")
|
@customElement("ha-voice-assistant-setup-step-pipeline")
|
||||||
export class HaVoiceAssistantSetupStepPipeline extends LitElement {
|
export class HaVoiceAssistantSetupStepPipeline extends LitElement {
|
||||||
@ -241,9 +240,6 @@ export class HaVoiceAssistantSetupStepPipeline extends LitElement {
|
|||||||
wake_word_entity: null,
|
wake_word_entity: null,
|
||||||
wake_word_id: 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(
|
await this.hass.callService(
|
||||||
|
@ -63,7 +63,7 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
|
|||||||
.value=${stateObj.state}
|
.value=${stateObj.state}
|
||||||
.disabled=${stateObj.state === UNAVAILABLE}
|
.disabled=${stateObj.state === UNAVAILABLE}
|
||||||
naturalMenuWidth
|
naturalMenuWidth
|
||||||
@selected=${this._selectedChanged}
|
@action=${this._handleAction}
|
||||||
@click=${stopPropagation}
|
@click=${stopPropagation}
|
||||||
@closed=${stopPropagation}
|
@closed=${stopPropagation}
|
||||||
>
|
>
|
||||||
@ -94,11 +94,13 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _selectedChanged(ev): void {
|
private _handleAction(ev): void {
|
||||||
const stateObj = this.hass!.states[
|
const stateObj = this.hass!.states[
|
||||||
this._config!.entity
|
this._config!.entity
|
||||||
] as InputSelectEntity;
|
] as InputSelectEntity;
|
||||||
|
|
||||||
const option = ev.target.value;
|
const option = ev.target.value;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
option === stateObj.state ||
|
option === stateObj.state ||
|
||||||
!stateObj.attributes.options.includes(option)
|
!stateObj.attributes.options.includes(option)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user