You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.1 KiB
91 lines
2.1 KiB
esphome:
|
|
name: shower
|
|
|
|
esp8266:
|
|
board: nodemcuv2
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
http_request:
|
|
verify_ssl: false
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
password: "4FExAkAyCl"
|
|
|
|
ota:
|
|
- platform: esphome
|
|
password: "4FExAkAyCl"
|
|
|
|
wifi:
|
|
ssid: "5G_Router_37F6E8"
|
|
password: "7rCD6C2F27F7"
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "Shower Fallback Hotspot"
|
|
password: "ZzY1E2eNv819"
|
|
|
|
captive_portal:
|
|
|
|
switch:
|
|
- platform: gpio
|
|
name: "LEDDI"
|
|
pin: GPIO2
|
|
inverted: true
|
|
|
|
web_server:
|
|
port: 80
|
|
|
|
# HW SPI
|
|
spi:
|
|
- id: spi_bus
|
|
clk_pin: D5
|
|
mosi_pin: D7
|
|
miso_pin: D6
|
|
interface: hardware
|
|
|
|
# Global variable for state machine
|
|
globals:
|
|
- id: turned_on_fan
|
|
type: boolean
|
|
initial_value: "false"
|
|
|
|
# BME280 sensor
|
|
sensor:
|
|
- platform: bme280_spi
|
|
|
|
temperature:
|
|
name: "BME280 Temperature"
|
|
id: bme280_temperature
|
|
|
|
humidity:
|
|
name: "BME280 Humidity"
|
|
id: bme280_humidity
|
|
on_value:
|
|
then:
|
|
- if:
|
|
condition:
|
|
lambda: "return ( id(bme280_humidity).state >= 60.0 && !id(turned_on_fan) ); // Humidity reached threshold of 60 % and fan has not been turned on yet"
|
|
then:
|
|
- lambda: |-
|
|
id(turned_on_fan) = true; // This node needs to turn off fan if it was the one that turned it on. Therefore we memorize it.
|
|
- http_request.get:
|
|
url: "http://shelly1pmminig3-54320455c604.local/rpc/Switch.Set?on=true&id=0"
|
|
else:
|
|
- if:
|
|
condition:
|
|
lambda: "return id(bme280_humidity).state <= 50.0 && id(turned_on_fan); // Hysteresis."
|
|
then:
|
|
- lambda: |-
|
|
id(turned_on_fan) = false; // Reset fan.
|
|
- http_request.get:
|
|
url: "http://shelly1pmminig3-54320455c604.local/rpc/Switch.Set?on=false&id=0"
|
|
|
|
pressure:
|
|
name: "BME280 Pressure"
|
|
id: bme280_pressure
|
|
|
|
cs_pin: GPIO4
|
|
update_interval: 10s
|