substitutions:
upper_devicename: venthood
esphome:
name: "vent-hood"
platform: ESP8266
board: d1_mini
logger:
api:
ota:
password: "password123"
wifi:
networks:
- ssid: "your_wifi"
password: "password123"
web_server:
port: 80
text_sensor:
- platform: version
name: ${upper_devicename} ESPHome Version
hide_timestamp: true
- platform: wifi_info
ip_address:
name: ${upper_devicename} IP
icon: mdi:ip-network
ssid:
name: ${upper_devicename} SSID
icon: mdi:wifi
mac_address:
name: "${upper_devicename} MAC"
icon: mdi:identifier
- platform: template
name: ${upper_devicename} Friendly Name
icon: 'mdi:information-outline'
lambda: |-
return {"$upper_devicename"};
- platform: template
name: ${upper_devicename} Uptime
id: uptime_human
icon: mdi:clock-start
sensor:
- platform: uptime
name: ${upper_devicename} Uptime Internal
id: 'upptime'
internal: True
on_raw_value:
then:
- text_sensor.template.publish:
id: uptime_human
state: !lambda |-
int seconds = round(id(upptime).raw_state);
int days = seconds / (24 * 3600);
seconds = seconds % (24 * 3600);
int hours = seconds / 3600;
seconds = seconds % 3600;
int minutes = seconds / 60;
seconds = seconds % 60;
return (
(days ? String(days) + "d " : "") +
(hours ? String(hours) + "h " : "") +
(minutes ? String(minutes) + "m " : "") +
(String(seconds) + "s")
).c_str();
# WiFi Signal sensor.
- platform: wifi_signal
name: ${upper_devicename} WiFi Signal
update_interval: 120s
switch:
- platform: gpio
name: "Relay light"
pin: D3
id: relay4
inverted: true
- platform: gpio
name: "Fan high"
pin: D2
id: relay3
inverted: true
interlock: &interlock_group [relay1, relay2, relay3]
interlock_wait_time: 200ms
- platform: gpio
name: "Fan med"
pin: D4
id: relay2
inverted: true
interlock: *interlock_group
interlock_wait_time: 200ms
- platform: gpio
name: "Fan low"
pin: D5
id: relay1
inverted: true
interlock: *interlock_group
interlock_wait_time: 200ms
# Define binary sensors for momentary buttons
# Using internal pull-up resistors and set to trigger on LOW
binary_sensor:
- platform: gpio
name: "Button Off"
id: Button_Off
pin:
number: TX
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- switch.turn_off: relay1
- switch.turn_off: relay2
- switch.turn_off: relay3
- platform: gpio
name: "Button Fan low"
id: Button_Fan_low
pin:
number: D7
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- switch.turn_on: relay1
- platform: gpio
name: "Button Fan med"
id: Button_Fan_med
pin:
number: D6
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- switch.turn_on: relay2
- platform: gpio
name: "Button Fan high"
id: Button_Fan_high
pin:
number: RX
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- switch.turn_on: relay3
- platform: gpio
name: "Button Light"
id: Button_Light
pin:
number: D1
mode: INPUT_PULLUP
inverted: true
on_press:
then:
- switch.toggle: relay4
button:
- platform: template
name: "light"
id: light
on_press:
then:
- switch.toggle: relay4
- platform: template
name: "high"
id: high
on_press:
then:
- switch.turn_on: relay3
- platform: template
name: "medium"
id: medium
on_press:
then:
- switch.turn_on: relay2
- platform: template
name: "low"
id: low
on_press:
then:
- switch.turn_on: relay1