mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 09:18:00 +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_ANNOUNCEMENT = "announcement"
|
||||||
CONF_MEDIA_FILE = "media_file"
|
CONF_MEDIA_FILE = "media_file"
|
||||||
CONF_PIPELINE = "pipeline"
|
CONF_STREAM = "stream"
|
||||||
CONF_VOLUME_INCREMENT = "volume_increment"
|
CONF_VOLUME_INCREMENT = "volume_increment"
|
||||||
CONF_VOLUME_MIN = "volume_min"
|
CONF_VOLUME_MIN = "volume_min"
|
||||||
CONF_VOLUME_MAX = "volume_max"
|
CONF_VOLUME_MAX = "volume_max"
|
||||||
|
@ -74,8 +74,8 @@ PIPELINE_TYPE_ENUM = {
|
||||||
PlayLocalMediaAction = speaker_ns.class_(
|
PlayLocalMediaAction = speaker_ns.class_(
|
||||||
"PlayLocalMediaAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
"PlayLocalMediaAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
||||||
)
|
)
|
||||||
StopPipelineAction = speaker_ns.class_(
|
StopStreamAction = speaker_ns.class_(
|
||||||
"StopPipelineAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
"StopStreamAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
||||||
)
|
)
|
||||||
DuckingSetAction = speaker_ns.class_(
|
DuckingSetAction = speaker_ns.class_(
|
||||||
"DuckingSetAction", automation.Action, cg.Parented.template(SpeakerMediaPlayer)
|
"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(
|
@automation.register_action(
|
||||||
"speaker_media_player.stop_pipeline",
|
"speaker_media_player.stop_stream",
|
||||||
StopPipelineAction,
|
StopStreamAction,
|
||||||
cv.maybe_simple_value(
|
cv.maybe_simple_value(
|
||||||
{
|
{
|
||||||
cv.GenerateID(): cv.use_id(SpeakerMediaPlayer),
|
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)
|
var = cg.new_Pvariable(action_id, template_arg)
|
||||||
await cg.register_parented(var, config[CONF_ID])
|
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
|
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)
|
TEMPLATABLE_VALUE(AudioPipelineType, pipeline_type)
|
||||||
void play(Ts... x) override {
|
void play(Ts... x) override {
|
||||||
bool announcement = false;
|
bool announcement = false;
|
||||||
|
|
|
@ -15,11 +15,11 @@ esphome:
|
||||||
- media_player.toggle:
|
- media_player.toggle:
|
||||||
- media_player.stop:
|
- media_player.stop:
|
||||||
- speaker_media_player.play_local_media_file: wake_word_trigger_sound
|
- 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:
|
- speaker_media_player.play_local_media_file:
|
||||||
media_file: wake_word_trigger_sound
|
media_file: wake_word_trigger_sound
|
||||||
announcement: true
|
announcement: true
|
||||||
- speaker_media_player.stop_pipeline: announcement
|
- speaker_media_player.stop_stream: announcement
|
||||||
|
|
||||||
wifi:
|
wifi:
|
||||||
ssid: MySSID
|
ssid: MySSID
|
||||||
|
|
Loading…
Reference in a new issue