Skip to content

Commit

Permalink
[nabu] handle urls with https (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
kahrendt committed Sep 16, 2024
1 parent 13f0be0 commit e9e8dc7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions esphome/components/nabu/audio_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

#include "esphome/core/ring_buffer.h"

#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
#include "esp_crt_bundle.h"
#endif

namespace esphome {
namespace nabu {

Expand Down Expand Up @@ -73,6 +77,12 @@ esp_err_t AudioReader::start(const std::string &uri, media_player::MediaFileType
client_config.max_redirection_count = 10;
client_config.buffer_size = 512;
client_config.keep_alive_enable = true;

#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
if (uri.find("https:") != std::string::npos) {
client_config.crt_bundle_attach = esp_crt_bundle_attach;
}
#endif

this->client_ = esp_http_client_init(&client_config);

Expand Down
1 change: 1 addition & 0 deletions esphome/components/nabu/nabu_media_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace esphome {
namespace nabu {

// TODO:
// - Align TLS certification defines with the http_request component
// - Clean up process around playing back local media files
// - Create a registry of media files in Python
// - Add a yaml action to play a specific media file
Expand Down

0 comments on commit e9e8dc7

Please sign in to comment.