I recently had a quietcool whole-house fan installed. I’m trying to attach it to home assistant, and according to their wiring diagram, the three speeds are controlled with power to three different leads. There’s a high, medium and low wire, and depending on which you give power to the fan will operate at that speed.
I’m not sure what happens if you give two ‘speeds’ power at the same time, so in the interest of safety, what I’m trying to do is create an automation that makes sure only one relay can be on at a time. I have a basic automation working, but if I have one speed on, and i select another speed, there’s a brief moment when ‘both are on at once’.
I’ve created a test harness for this and attached some simple lightbulbs to test with before attaching it to the fan, and what I’d like to do is configure the automation to first turn off a relay, before it turns another one on.
Is there a way to tell the automation ‘if this call is made, first do this automation before letting the call continue’? For example, if relay 1 is on, and I want to turn on relay 2, i’d like the automation to turn off relay 1 before turning on relay 2.
… or is this better done with a series of scripts? I was hoping to take care of it with one automation and a bunch of if/then statements. Here’s the current state of it:
alias: whole_house_fan_relay_rules
description: makes sure only one relay can be on at a time.
trigger:
- platform: state
entity_id:
- switch.multirelay_2
id: relay1_on
from: "off"
to: "on"
- platform: state
entity_id:
- switch.multirelay_2_2
from: "off"
to: "on"
id: relay2_on
- platform: state
entity_id:
- switch.multirelay_3
from: "off"
to: "on"
id: relay3_on
condition: []
action:
- if:
- condition: trigger
id: relay1_on
then:
- type: turn_off
device_id: b8400563518b0e56437de44f632f485e
entity_id: switch.multirelay_2_2
domain: switch
- type: turn_off
device_id: b8400563518b0e56437de44f632f485e
entity_id: switch.multirelay_3
domain: switch
- if:
- condition: trigger
id: relay2_on
then:
- type: turn_off
device_id: b8400563518b0e56437de44f632f485e
entity_id: switch.multirelay_2
domain: switch
- type: turn_off
device_id: b8400563518b0e56437de44f632f485e
entity_id: switch.multirelay_3
domain: switch
- if:
- condition: trigger
id: relay3_on
then:
- type: turn_off
device_id: b8400563518b0e56437de44f632f485e
entity_id: switch.multirelay_2
domain: switch
- type: turn_off
device_id: b8400563518b0e56437de44f632f485e
entity_id: switch.multirelay_2_2
domain: switch
mode: single