Edit esp-gasheater.yaml

This commit is contained in:
ESPHome Device Builder
2026-07-26 18:12:53 +12:00
parent 48af152c79
commit 5b13bc4350
+25 -23
View File
@@ -6,6 +6,8 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-gasheater.yaml
#:########################################################################################:#
# VERSIONS:
# V1.13 2026-07-26 Updated Template Select state reads for ESPHome 2026.7.x.
# Replaced removed `.state` access with `.current_option()`.
# V1.12 2026-06-12 Added managed OFF mode separate from BYPASS (Remote Only).
# OFF is now the normal startup/thermostat-off mode and will
# take over if the heater is locally started via the physical button.
@@ -131,7 +133,7 @@ substitutions:
# Project Naming
project_name: "Sonoff Technologies.Sonoff DEV"
project_version: "v1.12"
project_version: "v1.13"
# Passwords & Secrets
api_key: !secret esp-api_key
@@ -429,7 +431,7 @@ binary_sensor:
on_press:
- lambda: |-
id(last_on_ms) = millis();
if (!id(test_mode_enabled).state && id(mode_select).state == "AUTO") {
if (!id(test_mode_enabled).state && id(mode_select).current_option() == "AUTO") {
id(warmup_until_ms) = millis() + (${warmup_seconds} * 1000UL);
}
# ESPHome does not support Home Assistant's `choose:` action here,
@@ -439,7 +441,7 @@ binary_sensor:
# OFF mode watches for local physical heater starts.
# If someone presses the real heater ON button, the LEDs come on, this
# powered_state turns ON, and ESPHome changes to AUTO and takes over.
lambda: 'return !id(test_mode_enabled).state && id(mode_select).state == "OFF" && !id(self_power_on);'
lambda: 'return !id(test_mode_enabled).state && id(mode_select).current_option() == "OFF" && !id(self_power_on);'
then:
- script.execute: local_on_takeover
else:
@@ -447,7 +449,7 @@ binary_sensor:
condition:
# In AUTO/MANUAL, if the controller intended the heater OFF but LEDs say ON,
# force the heater OFF. OFF is excluded because OFF performs local-start takeover.
lambda: 'return !id(test_mode_enabled).state && id(mode_select).state != "BYPASS (Remote Only)" && id(mode_select).state != "OFF" && !id(power_intended_on) && !id(self_power_on);'
lambda: 'return !id(test_mode_enabled).state && id(mode_select).current_option() != "BYPASS (Remote Only)" && id(mode_select).current_option() != "OFF" && !id(power_intended_on) && !id(self_power_on);'
then:
- script.execute: enforce_heater_off
else:
@@ -455,7 +457,7 @@ binary_sensor:
condition:
# If the heater turns on externally while AUTO already intended it ON,
# re-baseline after warmup and continue normal automatic control.
lambda: 'return !id(test_mode_enabled).state && id(mode_select).state == "AUTO" && id(power_intended_on) && !id(self_power_on);'
lambda: 'return !id(test_mode_enabled).state && id(mode_select).current_option() == "AUTO" && id(power_intended_on) && !id(self_power_on);'
then:
- lambda: |-
id(ramp_until_ms) = millis() + (${fast_ramp_seconds} * 1000UL);
@@ -527,7 +529,7 @@ switch:
name: "Heater Operation"
icon: mdi:radiator
lambda: |-
return id(mode_select).state == "AUTO";
return id(mode_select).current_option() == "AUTO";
turn_on_action:
- if:
@@ -554,12 +556,12 @@ switch:
return id(powered_state).state;
turn_on_action:
- lambda: |-
if (id(mode_select).state != "BYPASS (Remote Only)" || id(test_mode_enabled).state) {
if (id(mode_select).current_option() != "BYPASS (Remote Only)" || id(test_mode_enabled).state) {
id(power_intended_on) = true;
}
- if:
condition:
lambda: 'return id(mode_select).state == "BYPASS (Remote Only)" && !id(test_mode_enabled).state;'
lambda: 'return id(mode_select).current_option() == "BYPASS (Remote Only)" && !id(test_mode_enabled).state;'
then:
- logger.log: "BYPASS (Remote Only): ignoring Power ON."
else:
@@ -580,12 +582,12 @@ switch:
turn_off_action:
- lambda: |-
if (id(mode_select).state != "BYPASS (Remote Only)" || id(test_mode_enabled).state) {
if (id(mode_select).current_option() != "BYPASS (Remote Only)" || id(test_mode_enabled).state) {
id(power_intended_on) = false;
}
- if:
condition:
lambda: 'return id(mode_select).state == "BYPASS (Remote Only)" && !id(test_mode_enabled).state;'
lambda: 'return id(mode_select).current_option() == "BYPASS (Remote Only)" && !id(test_mode_enabled).state;'
then:
- logger.log: "BYPASS (Remote Only): ignoring Power OFF."
else:
@@ -665,7 +667,7 @@ text_sensor:
const bool use_test_temp = id(test_mode_enabled).state;
const float effective_t = use_test_temp ? id(test_temp_c) : id(room_temp).state;
const float at_temp_threshold = id(setpoint_c) + ${off_above_c};
const std::string mode = id(mode_select).state;
const std::string mode = id(mode_select).current_option();
if (!use_test_temp && id(room_temp_lost_fault)) {
return std::string("Fault (Room Temperature Lost)");
@@ -802,7 +804,7 @@ select:
else:
- if:
condition:
lambda: 'return id(mode_select).state != "BYPASS (Remote Only)";'
lambda: 'return id(mode_select).current_option() != "BYPASS (Remote Only)";'
then:
- select.set:
id: mode_select
@@ -853,7 +855,7 @@ button:
on_press:
- if:
condition:
lambda: 'return id(mode_select).state != "BYPASS (Remote Only)";'
lambda: 'return id(mode_select).current_option() != "BYPASS (Remote Only)";'
then:
- lambda: |-
id(power_intended_on) = true;
@@ -870,7 +872,7 @@ button:
on_press:
- if:
condition:
lambda: 'return id(mode_select).state != "BYPASS (Remote Only)";'
lambda: 'return id(mode_select).current_option() != "BYPASS (Remote Only)";'
then:
- lambda: |-
id(power_intended_on) = true;
@@ -972,7 +974,7 @@ interval:
then:
- if:
condition:
lambda: 'return id(mode_select).state == "AUTO";'
lambda: 'return id(mode_select).current_option() == "AUTO";'
then:
- script.execute: auto_control_tick
@@ -984,7 +986,7 @@ interval:
then:
- if:
condition:
lambda: 'return !id(test_mode_enabled).state && id(mode_select).state != "BYPASS (Remote Only)" && id(mode_select).state != "OFF" && !id(power_intended_on) && id(powered_state).state && !id(self_power_on);'
lambda: 'return !id(test_mode_enabled).state && id(mode_select).current_option() != "BYPASS (Remote Only)" && id(mode_select).current_option() != "OFF" && !id(power_intended_on) && id(powered_state).state && !id(self_power_on);'
then:
- script.execute: enforce_heater_off
@@ -1085,7 +1087,7 @@ script:
- script.execute: recompute_powered_state
- if:
condition:
lambda: 'return !id(test_mode_enabled).state && id(mode_select).state != "BYPASS (Remote Only)" && id(mode_select).state != "OFF" && !id(power_intended_on) && id(powered_state).state && !id(self_power_on);'
lambda: 'return !id(test_mode_enabled).state && id(mode_select).current_option() != "BYPASS (Remote Only)" && id(mode_select).current_option() != "OFF" && !id(power_intended_on) && id(powered_state).state && !id(self_power_on);'
then:
- logger.log: "Heater should be OFF but LEDs still show ON. Pulsing power to force OFF."
- script.execute: press_power
@@ -1130,7 +1132,7 @@ script:
then:
- if:
condition:
lambda: 'return id(mode_select).state != "BYPASS (Remote Only)";'
lambda: 'return id(mode_select).current_option() != "BYPASS (Remote Only)";'
then:
- script.execute:
id: press_with_gap
@@ -1142,7 +1144,7 @@ script:
then:
- if:
condition:
lambda: 'return id(mode_select).state != "BYPASS (Remote Only)";'
lambda: 'return id(mode_select).current_option() != "BYPASS (Remote Only)";'
then:
- script.execute:
id: press_with_gap
@@ -1194,7 +1196,7 @@ script:
then:
- if:
condition:
lambda: 'return id(mode_select).state != "BYPASS (Remote Only)" && id(mode_select).state != "OFF" && id(powered_state).state;'
lambda: 'return id(mode_select).current_option() != "BYPASS (Remote Only)" && id(mode_select).current_option() != "OFF" && id(powered_state).state;'
then:
- lambda: |-
id(calibrating) = true;
@@ -1265,7 +1267,7 @@ script:
then:
- if:
condition:
lambda: 'return id(mode_select).state != "BYPASS (Remote Only)";'
lambda: 'return id(mode_select).current_option() != "BYPASS (Remote Only)";'
then:
- lambda: |-
id(power_intended_on) = true;
@@ -1275,7 +1277,7 @@ script:
then:
- if:
condition:
lambda: 'return id(mode_select).state == "AUTO";'
lambda: 'return id(mode_select).current_option() == "AUTO";'
then:
- lambda: |-
id(warmup_until_ms) = millis() + (${warmup_seconds} * 1000UL);
@@ -1314,7 +1316,7 @@ script:
mode: queued
then:
- lambda: |-
if (id(mode_select).state != "AUTO") {
if (id(mode_select).current_option() != "AUTO") {
ESP_LOGD("gas", "AUTO: skipping control tick because Mode is not AUTO");
return;
}