substitutions: devicename: room_humidifier esphome: name: $devicename platform: ESP8266 board: esp01_1m platformio_options: platform: "espressif8266@2.5.3" upload_speed: 460800 wifi: ssid: !secret ap_name password: !secret ap_password fast_connect: true ap: ssid: "Hotspot $devicename" password: !secret hotspot_password captive_portal: logger: api: password: !secret api_password ota: password: !secret ota_password sensor: - platform: uptime name: "$devicename uptime" output: - platform: template id: fan_output type: float write_action: - if: condition: lambda: return (state < .3); then: - switch.turn_off: mode1 - switch.turn_off: mode2 - switch.turn_off: relay - if: condition: lambda: return ((state > 0) && (state < .4)); then: - switch.turn_on: mode1 - switch.turn_off: mode2 - switch.turn_on: relay - if: condition: lambda: return ((state > 0.4) && (state < .7)); then: - switch.turn_off: mode1 - switch.turn_on: mode2 - switch.turn_on: relay - if: condition: lambda: return (state > 0.7); then: - switch.turn_on: mode1 - switch.turn_on: mode2 - switch.turn_on: relay fan: - platform: speed output: fan_output name: "$devicename fan" id: humidifier binary_sensor: - platform: gpio pin: number: GPIO0 inverted: True filters: - delayed_on_off: 50ms name: "$devicename button" on_click: then: - if: condition: and: - switch.is_on: mode1 - switch.is_on: mode2 then: - fan.turn_off: humidifier - if: condition: and: - switch.is_off: mode1 - switch.is_off: mode2 then: - fan.turn_on: id: humidifier speed: LOW - if: condition: and: - switch.is_on: mode1 - switch.is_off: mode2 then: - fan.turn_on: id: humidifier speed: MEDIUM - if: condition: and: - switch.is_off: mode1 - switch.is_on: mode2 then: - fan.turn_on: id: humidifier speed: HIGH - platform: gpio pin: number: GPIO5 mode: INPUT_PULLUP filters: - delayed_on_off: 100ms name: "$devicename thirst" on_press: - output.turn_off: fan_output - platform: gpio pin: number: GPIO13 mode: INPUT_PULLUP inverted: True filters: - delayed_on_off: 100ms name: "$devicename water" on_press: - output.turn_off: fan_output switch: - platform: gpio pin: number: GPIO12 restore_mode: RESTORE_DEFAULT_OFF id: relay internal: true - platform: gpio id: mode1 pin: number: GPIO4 inverted: True restore_mode: RESTORE_DEFAULT_OFF internal: true - platform: gpio id: mode2 pin: number: GPIO14 inverted: True restore_mode: RESTORE_DEFAULT_OFF internal: true