From 6e9320da65863509ac634a2a339ae405f9a802ee Mon Sep 17 00:00:00 2001 From: "firstof9@gmail.com" Date: Wed, 17 Dec 2025 08:38:22 -0700 Subject: [PATCH 1/2] fix: split song scripts between the 2 firmware types --- Integrations/ESPHome/Core.yaml | 85 ---------------------------------- Integrations/ESPHome/H-2.yaml | 8 ++-- Integrations/ESPHome/H-2D.yaml | 84 +++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 89 deletions(-) diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index c4c2a4c..3a1cfe1 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -796,91 +796,6 @@ light: } script: - - id: play_song_1 - then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "RainbowWave" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "RainbowWave" - - rtttl.play: - rtttl: !lambda 'return id(song_1).state;' - - delay: 30s - - light.turn_off: rgb_light - - light.turn_off: logo_light - - script.execute: ShouldSleep - - - id: play_song_2 - then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "TwinklingWhite" - - light.turn_on: - brightness: 80% - id: logo_light - effect: "TwinklingRed" - - rtttl.play: - rtttl: !lambda 'return id(song_2).state;' - - delay: 30s - - light.turn_off: rgb_light - - light.turn_off: logo_light - - script.execute: ShouldSleep - - - id: play_song_3 - then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "RedGreen" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "RedGreen" - - rtttl.play: - rtttl: !lambda 'return id(song_3).state;' - - delay: 30s - - light.turn_off: rgb_light - - light.turn_off: logo_light - - script.execute: ShouldSleep - - - id: play_song_4 - then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "TwinklingBlues" - - light.turn_on: - brightness: 80% - id: logo_light - effect: "TwinklingBlues" - - rtttl.play: - rtttl: !lambda 'return id(song_4).state;' - - delay: 30s - - light.turn_off: rgb_light - - light.turn_off: logo_light - - script.execute: ShouldSleep - - - id: play_song_x - then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "Sandstorm" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "Sandstorm" - - rtttl.play: - rtttl: Sandstorm:d=16,o=6,b=85:e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e, 8e,e,a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e, a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e,a,e, e,e,e,8e,e,d,e - - delay: 30s - - light.turn_off: rgb_light - - light.turn_off: logo_light - - script.execute: ShouldSleep - - id: testScript then: - lambda: "id(runTest) = false;" diff --git a/Integrations/ESPHome/H-2.yaml b/Integrations/ESPHome/H-2.yaml index a854fa5..56fd3bb 100644 --- a/Integrations/ESPHome/H-2.yaml +++ b/Integrations/ESPHome/H-2.yaml @@ -249,7 +249,7 @@ script: else: - deep_sleep.enter: id: deep_sleep_1 - - id: !extend play_song_1 + - id: play_song_1 then: - light.turn_on: brightness: 80% @@ -268,7 +268,7 @@ script: - light.turn_off: logo_light - script.execute: ShouldSleep - - id: !extend play_song_2 + - id: play_song_2 then: - light.turn_on: brightness: 80% @@ -287,7 +287,7 @@ script: - light.turn_off: logo_light - script.execute: ShouldSleep - - id: !extend play_song_3 + - id: play_song_3 then: - light.turn_on: brightness: 80% @@ -306,7 +306,7 @@ script: - light.turn_off: logo_light - script.execute: ShouldSleep - - id: !extend play_song_4 + - id: play_song_4 then: - light.turn_on: brightness: 80% diff --git a/Integrations/ESPHome/H-2D.yaml b/Integrations/ESPHome/H-2D.yaml index 0aff16a..995230f 100644 --- a/Integrations/ESPHome/H-2D.yaml +++ b/Integrations/ESPHome/H-2D.yaml @@ -114,6 +114,90 @@ script: else: - deep_sleep.enter: id: deep_sleep_1 + - id: play_song_1 + then: + - light.turn_on: + brightness: 80% + id: rgb_light + effect: "RainbowWave" + - light.turn_on: + brightness: 60% + id: logo_light + effect: "RainbowWave" + - rtttl.play: + rtttl: !lambda 'return id(song_1).state;' + - delay: 30s + - light.turn_off: rgb_light + - light.turn_off: logo_light + - script.execute: ShouldSleep + + - id: play_song_2 + then: + - light.turn_on: + brightness: 80% + id: rgb_light + effect: "TwinklingWhite" + - light.turn_on: + brightness: 80% + id: logo_light + effect: "TwinklingRed" + - rtttl.play: + rtttl: !lambda 'return id(song_2).state;' + - delay: 30s + - light.turn_off: rgb_light + - light.turn_off: logo_light + - script.execute: ShouldSleep + + - id: play_song_3 + then: + - light.turn_on: + brightness: 80% + id: rgb_light + effect: "RedGreen" + - light.turn_on: + brightness: 60% + id: logo_light + effect: "RedGreen" + - rtttl.play: + rtttl: !lambda 'return id(song_3).state;' + - delay: 30s + - light.turn_off: rgb_light + - light.turn_off: logo_light + - script.execute: ShouldSleep + + - id: play_song_4 + then: + - light.turn_on: + brightness: 80% + id: rgb_light + effect: "TwinklingBlues" + - light.turn_on: + brightness: 80% + id: logo_light + effect: "TwinklingBlues" + - rtttl.play: + rtttl: !lambda 'return id(song_4).state;' + - delay: 30s + - light.turn_off: rgb_light + - light.turn_off: logo_light + - script.execute: ShouldSleep + + - id: play_song_x + then: + - light.turn_on: + brightness: 80% + id: rgb_light + effect: "Sandstorm" + - light.turn_on: + brightness: 60% + id: logo_light + effect: "Sandstorm" + - rtttl.play: + rtttl: Sandstorm:d=16,o=6,b=85:e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e, 8e,e,a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e, a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e,a,e, e,e,e,8e,e,d,e + - delay: 30s + - light.turn_off: rgb_light + - light.turn_off: logo_light + - script.execute: ShouldSleep packages: core: !include Core.yaml \ No newline at end of file From adae7c11e6afee02658840af7c16ec961c283d91 Mon Sep 17 00:00:00 2001 From: "firstof9@gmail.com" Date: Wed, 17 Dec 2025 08:51:23 -0700 Subject: [PATCH 2/2] do not adjust brightness if the lights are already on --- Integrations/ESPHome/H-2.yaml | 165 ++++++++++++++++++++++++++------- Integrations/ESPHome/H-2D.yaml | 162 ++++++++++++++++++++++++-------- 2 files changed, 253 insertions(+), 74 deletions(-) diff --git a/Integrations/ESPHome/H-2.yaml b/Integrations/ESPHome/H-2.yaml index 56fd3bb..ed63bd0 100644 --- a/Integrations/ESPHome/H-2.yaml +++ b/Integrations/ESPHome/H-2.yaml @@ -249,16 +249,33 @@ script: else: - deep_sleep.enter: id: deep_sleep_1 + - id: play_song_1 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "RainbowWave" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "RainbowWave" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 90% + effect: "RainbowWave" + else: + - light.turn_on: + id: rgb_light + effect: "RainbowWave" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 70% + effect: "RainbowWave" + else: + - light.turn_on: + id: logo_light + effect: "RainbowWave" - wifi.disable: - rtttl.play: rtttl: !lambda 'return id(song_1).state;' @@ -270,14 +287,30 @@ script: - id: play_song_2 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "TwinklingWhite" - - light.turn_on: - brightness: 80% - id: logo_light - effect: "TwinklingRed" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 90% + effect: "TwinklingWhite" + else: + - light.turn_on: + id: rgb_light + effect: "TwinklingWhite" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 80% + effect: "TwinklingRed" + else: + - light.turn_on: + id: logo_light + effect: "TwinklingRed" - wifi.disable: - rtttl.play: rtttl: !lambda 'return id(song_2).state;' @@ -289,14 +322,30 @@ script: - id: play_song_3 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "RedGreen" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "RedGreen" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 90% + effect: "RedGreen" + else: + - light.turn_on: + id: rgb_light + effect: "RedGreen" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 70% + effect: "RedGreen" + else: + - light.turn_on: + id: logo_light + effect: "RedGreen" - wifi.disable: - rtttl.play: rtttl: !lambda 'return id(song_3).state;' @@ -308,14 +357,30 @@ script: - id: play_song_4 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "TwinklingBlues" - - light.turn_on: - brightness: 80% - id: logo_light - effect: "TwinklingBlues" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 90% + effect: "TwinklingBlues" + else: + - light.turn_on: + id: rgb_light + effect: "TwinklingBlues" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 80% + effect: "TwinklingBlues" + else: + - light.turn_on: + id: logo_light + effect: "TwinklingBlues" - wifi.disable: - rtttl.play: rtttl: !lambda 'return id(song_4).state;' @@ -323,8 +388,42 @@ script: - delay: 30s - light.turn_off: rgb_light - light.turn_off: logo_light - - script.execute: ShouldSleep + - script.execute: ShouldSleep + - id: play_song_x + then: + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 80% + effect: "Sandstorm" + else: + - light.turn_on: + id: rgb_light + effect: "Sandstorm" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 60% + effect: "Sandstorm" + else: + - light.turn_on: + id: logo_light + effect: "Sandstorm" + - wifi.disable: + - rtttl.play: + rtttl: Sandstorm:d=16,o=6,b=85:e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e, 8e,e,a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e, a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e,a,e, e,e,e,8e,e,d,e + - wifi.enable: + - delay: 30s + - light.turn_off: rgb_light + - light.turn_off: logo_light + - script.execute: ShouldSleep packages: core: !include Core.yaml diff --git a/Integrations/ESPHome/H-2D.yaml b/Integrations/ESPHome/H-2D.yaml index 995230f..859630f 100644 --- a/Integrations/ESPHome/H-2D.yaml +++ b/Integrations/ESPHome/H-2D.yaml @@ -116,14 +116,30 @@ script: id: deep_sleep_1 - id: play_song_1 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "RainbowWave" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "RainbowWave" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 80% + effect: "RainbowWave" + else: + - light.turn_on: + id: rgb_light + effect: "RainbowWave" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 60% + effect: "RainbowWave" + else: + - light.turn_on: + id: logo_light + effect: "RainbowWave" - rtttl.play: rtttl: !lambda 'return id(song_1).state;' - delay: 30s @@ -133,14 +149,30 @@ script: - id: play_song_2 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "TwinklingWhite" - - light.turn_on: - brightness: 80% - id: logo_light - effect: "TwinklingRed" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 80% + effect: "TwinklingWhite" + else: + - light.turn_on: + id: rgb_light + effect: "TwinklingWhite" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 80% + effect: "TwinklingRed" + else: + - light.turn_on: + id: logo_light + effect: "TwinklingRed" - rtttl.play: rtttl: !lambda 'return id(song_2).state;' - delay: 30s @@ -150,14 +182,30 @@ script: - id: play_song_3 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "RedGreen" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "RedGreen" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 80% + effect: "RedGreen" + else: + - light.turn_on: + id: rgb_light + effect: "RedGreen" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 60% + effect: "RedGreen" + else: + - light.turn_on: + id: logo_light + effect: "RedGreen" - rtttl.play: rtttl: !lambda 'return id(song_3).state;' - delay: 30s @@ -167,14 +215,30 @@ script: - id: play_song_4 then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "TwinklingBlues" - - light.turn_on: - brightness: 80% - id: logo_light - effect: "TwinklingBlues" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 80% + effect: "TwinklingBlues" + else: + - light.turn_on: + id: rgb_light + effect: "TwinklingBlues" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 80% + effect: "TwinklingBlues" + else: + - light.turn_on: + id: logo_light + effect: "TwinklingBlues" - rtttl.play: rtttl: !lambda 'return id(song_4).state;' - delay: 30s @@ -184,20 +248,36 @@ script: - id: play_song_x then: - - light.turn_on: - brightness: 80% - id: rgb_light - effect: "Sandstorm" - - light.turn_on: - brightness: 60% - id: logo_light - effect: "Sandstorm" + - if: + condition: + lambda: 'return !id(rgb_light).remote_values.is_on();' + then: + - light.turn_on: + id: rgb_light + brightness: 80% + effect: "Sandstorm" + else: + - light.turn_on: + id: rgb_light + effect: "Sandstorm" + - if: + condition: + lambda: 'return !id(logo_light).remote_values.is_on();' + then: + - light.turn_on: + id: logo_light + brightness: 60% + effect: "Sandstorm" + else: + - light.turn_on: + id: logo_light + effect: "Sandstorm" - rtttl.play: rtttl: Sandstorm:d=16,o=6,b=85:e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e, 8e,e,a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e, a,e,e,e,e,8e,e,d,e,e,e,e,e,8e,e,e,a,a,a,a,g,g,g,d,e,e,e,e,8e,e,a,e, e,e,e,8e,e,d,e - delay: 30s - light.turn_off: rgb_light - light.turn_off: logo_light - - script.execute: ShouldSleep + - script.execute: ShouldSleep packages: core: !include Core.yaml \ No newline at end of file