Created
August 19, 2022 18:37
-
-
Save abobija/d2c6e00401819b3c601065543b81726e to your computer and use it in GitHub Desktop.
Code of humidifier made in https://youtu.be/-uyNXLJjQtI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
device_name: humidifier | |
device_name_verbose: Humidifier | |
esp8266: | |
board: d1_mini | |
esphome: | |
name: ${device_name} | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
fast_connect: true | |
api: | |
password: !secret api_password | |
reboot_timeout: 0s | |
ota: | |
id: over_the_air | |
password: !secret ota_password | |
output: | |
- platform: gpio | |
pin: D1 | |
id: gpio_d1 | |
- platform: template | |
id: humidifier_switch_adapter | |
type: binary | |
write_action: | |
- while: | |
condition: | |
lambda: return id(humidifier_power_status).state != state; | |
then: | |
- output.turn_on: gpio_d1 | |
- delay: 70ms | |
- output.turn_off: gpio_d1 | |
- delay: 70ms | |
switch: | |
- platform: output | |
output: humidifier_switch_adapter | |
name: ${device_name_verbose} Switch | |
id: humidifier_switch | |
binary_sensor: | |
- platform: gpio | |
pin: D2 | |
id: humidifier_power_status | |
internal: true | |
- platform: gpio | |
pin: D5 | |
name: ${device_name_verbose} Touch Sensor | |
id: humidifier_touch_sensor | |
internal: true | |
on_press: | |
- switch.toggle: humidifier_switch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment