mirror of
https://github.com/esphome/esphome.git
synced 2024-12-24 14:34:54 +01:00
rename stop stream action
This commit is contained in:
parent
3c9b7e4513
commit
374cc920f2
3 changed files with 12 additions and 12 deletions
|
@ -38,7 +38,7 @@ CONF_DECIBEL_REDUCTION = "decibel_reduction"
|
|||
|
||||
CONF_ANNOUNCEMENT = "announcement"
|
||||
CONF_MEDIA_FILE = "media_file"
|
||||
CONF_PIPELINE = "pipeline"
|
||||
CONF_STREAM = "stream"
|
||||
CONF_VOLUME_INCREMENT = "volume_increment"
|
||||
CONF_VOLUME_MIN = "volume_min"
|
||||
CONF_VOLUME_MAX = "volume_max"
|
||||
|
@ -74,8 +74,8 @@ PIPELINE_TYPE_ENUM = {
|
|||
PlayLocalMediaAction = speaker_ns.class_(
|
||||
"PlayLocalMediaAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
||||
)
|
||||
StopPipelineAction = speaker_ns.class_(
|
||||
"StopPipelineAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
||||
StopStreamAction = speaker_ns.class_(
|
||||
"StopStreamAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
||||
)
|
||||
DuckingSetAction = speaker_ns.class_(
|
||||
"DuckingSetAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
||||
|
@ -341,20 +341,20 @@ async def play_local_media_media_action(config, action_id, template_arg, args):
|
|||
|
||||
|
||||
@automation.register_action(
|
||||
"speaker_media_player.stop_pipeline",
|
||||
StopPipelineAction,
|
||||
"speaker_media_player.stop_stream",
|
||||
StopStreamAction,
|
||||
cv.maybe_simple_value(
|
||||
{
|
||||
cv.GenerateID(): cv.use_id(SpeakerMediaPlayer),
|
||||
cv.Required(CONF_PIPELINE): cv.enum(PIPELINE_TYPE_ENUM, upper=True),
|
||||
cv.Required(CONF_STREAM): cv.enum(PIPELINE_TYPE_ENUM, upper=True),
|
||||
},
|
||||
key=CONF_PIPELINE,
|
||||
key=CONF_STREAM,
|
||||
),
|
||||
)
|
||||
async def stop_pipeline_action(config, action_id, template_arg, args):
|
||||
async def stop_stream_action(config, action_id, template_arg, args):
|
||||
var = cg.new_Pvariable(action_id, template_arg)
|
||||
await cg.register_parented(var, config[CONF_ID])
|
||||
cg.add(var.set_pipeline_type(config[CONF_PIPELINE]))
|
||||
cg.add(var.set_pipeline_type(config[CONF_STREAM]))
|
||||
return var
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ template<typename... Ts> class PlayLocalMediaAction : public Action<Ts...>, publ
|
|||
}
|
||||
};
|
||||
|
||||
template<typename... Ts> class StopPipelineAction : public Action<Ts...>, public Parented<SpeakerMediaPlayer> {
|
||||
template<typename... Ts> class StopStreamAction : public Action<Ts...>, public Parented<SpeakerMediaPlayer> {
|
||||
TEMPLATABLE_VALUE(AudioPipelineType, pipeline_type)
|
||||
void play(Ts... x) override {
|
||||
bool announcement = false;
|
||||
|
|
|
@ -15,11 +15,11 @@ esphome:
|
|||
- media_player.toggle:
|
||||
- media_player.stop:
|
||||
- speaker_media_player.play_local_media_file: wake_word_trigger_sound
|
||||
- speaker_media_player.stop_pipeline: media
|
||||
- speaker_media_player.stop_stream: media
|
||||
- speaker_media_player.play_local_media_file:
|
||||
media_file: wake_word_trigger_sound
|
||||
announcement: true
|
||||
- speaker_media_player.stop_pipeline: announcement
|
||||
- speaker_media_player.stop_stream: announcement
|
||||
|
||||
wifi:
|
||||
ssid: MySSID
|
||||
|
|
Loading…
Reference in a new issue