Skip to content

Commit

Permalink
Bugfix media commands before wifi (#196)
Browse files Browse the repository at this point in the history
* verify device is setup before accessing command queue

* increase setup priority

---------

Co-authored-by: Paulus Schoutsen <[email protected]>
  • Loading branch information
kahrendt and balloob authored Nov 18, 2024
1 parent 34d8600 commit 23c7297
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions esphome/components/nabu/nabu_media_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ esp_err_t NabuMediaPlayer::start_pipeline_(AudioPipelineType type, bool url) {
}

void NabuMediaPlayer::watch_media_commands_() {
if (!this->is_ready()) {
return;
}

MediaCallCommand media_command;
CommandEvent command_event;
esp_err_t err = ESP_OK;
Expand Down Expand Up @@ -335,6 +339,10 @@ void NabuMediaPlayer::set_ducking_reduction(uint8_t decibel_reduction, float dur
}

void NabuMediaPlayer::control(const media_player::MediaPlayerCall &call) {
if (!this->is_ready()) {
return;
}

MediaCallCommand media_command;

if (call.get_announcement().has_value() && call.get_announcement().value()) {
Expand Down
2 changes: 1 addition & 1 deletion esphome/components/nabu/nabu_media_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct VolumeRestoreState {

class NabuMediaPlayer : public Component, public media_player::MediaPlayer {
public:
float get_setup_priority() const override { return esphome::setup_priority::LATE; }
float get_setup_priority() const override { return esphome::setup_priority::PROCESSOR; }
void setup() override;
void loop() override;

Expand Down

0 comments on commit 23c7297

Please sign in to comment.