diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index 83294d1..a5e0790 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,10 +1,9 @@ substitutions: name: apollo-pump-1 - version: "25.12.18.1" + version: "26.3.2.1" device_description: ${name} made by Apollo Automation - version ${version}. esp32: - board: esp32-c6-devkitm-1 variant: esp32c6 flash_size: 8MB framework: @@ -18,9 +17,22 @@ 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 + - 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 + - delay: 1000ms - script.execute: statusCheck - priority: -10 then: @@ -69,6 +81,7 @@ captive_portal: web_server: port: 80 + version: 3 # Buzzer output: @@ -127,6 +140,30 @@ switch: restore_mode: RESTORE_DEFAULT_OFF icon: mdi:water-sync entity_category: config + - platform: template + 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 + - 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 + optimistic: true + restore_mode: RESTORE_DEFAULT_OFF + icon: mdi:autorenew + entity_category: config - platform: template name: "Pump Safety Override" id: pump_safety_override @@ -147,10 +184,21 @@ switch: - if: condition: or: - - binary_sensor.is_on: fluid_input_sensor + # Normal mode: input has water + - and: + - 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: tank_refill_mode + - binary_sensor.is_off: fluid_input_sensor + # Bypass: dry protection not enabled - switch.is_off: stop_pump_when_dry then: - logger.log: "Pump turning on - conditions met" + - text_sensor.template.publish: + id: last_pump_action + state: "Pump Started" - lambda: |- id(pump_start_time) = millis(); id(safety_alert_active) = false; @@ -160,10 +208,17 @@ switch: - switch.turn_off: pump_control on_turn_off: then: + - if: + condition: + lambda: 'return id(pump_start_time) != 0;' + then: + - logger.log: "Pump turned off" + - text_sensor.template.publish: + id: last_pump_action + state: "Pump Stopped" - lambda: |- id(pump_start_time) = 0; id(safety_alert_active) = false; - - logger.log: "Pump turned off" binary_sensor: - platform: status @@ -213,6 +268,20 @@ binary_sensor: input: true pullup: true inverted: true + on_release: + then: + - if: + condition: + and: + - switch.is_on: auto_refill + - switch.is_on: tank_refill_mode + - switch.is_off: pump_control + then: + - logger.log: "Auto refill triggered - tank level low" + - text_sensor.template.publish: + id: last_pump_action + state: "Auto Refill Triggered" + - script.execute: pumpUntilFull - platform: gpio name: Fluid Output @@ -295,6 +364,26 @@ light: min_brightness: 50% max_brightness: 100% +text_sensor: + - platform: template + name: "Last Pump Action" + id: last_pump_action + icon: mdi:pump + - platform: wifi_info + ip_address: + name: "IP Address" + id: wifi_ip + entity_category: "diagnostic" + - platform: version + name: "ESPHome Version" + hide_timestamp: true + entity_category: "diagnostic" + - platform: template + name: "Apollo Firmware Version" + id: apollo_firmware_version + update_interval: never + entity_category: "diagnostic" + script: - id: pumpUntilFull then: @@ -366,10 +455,20 @@ script: then: - logger.log: "Pump stopping - safety" - switch.turn_off: pump_control + - if: + condition: + - and: + - switch.is_on: tank_refill_mode + - switch.is_off: stop_pump_when_full + - binary_sensor.is_on: fluid_input_sensor + then: + - logger.log: "Pump stopping - destination full (inverted mode)" + - switch.turn_off: pump_control - if: condition: - and: - switch.is_on: stop_pump_when_dry + - switch.is_off: tank_refill_mode - binary_sensor.is_off: fluid_input_sensor then: - logger.log: "Pump stopping - input dry" diff --git a/Integrations/ESPHome/PUMP-1.yaml b/Integrations/ESPHome/PUMP-1.yaml index 1c619eb..0fa81a0 100644 --- a/Integrations/ESPHome/PUMP-1.yaml +++ b/Integrations/ESPHome/PUMP-1.yaml @@ -3,10 +3,12 @@ esphome: friendly_name: Apollo PUMP-1 comment: Apollo PUMP-1 name_add_mac_suffix: true - platformio_options: - board_build.flash_mode: dio - on_boot: + - priority: 500 + then: + - text_sensor.template.publish: + id: apollo_firmware_version + state: "${version}" - priority: -10 then: - if: @@ -48,11 +50,6 @@ update: source: https://apolloautomation.github.io/PUMP-1/firmware/manifest.json wifi: - on_connect: - - delay: 5s - - ble.disable: - on_disconnect: - - ble.enable: ap: ssid: "Apollo PUMP-1 Hotspot" diff --git a/Integrations/ESPHome/PUMP-1_Minimal.yaml b/Integrations/ESPHome/PUMP-1_Minimal.yaml index 5a5a83f..85c674b 100644 --- a/Integrations/ESPHome/PUMP-1_Minimal.yaml +++ b/Integrations/ESPHome/PUMP-1_Minimal.yaml @@ -3,14 +3,17 @@ esphome: friendly_name: Apollo PUMP-1 comment: Apollo PUMP-1 name_add_mac_suffix: true - platformio_options: - board_build.flash_mode: dio - project: name: "ApolloAutomation.PUMP-1" version: "${version}" min_version: 2023.11.1 + on_boot: + priority: 500 + then: + - text_sensor.template.publish: + id: apollo_firmware_version + state: "${version}" dashboard_import: package_import_url: github://ApolloAutomation/PUMP-1/Integrations/ESPHome/PUMP-1_Minimal.yaml