summaryrefslogtreecommitdiffstats
path: root/esphome
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2026-01-23 11:18:22 +0100
committermanuel <manuel@mausz.at>2026-01-23 11:18:22 +0100
commit4485529f38fb67568bb19f1792016bceffdb4e83 (patch)
tree544623dc943aeda6b79729cb47d82218de81d31f /esphome
parentb012f928b56c0ec224178eee11b4062e3848032d (diff)
downloadarduino-4485529f38fb67568bb19f1792016bceffdb4e83.tar.gz
arduino-4485529f38fb67568bb19f1792016bceffdb4e83.tar.bz2
arduino-4485529f38fb67568bb19f1792016bceffdb4e83.zip
add support for night light mode controlled by HAHEADmaster
Diffstat (limited to 'esphome')
-rw-r--r--esphome/config/toiletlight.yaml36
1 files changed, 36 insertions, 0 deletions
diff --git a/esphome/config/toiletlight.yaml b/esphome/config/toiletlight.yaml
index 68b4f94..1b1de4c 100644
--- a/esphome/config/toiletlight.yaml
+++ b/esphome/config/toiletlight.yaml
@@ -130,3 +130,39 @@ output:
130# accuracy_decimals: 2 130# accuracy_decimals: 2
131# attenuation: auto 131# attenuation: auto
132# update_interval: 1s 132# update_interval: 1s
133
134globals:
135 - id: saved_brightness
136 type: float
137 restore_value: yes
138 initial_value: '1.0'
139 - id: saved_color_temp
140 type: float
141 restore_value: yes
142 initial_value: '222.0' # 4500K
143
144binary_sensor:
145 - platform: homeassistant
146 name: "Nightlight enabled from Home Assistant"
147 entity_id: input_boolean.toilet_light_nightlight
148 on_state_change:
149 then:
150 - if:
151 condition:
152 lambda: 'return x.has_value() && x.value();'
153 then:
154 - globals.set:
155 id: saved_brightness
156 value: !lambda 'return id(toilet).current_values.get_brightness();'
157 - globals.set:
158 id: saved_color_temp
159 value: !lambda 'return id(toilet).current_values.get_color_temperature();'
160 - light.turn_on:
161 id: toilet
162 brightness: 1%
163 color_temperature: 3000 K
164 else:
165 - light.turn_on:
166 id: toilet
167 brightness: !lambda 'return id(saved_brightness);'
168 color_temperature: !lambda 'return id(saved_color_temp);'