184 lines
4.0 KiB
YAML
184 lines
4.0 KiB
YAML
esphome:
|
|
name: esphome-web-e28960
|
|
friendly_name: Living Room Sensor
|
|
min_version: 2025.5.0
|
|
name_add_mac_suffix: false
|
|
|
|
# Boot sequence - start with WiFi connecting effect
|
|
on_boot:
|
|
- priority: 600
|
|
then:
|
|
- logger.log: "Device booting, starting WiFi connection"
|
|
- light.turn_on:
|
|
id: status_led
|
|
effect: "wifi_connecting"
|
|
|
|
esp32:
|
|
board: esp32-s3-devkitc-1
|
|
framework:
|
|
type: esp-idf
|
|
sdkconfig_options:
|
|
CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
|
|
CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
|
|
CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
|
|
CONFIG_AUDIO_BOARD_CUSTOM: "y"
|
|
|
|
psram:
|
|
mode: octal
|
|
speed: 80MHz
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# UART configuration for LD2420 mmWave sensor
|
|
uart:
|
|
tx_pin: GPIO17
|
|
rx_pin: GPIO16
|
|
baud_rate: 115200
|
|
parity: NONE
|
|
stop_bits: 1
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: "ZGLTCJYjvXIJA0LIP8o/k9Vp+Tia9AhHgXZ/WHCQ1gQ="
|
|
|
|
# API connection event handlers
|
|
on_client_connected:
|
|
- logger.log: "Home Assistant API connected"
|
|
- light.turn_off: status_led
|
|
|
|
on_client_disconnected:
|
|
- logger.log: "Home Assistant API disconnected"
|
|
- light.turn_on:
|
|
id: status_led
|
|
effect: "ha_connecting"
|
|
|
|
# Allow Over-The-Air updates
|
|
ota:
|
|
- platform: esphome
|
|
password: !secret ota_password
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
|
|
# WiFi connection event handlers
|
|
on_connect:
|
|
- logger.log: "WiFi connected, attempting Home Assistant connection"
|
|
- light.turn_on:
|
|
id: status_led
|
|
effect: "ha_connecting"
|
|
|
|
on_disconnect:
|
|
- logger.log: "WiFi disconnected"
|
|
- light.turn_on:
|
|
id: status_led
|
|
effect: "wifi_connecting"
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "Living-Room-Sensor Hotspot"
|
|
password: !secret ota_password
|
|
|
|
# Status LED configuration
|
|
light:
|
|
- platform: esp32_rmt_led_strip
|
|
id: status_led
|
|
name: "Status LED"
|
|
pin: GPIO48
|
|
num_leds: 1
|
|
chipset: ws2812
|
|
rgb_order: GRB
|
|
effects:
|
|
# Yellow blinking during WiFi connection
|
|
- strobe:
|
|
name: "wifi_connecting"
|
|
colors:
|
|
- state: true
|
|
brightness: 80%
|
|
red: 100%
|
|
green: 100%
|
|
blue: 0%
|
|
duration: 500ms
|
|
- state: false
|
|
duration: 500ms
|
|
# Orange blinking during Home Assistant connection
|
|
- strobe:
|
|
name: "ha_connecting"
|
|
colors:
|
|
- state: true
|
|
brightness: 80%
|
|
red: 100%
|
|
green: 65%
|
|
blue: 0%
|
|
duration: 300ms
|
|
- state: false
|
|
duration: 300ms
|
|
|
|
button:
|
|
- platform: restart
|
|
name: "Restart Sensor"
|
|
id: restart_button
|
|
|
|
- platform: ld2420
|
|
apply_config:
|
|
name: Apply Config
|
|
factory_reset:
|
|
name: Factory Reset
|
|
restart_module:
|
|
name: Restart Module
|
|
revert_config:
|
|
name: Undo Edits
|
|
|
|
# DHT-22 Temperature and Humidity Sensor
|
|
sensor:
|
|
- platform: dht
|
|
pin: GPIO4
|
|
model: DHT22
|
|
temperature:
|
|
name: "Living Room Temperature"
|
|
id: living_room_temperature
|
|
humidity:
|
|
name: "Living Room Humidity"
|
|
id: living_room_humidity
|
|
update_interval: 60s
|
|
|
|
- platform: ld2420
|
|
moving_distance:
|
|
name: Moving Distance
|
|
|
|
# LD2420 Presence Sensor
|
|
ld2420:
|
|
|
|
text_sensor:
|
|
- platform: ld2420
|
|
fw_version:
|
|
name: LD2420 Firmware
|
|
|
|
binary_sensor:
|
|
- platform: ld2420
|
|
has_target:
|
|
name: Presence
|
|
|
|
select:
|
|
- platform: ld2420
|
|
operating_mode:
|
|
name: Operating Mode
|
|
|
|
number:
|
|
- platform: ld2420
|
|
presence_timeout:
|
|
name: Detection Presence Timeout
|
|
min_gate_distance:
|
|
name: Detection Gate Minimum
|
|
max_gate_distance:
|
|
name: Detection Gate Maximum
|
|
# See "Number" section below for detail
|
|
gate_select:
|
|
name: Select Gate to Set
|
|
still_threshold:
|
|
name: Set Still Threshold Value
|
|
move_threshold:
|
|
name: Set Move Threshold Value
|