mirror of
https://github.com/CeeWeasel/fresh-home.git
synced 2026-08-09 18:40:14 -04:00
158 lines
3.2 KiB
YAML
158 lines
3.2 KiB
YAML
esphome:
|
|
name: test-device-1
|
|
friendly_name: Test Device 1
|
|
|
|
esp32:
|
|
board: esp32dev
|
|
framework:
|
|
type: esp-idf
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: "PySr6PXZw6crnoT/oQJC3hYyVnPlXi2OwF8CAuA1d1U="
|
|
|
|
ota:
|
|
- platform: esphome
|
|
password: "d9ccd2607c37bc67061f8f76971ec953"
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "Test-Device-1 Fallback Hotspot"
|
|
password: "ELfuAtKmRwOC"
|
|
|
|
# For Ultrasonic Sensor
|
|
# trigger_pin: GPIO13
|
|
# echo_pin: GPIO14
|
|
|
|
captive_portal:
|
|
|
|
i2c:
|
|
- id: bus_a
|
|
sda: 21
|
|
scl: 22
|
|
scan: true
|
|
|
|
- id: bus_b
|
|
sda: 32
|
|
scl: 33
|
|
scan: true
|
|
|
|
sensor:
|
|
- platform: ultrasonic
|
|
update_interval: 1s
|
|
trigger_pin: GPIO13
|
|
echo_pin: GPIO14
|
|
name: "Ultrasonic Sensor"
|
|
|
|
# - platform: bme280_i2c
|
|
# i2c_id: bus_a
|
|
# address: 0x76
|
|
# update_interval: 10s
|
|
# temperature:
|
|
# name: "BME280 76A Temperature"
|
|
# pressure:
|
|
# name: "BME280 76A Pressure"
|
|
# humidity:
|
|
# name: "BME280 76A Humidity"
|
|
|
|
# - platform: bme280_i2c
|
|
# i2c_id: bus_b
|
|
# address: 0x76
|
|
# update_interval: 10s
|
|
# temperature:
|
|
# name: "BME280 76B Temperature"
|
|
# pressure:
|
|
# name: "BME280 76B Pressure"
|
|
# humidity:
|
|
# name: "BME280 76B Humidity"
|
|
|
|
- platform: bme680
|
|
i2c_id: bus_a
|
|
temperature:
|
|
name: "BME680 Temperature"
|
|
oversampling: 16x
|
|
pressure:
|
|
name: "BME680 Pressure"
|
|
humidity:
|
|
id: "humidity"
|
|
name: "BME680 Humidity"
|
|
gas_resistance:
|
|
id: "gas_resistance"
|
|
name: "BME680 Gas Resistance"
|
|
address: 0x77
|
|
update_interval: 60s
|
|
- platform: template
|
|
name: "BME680 Indoor Air Quality"
|
|
id: iaq
|
|
icon: "mdi:gauge"
|
|
# calculation: comp_gas = log(R_gas[ohm]) + 0.04 log(Ohm)/%rh * hum[%rh]
|
|
lambda: |-
|
|
return log(id(gas_resistance).state) + 0.04 * id(humidity).state;
|
|
state_class: "measurement"
|
|
|
|
|
|
text_sensor:
|
|
- platform: template
|
|
name: "BME680 IAQ Classification"
|
|
icon: "mdi:checkbox-marked-circle-outline"
|
|
lambda: |-
|
|
if (int(id(iaq).state) <= 50) {
|
|
return {"Excellent"};
|
|
}
|
|
else if (int(id(iaq).state) <= 100) {
|
|
return {"Good"};
|
|
}
|
|
else if (int(id(iaq).state) <= 150) {
|
|
return {"Lightly polluted"};
|
|
}
|
|
else if (int(id(iaq).state) <= 200) {
|
|
return {"Moderately polluted"};
|
|
}
|
|
else if (int(id(iaq).state) <= 250) {
|
|
return {"Heavily polluted"};
|
|
}
|
|
else if (int(id(iaq).state) <= 350) {
|
|
return {"Severely polluted"};
|
|
}
|
|
else if (int(id(iaq).state) <= 500) {
|
|
return {"Extremely polluted"};
|
|
}
|
|
else {
|
|
return {"unknown"};
|
|
}
|
|
|
|
|
|
esp32_touch:
|
|
|
|
|
|
binary_sensor:
|
|
- platform: gpio
|
|
name: "Door"
|
|
device_class: door
|
|
pin:
|
|
number: 16
|
|
mode: INPUT_PULLUP
|
|
inverted: True
|
|
|
|
- platform: gpio
|
|
#threshold: 1000
|
|
name: "Moisture"
|
|
device_class: moisture
|
|
pin:
|
|
number: 12
|
|
mode: INPUT_PULLUP
|
|
inverted: True
|
|
|
|
# - platform: esp32_touch
|
|
# threshold: 1000
|
|
# name: "Moisture"
|
|
# device_class: moisture
|
|
# pin: 14 |