From 9cdc4ecba0bf5e94818f7b8788e22c2b0b4baeca Mon Sep 17 00:00:00 2001 From: Joshua King Date: Mon, 2 Mar 2026 14:36:42 -0500 Subject: [PATCH] Refactor fan control configuration: Fix GPIO pin inversion, add fan IDs, and implement a switch for controlling all fans --- esphome/fdm-exhaust-fan-control.yaml | 30 +++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/esphome/fdm-exhaust-fan-control.yaml b/esphome/fdm-exhaust-fan-control.yaml index 8cc0a6a..2b6adc1 100644 --- a/esphome/fdm-exhaust-fan-control.yaml +++ b/esphome/fdm-exhaust-fan-control.yaml @@ -35,22 +35,38 @@ captive_portal: web_server: port: 80 +# GPIO Outputs for fan control output: - platform: gpio - pin: - number: GPIO3 - inverted: true # Fix for driver inversion + pin: GPIO3 # D1 on XIAO id: fan_80mm_output + - platform: gpio - pin: - number: GPIO4 - inverted: true + pin: GPIO4 # D2 on XIAO id: fan_120mm_output +# Fan entities for Home Assistant fan: - platform: binary name: "80mm Exhaust Fan" + id: fan_80mm output: fan_80mm_output + - platform: binary name: "120mm Exhaust Fan" - output: fan_120mm_output \ No newline at end of file + id: fan_120mm + output: fan_120mm_output + +# Optional: Add a switch to control both fans together +switch: + - platform: template + name: "All Fans" + id: all_fans + turn_on_action: + - fan.turn_on: fan_80mm + - fan.turn_on: fan_120mm + turn_off_action: + - fan.turn_off: fan_80mm + - fan.turn_off: fan_120mm + lambda: |- + return id(fan_80mm).state && id(fan_120mm).state; \ No newline at end of file