multiple esphome device updates and new devices
This commit is contained in:
@@ -54,7 +54,7 @@ substitutions:
|
||||
device_name: "esp-downstbathtowelrail"
|
||||
friendly_name: "Downstairs Bathroom Towelrail"
|
||||
description_comment: "Heated Towel Rail, Downstairs Bathroom :: Sonoff Basic"
|
||||
device_area: "Downstairs Bathroom" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant.
|
||||
device_area: "Downstairs Flat" # Allows ESP device to be automatically linked to an 'Area' in Home Assistant.
|
||||
|
||||
# Project Naming
|
||||
project_name: "Sonoff Technologies.Sonoff Basic V1" # Project Details
|
||||
@@ -78,24 +78,27 @@ substitutions:
|
||||
evening_on_default: "1260" # Default in minutes from midnight. Default 21:00 => 1260
|
||||
evening_off_default: "1320" # Default in minutes from midnight. Default 22:00 => 1320 => 1440 is midnight
|
||||
|
||||
#############################################
|
||||
# Included Common Packages
|
||||
# https://esphome.io/components/esphome.html
|
||||
#############################################
|
||||
##########################################################################################
|
||||
# PACKAGES: Included Common Packages
|
||||
# https://esphome.io/components/packages.html
|
||||
##########################################################################################
|
||||
packages:
|
||||
common_wifi: !include
|
||||
file: common/network_common.yaml
|
||||
vars:
|
||||
local_device_name: "${device_name}"
|
||||
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_webportal: !include
|
||||
# file: common/webportal_common.yaml
|
||||
common_mqtt: !include
|
||||
file: common/mqtt_common.yaml
|
||||
vars:
|
||||
local_device_name: "${device_name}"
|
||||
common_sntp: !include
|
||||
file: common/sntp_common.yaml
|
||||
common_general_sensors: !include
|
||||
@@ -122,6 +125,8 @@ esphome:
|
||||
on_boot:
|
||||
priority: 900 # High priority to run after globals are initialized
|
||||
then:
|
||||
# This evaluates if we switch on 4+ times in 20 seconds
|
||||
# If so, just change to on mode permanently.
|
||||
- lambda: |-
|
||||
// 1) Figure out the current time in "seconds from midnight"
|
||||
// using SNTP if available, otherwise current_mins * 60.
|
||||
@@ -159,6 +164,7 @@ esphome:
|
||||
id(boost_timer) = 0; // and reset boost_timer = 0 (for time sync if no sntp)
|
||||
ESP_LOGI("power_cycle", "Boot count=%d => BOOST mode", id(boot_count));
|
||||
}
|
||||
- script.execute: evaluate_relay_state # Check what the relay should be doing straight away
|
||||
|
||||
#############################################
|
||||
# ESP Platform and Framework
|
||||
@@ -218,31 +224,31 @@ globals:
|
||||
# Morning On time (minutes from midnight),
|
||||
- id: morning_on
|
||||
type: int
|
||||
restore_value: False
|
||||
restore_value: true
|
||||
initial_value: "${morning_on_default}"
|
||||
|
||||
# Morning Off time (minutes from midnight),
|
||||
- id: morning_off
|
||||
type: int
|
||||
restore_value: False
|
||||
restore_value: true
|
||||
initial_value: "${morning_off_default}"
|
||||
|
||||
# Evening On time (minutes from midnight),
|
||||
- id: evening_on
|
||||
type: int
|
||||
restore_value: False
|
||||
restore_value: true
|
||||
initial_value: "${evening_on_default}"
|
||||
|
||||
# Evening Off time (minutes from midnight),
|
||||
- id: evening_off
|
||||
type: int
|
||||
restore_value: False
|
||||
restore_value: true
|
||||
initial_value: "${evening_off_default}"
|
||||
|
||||
# Boost Duration (minutes),
|
||||
- id: boost_duration
|
||||
type: int
|
||||
restore_value: False
|
||||
restore_value: true
|
||||
initial_value: "${boost_duration_default}"
|
||||
|
||||
####################################################
|
||||
@@ -254,7 +260,7 @@ globals:
|
||||
####################################################
|
||||
- id: operation_mode
|
||||
type: int
|
||||
restore_value: false
|
||||
restore_value: true
|
||||
initial_value: "2"
|
||||
|
||||
####################################################
|
||||
@@ -446,7 +452,6 @@ text_sensor:
|
||||
lambda: |-
|
||||
int hour = id(morning_off) / 60;
|
||||
int minute = id(morning_off) % 60;
|
||||
// Increase buffer size to 8 just to be safe
|
||||
// Increase to 16 for safety
|
||||
char buff[16];
|
||||
snprintf(buff, sizeof(buff), "%02d:%02d", hour, minute);
|
||||
@@ -461,7 +466,6 @@ text_sensor:
|
||||
lambda: |-
|
||||
int hour = id(evening_on) / 60;
|
||||
int minute = id(evening_on) % 60;
|
||||
// Increase buffer size to 8 just to be safe
|
||||
// Increase to 16 for safety
|
||||
char buff[16];
|
||||
snprintf(buff, sizeof(buff), "%02d:%02d", hour, minute);
|
||||
@@ -476,7 +480,6 @@ text_sensor:
|
||||
lambda: |-
|
||||
int hour = id(evening_off) / 60;
|
||||
int minute = id(evening_off) % 60;
|
||||
// Increase buffer size to 8 just to be safe
|
||||
// Increase to 16 for safety
|
||||
char buff[16];
|
||||
snprintf(buff, sizeof(buff), "%02d:%02d", hour, minute);
|
||||
@@ -584,6 +587,23 @@ button:
|
||||
id(operation_mode) = 3;
|
||||
# 2) immediately re-evaluate relay state
|
||||
- script.execute: evaluate_relay_state
|
||||
- platform: template
|
||||
name: "Default timer settings"
|
||||
id: default_timer_settings_button
|
||||
icon: "mdi:restore"
|
||||
on_press:
|
||||
- lambda: |-
|
||||
// Restore all timing globals to their YAML defaults
|
||||
id(morning_on) = ${morning_on_default};
|
||||
id(morning_off) = ${morning_off_default};
|
||||
id(evening_on) = ${evening_on_default};
|
||||
id(evening_off) = ${evening_off_default};
|
||||
id(boost_duration)= ${boost_duration_default};
|
||||
// Reset mode to TIMER and clear any running boost
|
||||
id(operation_mode)= 2;
|
||||
id(boost_timer) = 0;
|
||||
ESP_LOGI("timer","Default timer settings applied");
|
||||
- script.execute: evaluate_relay_state
|
||||
|
||||
#################################################################################################
|
||||
# SELECT COMPONENT
|
||||
|
Reference in New Issue
Block a user