206 lines
7.0 KiB
Plaintext
206 lines
7.0 KiB
Plaintext
|
|
# This is a generic starter yaml file for
|
|
# espHome, by zorruno 2024
|
|
# <DEVICENAME> would be something like loungefancontroller
|
|
# yaml file would then be esp-loungefancontroller.yaml
|
|
|
|
#############################################
|
|
#############################################
|
|
# TITLE
|
|
# Details of what the device is plus
|
|
# any relevant web links
|
|
#############################################
|
|
#############################################
|
|
|
|
#############################################
|
|
# SECRETS
|
|
# Secrets file is usually at config/secrets.yaml
|
|
# or config/esphome/secrets.yaml
|
|
# depending on your setup with HA
|
|
#############################################
|
|
# SECRETS FILE needs these specific secrets:
|
|
# esp-<DEVICENAME>_api_key
|
|
# esp-<DEVICENAME>_ota_pass
|
|
# esp-<DEVICENAME>_static_ip (Optional)
|
|
# esp-<DEVICENAME>_gateway (Optional)
|
|
# esp-<DEVICENAME>_subnet (Optional)
|
|
#
|
|
# SECRETS FILE needs these generic Secrets:
|
|
# wifi_ssid
|
|
# wifi_password
|
|
# fallback_ap_password
|
|
# mqtt_server
|
|
# mqtt_username
|
|
# mqtt_password
|
|
# web_server_username (Optional)
|
|
# web_server_password (Optional)
|
|
#############################################
|
|
|
|
#############################################
|
|
# VARIABLE SUBSTITUTIONS
|
|
# Give the device a useful name & description here
|
|
# and change values accordingly.
|
|
#############################################
|
|
substitutions:
|
|
device_name: esp-<DEVICENAME>
|
|
friendly_name: "Device friendly name"
|
|
description_comment: "A Description of this device"
|
|
|
|
# if NOT using a secrets file, just replace these with the passwords etc (in quotes)
|
|
api_key: !secret esp-<DEVICENAME>_api_key # unfortunately you can't use substitutions in secrets names
|
|
ota_pass: !secret esp-<DEVICENAME>_ota_pass # unfortunately you can't use substitutions in secrets names
|
|
wifi_ssid: !secret wifi_ssid
|
|
wifi_password: !secret wifi_password
|
|
fallback_ap_password: !secret fallback_ap_password
|
|
|
|
# Add these if we are giving it a static ip, or remove them in the Wifi section
|
|
#static_ip_address: !secret esp-<DEVICENAME>_static_ip
|
|
#static_ip_gateway: !secret esp-<DEVICENAME>_gateway
|
|
#static_ip_subnet: !secret esp-<DEVICENAME>_subnet
|
|
|
|
mqtt_server: !secret mqtt_server
|
|
mqtt_username: !secret mqtt_username
|
|
mqtt_password: !secret mqtt_password
|
|
mqtt_topic: "esphome" # main topic for the mqtt server, call it what you like
|
|
|
|
web_server_username: !secret web_server_username
|
|
web_server_password: !secret web_server_password
|
|
|
|
update_time: 60s # update time for for general temp sensors etc
|
|
|
|
#############################################
|
|
# ESPHome
|
|
# https://esphome.io/components/esphome.html
|
|
#############################################
|
|
esphome:
|
|
name: ${device_name}
|
|
friendly_name: ${friendly_name} # appears as main name on the esphome page in HA
|
|
comment: ${description_comment} # appears as comment on the esphome page in HA
|
|
#min_version: 2024.6.0
|
|
|
|
#############################################
|
|
# ESP Platform and Framework
|
|
# https://esphome.io/components/esp32.html
|
|
#############################################
|
|
esp32:
|
|
board: <ESP-DEVICE>
|
|
framework:
|
|
type: esp-idf # Suggest using the ESP-IDF Framework. Changing from 'arduino' to 'esp-idf' needs a cabled flash to correct partitions
|
|
version: recommended # recommended, latest or dev
|
|
|
|
#############################################
|
|
# ESPHome Logging Enabl
|
|
# https://esphome.io/components/logger.html
|
|
#############################################
|
|
logger:
|
|
level: INFO # INFO Level suggested, or DEBUG for testing
|
|
#baud_rate: 0 #set to 0 for no logging via UART, needed if you are using it for other serial things (eg PZEM)
|
|
#esp8266_store_log_strings_in_flash: false
|
|
#tx_buffer_size: 64
|
|
|
|
#############################################
|
|
# Enable the Home Assistant API
|
|
# https://esphome.io/components/api.html
|
|
#############################################
|
|
api:
|
|
encryption:
|
|
key: ${api_key}
|
|
|
|
#############################################
|
|
# Enable Over the Air Update Capability
|
|
# https://esphome.io/components/ota.html?highlight=ota
|
|
#############################################
|
|
ota:
|
|
- platform: esphome
|
|
password: ${ota_pass}
|
|
|
|
#############################################
|
|
# Safe Mode
|
|
# Safe mode will detect boot loops
|
|
# https://esphome.io/components/safe_mode
|
|
#############################################
|
|
safe_mode:
|
|
|
|
#############################################
|
|
# Wifi Settings
|
|
# https://esphome.io/components/wifi.html
|
|
#
|
|
# Power Save mode (can reduce wifi reliability)
|
|
# NONE (least power saving, Default for ESP8266)
|
|
# LIGHT (Default for ESP32)
|
|
# HIGH (most power saving)
|
|
#############################################
|
|
wifi:
|
|
ssid: ${wifi_ssid}
|
|
password: ${wifi_password}
|
|
#power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode
|
|
#manual_ip: #optional static IP address
|
|
#static_ip: ${static_ip_address}
|
|
#gateway: ${static_ip_gateway}
|
|
#subnet: ${static_ip_subnet}
|
|
ap: # Details for fallback hotspot in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode
|
|
ssid: ${device_name} fallback AP
|
|
password: ${fallback_ap_password}
|
|
ap_timeout: 30min # Time until it brings up fallback AP. default is 1min
|
|
|
|
#############################################
|
|
# Web Portal for display and monitoring
|
|
# Turning this off is probably a good idea to save resources.
|
|
# https://esphome.io/components/web_server.html
|
|
#############################################
|
|
#web_server:
|
|
# port: 80
|
|
# auth:
|
|
# username: ${web_server_username} #probably a good idea to secure it
|
|
# password: ${web_server_password}
|
|
|
|
#############################################
|
|
# MQTT Monitoring
|
|
# https://esphome.io/components/mqtt.html?highlight=mqtt
|
|
# MUST also have api enabled if you enable MQTT
|
|
#############################################
|
|
mqtt:
|
|
broker: ${mqtt_server}
|
|
topic_prefix: ${mqtt_topic}/${device_name}
|
|
username: ${mqtt_username}
|
|
password: ${mqtt_password}
|
|
|
|
#############################################
|
|
# Time Component
|
|
# https://esphome.io/components/time/index.html#time-component
|
|
# Sync with HA Time. Probably not really necessary.
|
|
#############################################
|
|
#time:
|
|
# - platform: homeassistant
|
|
# id: homeassistant_time
|
|
|
|
#############################################
|
|
# Text Sensors
|
|
# https://esphome.io/components/text_sensor/index.html
|
|
#############################################
|
|
text_sensor:
|
|
- platform: version
|
|
name: ${friendly_name} Version
|
|
- platform: wifi_info
|
|
ip_address:
|
|
name: ${friendly_name} IP Address
|
|
|
|
#############################################
|
|
# General Sensors
|
|
# https://esphome.io/components/sensor/index.html
|
|
#############################################
|
|
sensor:
|
|
- platform: uptime # Uptime for this device
|
|
name: ${friendly_name} Uptime
|
|
update_interval: ${update_time}
|
|
- platform: wifi_signal # Wifi Strength
|
|
name: ${friendly_name} Wifi Signal
|
|
update_interval: ${update_time}
|
|
|
|
#############################################
|
|
# Binary Sensors
|
|
# https://esphome.io/components/binary_sensor/index.html
|
|
#############################################
|
|
#binary_sensor:
|
|
|