ESPHome
2026.5.0b1
Loading...
Searching...
No Matches
esphome
components
speaker
media_player
automation.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
speaker_media_player.h
"
4
5
#ifdef USE_ESP32
6
7
#include "
esphome/components/audio/audio.h
"
8
#include "
esphome/core/automation.h
"
9
10
namespace
esphome::speaker
{
11
12
template
<
typename
... Ts>
class
PlayOnDeviceMediaAction
:
public
Action
<Ts...>,
public
Parented
<SpeakerMediaPlayer> {
13
TEMPLATABLE_VALUE(
audio::AudioFile
*, audio_file)
14
TEMPLATABLE_VALUE(
bool
, announcement)
15
TEMPLATABLE_VALUE(
bool
, enqueue)
16
void
play
(
const
Ts &...
x
)
override
{
17
this->
parent_
->play_file(this->audio_file_.value(
x
...), this->announcement_.value(
x
...),
18
this->enqueue_.value(
x
...));
19
}
20
};
21
22
}
// namespace esphome::speaker
23
24
#endif
audio.h
esphome::Action
Definition
automation.h:508
esphome::Action< Ts... >::play
virtual void play(const Ts &...x)=0
esphome::Parented
Helper class to easily give an object a parent of type T.
Definition
helpers.h:1861
esphome::Parented< SpeakerMediaPlayer >::parent_
SpeakerMediaPlayer * parent_
Definition
helpers.h:1872
esphome::speaker::PlayOnDeviceMediaAction
Definition
automation.h:12
automation.h
esphome::speaker
Definition
automation.h:8
speaker_media_player.h
esphome::audio::AudioFile
Definition
audio.h:123
x
uint16_t x
Definition
tt21100.cpp:5
Generated by
1.12.0