122 lines
2.5 KiB
YAML
122 lines
2.5 KiB
YAML
|
|
substitutions:
|
||
|
|
device_name: laundry-litter-box-camera
|
||
|
|
friendly_name: "Laundry Litter Box Camera"
|
||
|
|
|
||
|
|
esphome:
|
||
|
|
name: ${device_name}
|
||
|
|
friendly_name: ${friendly_name}
|
||
|
|
|
||
|
|
esp32:
|
||
|
|
board: esp32dev
|
||
|
|
framework:
|
||
|
|
type: esp-idf
|
||
|
|
|
||
|
|
logger:
|
||
|
|
|
||
|
|
api:
|
||
|
|
encryption:
|
||
|
|
key: !secret api_encryption_key
|
||
|
|
|
||
|
|
ota:
|
||
|
|
- platform: esphome
|
||
|
|
password: !secret ota_password
|
||
|
|
|
||
|
|
wifi:
|
||
|
|
ssid: !secret wifi_iot_ssid
|
||
|
|
password: !secret wifi_password
|
||
|
|
manual_ip:
|
||
|
|
static_ip: 192.168.69.220
|
||
|
|
gateway: 192.168.69.1
|
||
|
|
subnet: 255.255.255.0
|
||
|
|
ap:
|
||
|
|
ssid: "laundry-litter-cam-fallback"
|
||
|
|
password: !secret fallback_password
|
||
|
|
# Prevents aggressive reconnection attempts
|
||
|
|
power_save_mode: none # Use 'light' for battery devices
|
||
|
|
|
||
|
|
# Slower but more reliable connection
|
||
|
|
fast_connect: true
|
||
|
|
|
||
|
|
# Handle connection failures gracefully
|
||
|
|
on_connect:
|
||
|
|
- logger.log: "Wi-Fi connected!"
|
||
|
|
on_disconnect:
|
||
|
|
- logger.log: "Wi-Fi disconnected!"
|
||
|
|
|
||
|
|
# Reduce mDNS traffic
|
||
|
|
mdns:
|
||
|
|
disabled: true # Set to true if you use static IPs and don't need discovery
|
||
|
|
|
||
|
|
# Diagnostic sensors
|
||
|
|
sensor:
|
||
|
|
- platform: wifi_signal
|
||
|
|
name: "${device_name} WiFi Signal"
|
||
|
|
update_interval: 60s
|
||
|
|
|
||
|
|
- platform: uptime
|
||
|
|
name: "${device_name} Uptime"
|
||
|
|
update_interval: 60s
|
||
|
|
|
||
|
|
text_sensor:
|
||
|
|
- platform: wifi_info
|
||
|
|
ip_address:
|
||
|
|
name: "${device_name} IP Address"
|
||
|
|
ssid:
|
||
|
|
name: "${device_name} Connected SSID"
|
||
|
|
bssid:
|
||
|
|
name: "${device_name} BSSID"
|
||
|
|
|
||
|
|
# Watchdog to auto-reboot if things go wrong
|
||
|
|
interval:
|
||
|
|
- interval: 5min
|
||
|
|
then:
|
||
|
|
- if:
|
||
|
|
condition:
|
||
|
|
and:
|
||
|
|
- lambda: 'return millis() > 300000;' # >5 min uptime
|
||
|
|
- not:
|
||
|
|
wifi.connected:
|
||
|
|
then:
|
||
|
|
- logger.log: "Wi-Fi not connected for 5 min, rebooting..."
|
||
|
|
- delay: 10s
|
||
|
|
- lambda: 'App.safe_reboot();'
|
||
|
|
|
||
|
|
captive_portal:
|
||
|
|
|
||
|
|
i2c:
|
||
|
|
- id: camera_i2c
|
||
|
|
sda: GPIO26
|
||
|
|
scl: GPIO27
|
||
|
|
|
||
|
|
psram:
|
||
|
|
mode: quad
|
||
|
|
speed: 80MHz
|
||
|
|
|
||
|
|
esp32_camera:
|
||
|
|
external_clock:
|
||
|
|
pin: GPIO0
|
||
|
|
frequency: 20MHz
|
||
|
|
i2c_id: camera_i2c
|
||
|
|
data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
|
||
|
|
vsync_pin: GPIO25
|
||
|
|
href_pin: GPIO23
|
||
|
|
pixel_clock_pin: GPIO22
|
||
|
|
power_down_pin: GPIO32
|
||
|
|
resolution: 1024x768
|
||
|
|
jpeg_quality: 15
|
||
|
|
vertical_flip: true
|
||
|
|
horizontal_mirror: false
|
||
|
|
max_framerate: 20 fps
|
||
|
|
idle_framerate: 0.05 fps
|
||
|
|
name: ${device_name}
|
||
|
|
|
||
|
|
esp32_camera_web_server:
|
||
|
|
- port: 8080
|
||
|
|
mode: STREAM
|
||
|
|
- port: 8081
|
||
|
|
mode: SNAPSHOT
|
||
|
|
|
||
|
|
switch:
|
||
|
|
- platform: gpio
|
||
|
|
name: "${device_name}-flash"
|
||
|
|
pin: 4
|