From 0c9a5ac65e79bc569d7baa975626ae6908fe3490 Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Fri, 27 Dec 2024 02:19:59 +0100 Subject: [PATCH] Rebuild tone_volume_change play on volume change IDF v5.3 compatibility --- ...X-Ultimate-Easy-ESPHome_standard_hw_speaker.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_speaker.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_speaker.yaml index 3492af8..a457d99 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_speaker.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_standard_hw_speaker.yaml @@ -60,14 +60,11 @@ number: - speaker.volume_set: id: speaker_embedded volume: !lambda return x/100.0f; - - if: - condition: - - lambda: return x > 0; - - lambda: return "${tone_volume_change}" != "none"; - then: - - rtttl.play: - id: rtttl_speaker - rtttl: "${tone_volume_change}" + - lambda: |- + static const std::string tone_volume_change = "${tone_volume_change}"; + // Play sound if tone_volume_change is not "none" + if (x > 0 and !tone_volume_change.empty() and tone_volume_change != "none") + rtttl_speaker->play(tone_volume_change); rtttl: - id: rtttl_speaker