140 lines
3.2 KiB
YAML
140 lines
3.2 KiB
YAML
substitutions:
|
|
device_name: saturn4-printer-cam
|
|
hostname: "Saturn 4 Printer Cam"
|
|
friendly_name: "Saturn 4 Printer Cam"
|
|
device_description: ESP32-CAM module in Saturn 4 Ultra Resin printer.
|
|
|
|
esphome:
|
|
name: ${device_name}
|
|
friendly_name: ${friendly_name}
|
|
|
|
esp32:
|
|
board: esp32dev
|
|
framework:
|
|
type: esp-idf
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: "3Zxo91fAfA7wpZ4DAYFxGarCRIGQr+0rUJH2taJo7ds="
|
|
|
|
ota:
|
|
- platform: esphome
|
|
password: "d2e50b2ad36ed7de4ecbfd90725765e3"
|
|
|
|
wifi:
|
|
ssid: !secret wifi_iot_ssid
|
|
password: !secret wifi_password
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: "Esp32-Saturn4-Cam"
|
|
password: "klRzTYuqPJXm"
|
|
# 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: false # 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:
|
|
|
|
# Example configuration entry
|
|
i2c:
|
|
- id: camera_i2c
|
|
sda: GPIO26
|
|
scl: GPIO27
|
|
|
|
psram:
|
|
mode: quad
|
|
speed: 80MHz
|
|
|
|
# Flashlight # you can control this flashlight within Homeassistant or mqtt to shine on the birds. use it with an timer!
|
|
output:
|
|
- platform: ledc
|
|
pin: GPIO4
|
|
id: gpio_4
|
|
channel: 2
|
|
|
|
## GPIO_4 is the flash light pin
|
|
light:
|
|
- platform: monochromatic
|
|
output: gpio_4
|
|
name: $hostname light
|
|
restore_mode: RESTORE_AND_OFF
|
|
icon: mdi:flash
|
|
|
|
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: 640x480 # you can use: [1600x1200 , 1280x1024 , 1024x768 , 800x600, 640x480 ] for best performance (FPS) use 1024 of lower resolution.
|
|
jpeg_quality: 12 #The JPEG quality that the camera should encode images with. From 10 (best) to 63 (worst)
|
|
aec2: true
|
|
ae_level: 2
|
|
brightness: 2 #The brightness to apply to the picture, default 0
|
|
contrast: 2
|
|
saturation: -2
|
|
vertical_flip: False
|
|
|
|
# Image settings
|
|
name: ${device_name}
|
|
# ...
|
|
|
|
esp32_camera_web_server:
|
|
- port: 80
|
|
mode: STREAM
|
|
- port: 8080
|
|
mode: SNAPSHOT |