summaryrefslogtreecommitdiffstats
path: root/esphome/config
diff options
context:
space:
mode:
Diffstat (limited to 'esphome/config')
-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);'