From 0ec11e9ddf85192ebbb124ed475620aa1872d4c5 Mon Sep 17 00:00:00 2001 From: Brandon Harvey Date: Wed, 11 Mar 2026 13:43:50 -0500 Subject: [PATCH 1/3] feat: rename Invert Water Logic to Tank Refill Mode + auto-configure switches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames the switch name, id, and all 4 condition references from invert_water_logic to tank_refill_mode for clarity. Adds on_turn_on/on_turn_off handlers to auto-configure related switches: - Turn ON: Stop Pump When Output Wet → ON, Stop Pump When Input Dry → OFF - Turn OFF: Stop Pump When Output Wet → OFF, Stop Pump When Input Dry → ON --- Integrations/ESPHome/Core.yaml | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index 022b2c8..1dc9ef3 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -128,12 +128,20 @@ switch: icon: mdi:water-sync entity_category: config - platform: template - name: "Invert Water Logic" - id: invert_water_logic + name: "Tank Refill Mode" + id: tank_refill_mode optimistic: true restore_mode: RESTORE_DEFAULT_OFF icon: mdi:water-sync entity_category: config + on_turn_on: + then: + - switch.turn_on: stop_pump_when_full + - switch.turn_off: stop_pump_when_dry + on_turn_off: + then: + - switch.turn_off: stop_pump_when_full + - switch.turn_on: stop_pump_when_dry - platform: template name: "Auto Refill" id: auto_refill @@ -163,11 +171,11 @@ switch: or: # Normal mode: input has water - and: - - switch.is_off: invert_water_logic + - switch.is_off: tank_refill_mode - binary_sensor.is_on: fluid_input_sensor # Inverted mode: input is dry (destination is low, needs filling) - and: - - switch.is_on: invert_water_logic + - switch.is_on: tank_refill_mode - binary_sensor.is_off: fluid_input_sensor # Bypass: dry protection not enabled - switch.is_off: stop_pump_when_dry @@ -251,7 +259,7 @@ binary_sensor: condition: and: - switch.is_on: auto_refill - - switch.is_on: invert_water_logic + - switch.is_on: tank_refill_mode - switch.is_off: pump_control then: - logger.log: "Auto refill triggered - tank level low" @@ -435,7 +443,7 @@ script: - if: condition: - and: - - switch.is_on: invert_water_logic + - switch.is_on: tank_refill_mode - switch.is_off: stop_pump_when_full - binary_sensor.is_on: fluid_input_sensor then: @@ -445,7 +453,7 @@ script: condition: - and: - switch.is_on: stop_pump_when_dry - - switch.is_off: invert_water_logic + - switch.is_off: tank_refill_mode - binary_sensor.is_off: fluid_input_sensor then: - logger.log: "Pump stopping - input dry" From 712e264da42ec579a372fd88d97659129a62dfb8 Mon Sep 17 00:00:00 2001 From: Brandon Harvey Date: Wed, 11 Mar 2026 13:56:08 -0500 Subject: [PATCH 2/3] fix: sync dependent switches on boot to match restored tank_refill_mode state on_turn_on/on_turn_off only fire when explicitly toggled, not on boot restore. Adds a priority -20 on_boot handler that reads tank_refill_mode and sets stop_pump_when_full and stop_pump_when_dry accordingly so all three switches are in sync after every reboot. --- Integrations/ESPHome/Core.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index 1dc9ef3..d70358d 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -17,9 +17,20 @@ esphome: id(pump_start_time) = 0; id(safety_alert_active) = false; - script.execute: pump_safety_check + - priority: -20 + then: + - if: + condition: + switch.is_on: tank_refill_mode + then: + - switch.turn_on: stop_pump_when_full + - switch.turn_off: stop_pump_when_dry + else: + - switch.turn_off: stop_pump_when_full + - switch.turn_on: stop_pump_when_dry - priority: -100 then: - - delay: 1000ms + - delay: 1000ms - script.execute: statusCheck - priority: -10 then: From 894a3161379be414c4082bddb5e2f0557c3d65ba Mon Sep 17 00:00:00 2001 From: Brandon Harvey Date: Tue, 17 Mar 2026 11:49:47 -0500 Subject: [PATCH 3/3] feat: auto-toggle Auto Refill with Tank Refill Mode --- Integrations/ESPHome/Core.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index d70358d..a5e0790 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -25,9 +25,11 @@ esphome: then: - switch.turn_on: stop_pump_when_full - switch.turn_off: stop_pump_when_dry + - switch.turn_on: auto_refill else: - switch.turn_off: stop_pump_when_full - switch.turn_on: stop_pump_when_dry + - switch.turn_off: auto_refill - priority: -100 then: - delay: 1000ms @@ -149,10 +151,12 @@ switch: then: - switch.turn_on: stop_pump_when_full - switch.turn_off: stop_pump_when_dry + - switch.turn_on: auto_refill on_turn_off: then: - switch.turn_off: stop_pump_when_full - switch.turn_on: stop_pump_when_dry + - switch.turn_off: auto_refill - platform: template name: "Auto Refill" id: auto_refill