diff options
| author | manuel <manuel@mausz.at> | 2026-04-09 21:24:45 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2026-04-09 21:24:45 +0200 |
| commit | 0bc9a4c0ee71743089ba75840e5d8b37d7417dc8 (patch) | |
| tree | 4b5c681ee695494eac1a67adc9e6f4b88b7dd2c8 /esphome/config/toiletlight.yaml | |
| parent | 54892fe2de3288c2de175f765c71bc6930d14ad2 (diff) | |
| download | arduino-0bc9a4c0ee71743089ba75840e5d8b37d7417dc8.tar.gz arduino-0bc9a4c0ee71743089ba75840e5d8b37d7417dc8.tar.bz2 arduino-0bc9a4c0ee71743089ba75840e5d8b37d7417dc8.zip | |
Diffstat (limited to 'esphome/config/toiletlight.yaml')
| -rw-r--r-- | esphome/config/toiletlight.yaml | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/esphome/config/toiletlight.yaml b/esphome/config/toiletlight.yaml index 35b968e..cd39e6b 100644 --- a/esphome/config/toiletlight.yaml +++ b/esphome/config/toiletlight.yaml | |||
| @@ -77,7 +77,7 @@ output: | |||
| 77 | pin: GPIO1 | 77 | pin: GPIO1 |
| 78 | frequency: 3900 Hz | 78 | frequency: 3900 Hz |
| 79 | channel: 0 | 79 | channel: 0 |
| 80 | min_power: 0.04 | 80 | min_power: 0.02 |
| 81 | zero_means_zero: true | 81 | zero_means_zero: true |
| 82 | 82 | ||
| 83 | - id: pwm_warm | 83 | - id: pwm_warm |
| @@ -146,31 +146,39 @@ globals: | |||
| 146 | initial_value: '222.0' # 4500K | 146 | initial_value: '222.0' # 4500K |
| 147 | 147 | ||
| 148 | binary_sensor: | 148 | binary_sensor: |
| 149 | - platform: homeassistant | 149 | - platform: gpio |
| 150 | name: "Nightlight enabled from Home Assistant" | 150 | name: "Presence detector" |
| 151 | entity_id: input_boolean.toilet_light_nightlight | 151 | id: presence_detector |
| 152 | on_state_change: | 152 | pin: |
| 153 | number: GPIO10 | ||
| 154 | mode: INPUT_PULLUP | ||
| 155 | inverted: true | ||
| 156 | filters: | ||
| 157 | - delayed_on: 10ms | ||
| 158 | - delayed_off: 10ms | ||
| 159 | on_state: | ||
| 153 | then: | 160 | then: |
| 154 | - if: | 161 | - lambda: 'id(toilet).make_call().set_state(x).perform();' |
| 155 | condition: | 162 | trigger_on_initial_state: true |
| 156 | lambda: 'return x.has_value() && x.value();' | 163 | |
| 157 | then: | 164 | switch: |
| 158 | - lambda: |- | 165 | - platform: template |
| 159 | if (!id(saved_values)) { | 166 | name: "Nightlight" |
| 160 | id(saved_brightness) = id(toilet).current_values.get_brightness(); | 167 | icon: "mdi:lightbulb-night" |
| 161 | id(saved_color_temp) = id(toilet).current_values.get_color_temperature(); | 168 | lambda: 'return id(saved_values);' |
| 162 | id(saved_values) = true; | 169 | turn_on_action: |
| 163 | } | 170 | - lambda: |- |
| 164 | - light.turn_on: | 171 | id(saved_brightness) = id(toilet).current_values.get_brightness(); |
| 165 | id: toilet | 172 | id(saved_color_temp) = id(toilet).current_values.get_color_temperature(); |
| 166 | brightness: 1% | 173 | id(saved_values) = true; |
| 167 | color_temperature: 3000 K | 174 | - light.control: |
| 168 | else: | 175 | id: toilet |
| 169 | - lambda: |- | 176 | brightness: 1% |
| 170 | if (id(saved_values)) { | 177 | color_temperature: 3000 K |
| 171 | auto call = id(toilet).turn_on(); | 178 | turn_off_action: |
| 172 | call.set_brightness(id(saved_brightness)); | 179 | - lambda: |- |
| 173 | call.set_color_temperature(id(saved_color_temp)); | 180 | auto call = id(toilet).make_call(); |
| 174 | call.perform(); | 181 | call.set_brightness(id(saved_brightness)); |
| 175 | id(saved_values) = false; | 182 | call.set_color_temperature(id(saved_color_temp)); |
| 176 | } | 183 | call.perform(); |
| 184 | id(saved_values) = false; | ||
