laundry esphome migration

This commit is contained in:
root
2025-05-30 23:45:16 +12:00
parent b09fb0625b
commit 8bb951dc8f
37 changed files with 3277 additions and 1630 deletions

View File

@@ -30,37 +30,51 @@
# web_server_password (Optional)
#############################################
#############################################
# VARIABLE SUBSTITUTIONS
# Give the device a useful name & description here
# and change values accordingly.
# SPECIFIC DEVICE VARIABLE SUBSTITUTIONS
# If NOT using a secrets file, just replace
# these with the passwords etc (in quotes)
#############################################
substitutions:
device_name: esp-midesklamp1s
friendly_name: "Mi 1S Lamp Office"
description_comment: "Office Desk Lamp with variable white colour temp and rotary encoder for brightness"
# if NOT using a secrets file, just replace these with the passwords etc (in quotes)
api_key: !secret esp-midesklamp1s_api_key # unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-midesklamp1s_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
static_ip_address: !secret esp-midesklamp1s_ip
log_level: "INFO" # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
update_interval: "60s" # update time for for general sensors etc
room: "Office" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant.
# Add these if we are giving it a static ip, or remove them in the Wifi section
#static_ip_address: !secret esp-midesklamp1s_static_ip
#static_ip_gateway: !secret esp-midesklamp1s_gateway
#static_ip_subnet: !secret esp-midesklamp1s_subnet
#############################################
# Included Common Packages
# https://esphome.io/components/esphome.html
#############################################
packages:
common_wifi: !include
file: common/network_common.yaml
vars:
local_static_ip_address: ${static_ip_address}
local_ota_pass: ${ota_pass}
common_api: !include
file: common/api_common.yaml
vars:
local_api_key: ${api_key}
# common_webportal: !include
# file: common/webportal_common.yaml
common_mqtt: !include
file: common/mqtt_common.yaml
common_sntp: !include
file: common/sntp_common.yaml
common_general_sensors: !include
file: common/sensors_common.yaml
vars:
local_friendly_name: ${friendly_name}
local_update_interval: ${update_interval}
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: !remove
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
@@ -70,6 +84,7 @@ 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
area: ${room}
#min_version: 2024.6.0
#############################################
@@ -94,113 +109,25 @@ esp32:
# https://esphome.io/components/logger.html
#############################################
logger:
level: INFO # INFO Level suggested, or DEBUG for testing
level: ${log_level} # 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}
discovery: False # enable entity discovery (true is default)
#discover_ip: True # enable device discovery (true is default)
#############################################
# 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
#time:
# - platform: homeassistant
# id: homeassistant_time
#############################################
# 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}
# Mi Desk Lamp 1S Configuration
- platform: rotary_encoder
id: rotation
@@ -212,7 +139,7 @@ sensor:
- if:
condition:
# Check if Button is pressed while rotating
lambda: "return id(button).state;"
lambda: "return id(pushbutton).state;"
then:
# If Button is pressed, change CW/WW
- lambda: |-
@@ -240,7 +167,7 @@ sensor:
#############################################
binary_sensor:
- platform: gpio
id: button
id: pushbutton
pin:
number: GPIO33
inverted: True