Fix play media action (#26035)

This commit is contained in:
Paul Bottein 2025-07-02 19:30:06 +02:00 committed by Bram Kragten
parent 1013647249
commit 70c5f77aa7

View File

@ -2,12 +2,19 @@ import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
import { fireEvent } from "../../../../../common/dom/fire_event"; import { fireEvent } from "../../../../../common/dom/fire_event";
import "../../../../../components/ha-selector/ha-selector-media"; import "../../../../../components/ha-selector/ha-selector";
import type { PlayMediaAction } from "../../../../../data/script"; import type { PlayMediaAction } from "../../../../../data/script";
import type { MediaSelectorValue } from "../../../../../data/selector"; import type {
MediaSelectorValue,
Selector,
} from "../../../../../data/selector";
import type { HomeAssistant } from "../../../../../types"; import type { HomeAssistant } from "../../../../../types";
import type { ActionElement } from "../ha-automation-action-row"; import type { ActionElement } from "../ha-automation-action-row";
const MEDIA_SELECTOR_SCHEMA: Selector = {
media: {},
};
@customElement("ha-automation-action-play_media") @customElement("ha-automation-action-play_media")
export class HaPlayMediaAction extends LitElement implements ActionElement { export class HaPlayMediaAction extends LitElement implements ActionElement {
@property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) public hass!: HomeAssistant;
@ -38,12 +45,13 @@ export class HaPlayMediaAction extends LitElement implements ActionElement {
protected render() { protected render() {
return html` return html`
<ha-selector-media <ha-selector
.selector=${MEDIA_SELECTOR_SCHEMA}
.hass=${this.hass} .hass=${this.hass}
.disabled=${this.disabled} .disabled=${this.disabled}
.value=${this._getSelectorValue(this.action)} .value=${this._getSelectorValue(this.action)}
@value-changed=${this._valueChanged} @value-changed=${this._valueChanged}
></ha-selector-media> ></ha-selector>
`; `;
} }