Refactor fan control configuration: Fix GPIO pin inversion, add fan IDs, and implement a switch for controlling all fans
This commit is contained in:
@@ -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
|
||||
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;
|
||||
Reference in New Issue
Block a user