summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2026-04-08 00:24:22 +0200
committermanuel <manuel@mausz.at>2026-04-08 00:24:22 +0200
commitbd3d4be315853bd179e33da0b091cf78e79eddae (patch)
tree008f3215dbc321c47466f6d02a9f29c9cb396944
parent4485529f38fb67568bb19f1792016bceffdb4e83 (diff)
downloadarduino-bd3d4be315853bd179e33da0b091cf78e79eddae.tar.gz
arduino-bd3d4be315853bd179e33da0b091cf78e79eddae.tar.bz2
arduino-bd3d4be315853bd179e33da0b091cf78e79eddae.zip
update toilet light control
-rw-r--r--esphome/config/toiletlight.yaml30
1 files changed, 19 insertions, 11 deletions
diff --git a/esphome/config/toiletlight.yaml b/esphome/config/toiletlight.yaml
index 1b1de4c..35b968e 100644
--- a/esphome/config/toiletlight.yaml
+++ b/esphome/config/toiletlight.yaml
@@ -18,7 +18,7 @@ esp32:
18 CONFIG_LOG_DEFAULT_LEVEL_NONE: y 18 CONFIG_LOG_DEFAULT_LEVEL_NONE: y
19 19
20preferences: 20preferences:
21 flash_write_interval: 30s 21 flash_write_interval: 10s
22 22
23# Enable logging 23# Enable logging
24logger: 24logger:
@@ -132,6 +132,10 @@ output:
132# update_interval: 1s 132# update_interval: 1s
133 133
134globals: 134globals:
135 - id: saved_values
136 type: bool
137 restore_value: yes
138 initial_value: 'false'
135 - id: saved_brightness 139 - id: saved_brightness
136 type: float 140 type: float
137 restore_value: yes 141 restore_value: yes
@@ -151,18 +155,22 @@ binary_sensor:
151 condition: 155 condition:
152 lambda: 'return x.has_value() && x.value();' 156 lambda: 'return x.has_value() && x.value();'
153 then: 157 then:
154 - globals.set: 158 - lambda: |-
155 id: saved_brightness 159 if (!id(saved_values)) {
156 value: !lambda 'return id(toilet).current_values.get_brightness();' 160 id(saved_brightness) = id(toilet).current_values.get_brightness();
157 - globals.set: 161 id(saved_color_temp) = id(toilet).current_values.get_color_temperature();
158 id: saved_color_temp 162 id(saved_values) = true;
159 value: !lambda 'return id(toilet).current_values.get_color_temperature();' 163 }
160 - light.turn_on: 164 - light.turn_on:
161 id: toilet 165 id: toilet
162 brightness: 1% 166 brightness: 1%
163 color_temperature: 3000 K 167 color_temperature: 3000 K
164 else: 168 else:
165 - light.turn_on: 169 - lambda: |-
166 id: toilet 170 if (id(saved_values)) {
167 brightness: !lambda 'return id(saved_brightness);' 171 auto call = id(toilet).turn_on();
168 color_temperature: !lambda 'return id(saved_color_temp);' 172 call.set_brightness(id(saved_brightness));
173 call.set_color_temperature(id(saved_color_temp));
174 call.perform();
175 id(saved_values) = false;
176 }