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

@@ -35,37 +35,26 @@
#############################################
#############################################
#############################################
# SPECIFIC DEVICE VARIABLE SUBSTITUTIONS
# If NOT using a secrets file, just replace these with the passwords etc (in quotes)
#############################################
substitutions:
#############################################
# SPECIFIC DEVICE VARIABLE SUBSTITUTIONS
# If NOT using a secrets file, just replace these with the passwords etc (in quotes)
#############################################
mqtt_timer_topic: "viewroad-commands/masterbath-towelrail" # Topics you will use to change stuff
startup_duration: "120" # Minutes to stay ON in STARTUP mode before reverting to TIMER
devicename: "esp-masterbathtowelrail"
friendly_name: "Master Bathroom Towelrail"
description_comment: "Sonoff Basic controlling ON/OFF/Timer for the Heated Towel Rail in the Master Bathroom"
api_key: !secret esp-masterbathtowelrail_api_key # unfortunately you can't use substitutions inside secrets names
ota_pass: !secret esp-masterbathtowelrail_ota_pass # unfortunately you can't use substitutions inside secrets names
static_ip_address: !secret esp-masterbathtowelrail_ip
update_interval: "60s" # Update time for for general sensors etc.
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: "Main Bathroom" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant.
#############################################
# SYSTEM SPECIFIC VARIABLE SUBSTITUTIONS
# SPECIFIC PROJECT VARIABLE SUBSTITUTIONS
#############################################
timezone: "Pacific/Auckland"
sntp_update_interval: 6h # Set the duration between the sntp service polling
# Network time servers https://www.ntppool.org/zone/@
# Make sure you have some DNS, or use IP addresses only here.
sntp_server_1: !secret ntp_server_1
sntp_server_2: !secret ntp_server_2
sntp_server_3: !secret ntp_server_3
mqtt_timer_topic: "viewroad-commands/masterbath-towelrail" # Topics you will use to change stuff
startup_duration: "120" # Minutes to stay ON in STARTUP mode before reverting to TIMER
#############################################
# Included Common Packages
@@ -76,10 +65,17 @@ packages:
file: common/network_common.yaml
vars:
local_static_ip_address: ${static_ip_address}
local_api_key: ${api_key}
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:
@@ -94,6 +90,7 @@ esphome:
name: ${devicename}
friendly_name: ${friendly_name}
comment: ${description_comment} # Appears on the esphome page in HA
area: "${room}"
on_boot:
priority: 900 # High priority to run after globals are initialized
then:
@@ -147,45 +144,11 @@ esp8266:
# https://esphome.io/components/logger.html
#############################################
logger:
level: DEBUG #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
#############################################
# Real time clock time source for ESPHome
# If it's invalid, we fall back to an internal clock
# https://esphome.io/components/time/index.html
# https://esphome.io/components/time/sntp
#############################################
time:
- platform: sntp
id: sntp_time
# Define the timezone of the device
timezone: "${timezone}"
# Change sync interval from default 5min to 6 hours (or as set in substitutions)
update_interval: "${sntp_update_interval}"
# Set specific sntp servers to use
servers:
- "${sntp_server_1}"
- "${sntp_server_2}"
- "${sntp_server_3}"
# Publish the time the device was last restarted
on_time_sync:
then:
- logger.log: "Synchronised sntp clock"
- text_sensor.template.publish:
id: time_sync
state: "SNTP clock Syncd"
# Update last restart time, but only once.
- if:
condition:
lambda: 'return id(device_last_restart).state == "";'
then:
- text_sensor.template.publish:
id: device_last_restart
state: !lambda 'return id(sntp_time).now().strftime("%a %d %b %Y - %I:%M:%S %p");'
#############################################
# Global Variables for use in automations etc
# https://esphome.io/guides/automations.html?highlight=globals#global-variables
@@ -466,32 +429,6 @@ text_sensor:
return { std::string(buff) };
update_interval: ${update_interval}
######################################################
# Creates a sensor showing when the device was last restarted
# Uptime template sensor, and SNTP are needed
######################################################
- platform: template
name: "Last Restart: ${friendly_name}"
id: device_last_restart
update_interval: ${update_interval}
icon: mdi:clock
entity_category: diagnostic
- platform: template
name: "Time Sync Status"
id: time_sync
update_interval: ${update_interval}
entity_category: diagnostic
- platform: template
name: "Internal Time"
id: time_text
update_interval: ${update_interval}
entity_category: diagnostic
lambda: |-
auto time_text = id(sntp_time).now().strftime("%H:%M:%S - %d-%m-%Y");
return { time_text };
#############################################
# Sensors
# https://esphome.io/components/text_sensor/index.html
@@ -506,7 +443,6 @@ sensor:
lambda: |-
return id(current_mins);
####################################################
# Relay Switch (Sonoff Basic Relay on GPIO12)
####################################################