I am making my own controller for a swamp cooler. There are three relays, one for the pump, one for the low speed fan and one for the high speed fan. I have the hardware figured out and I am using the original buttons and indicators. The trouble I am having is how to replicate the button functions. It has three buttons, pump, on/off and fan. The pump is easy enough, it just toggles the pump relay. The fan button cycles the fan from off - low - high- off. I am not sure how to replicate that in ESPHome. The on/off button is supposed to turn everything off and then restore the last state when pressed again. ie. if the pump was on and the fan was on low, that’s what would turn back on. I am unsure how to save the state in ESPHome. Any ideas? Thanks in advance.
If you have any control over how those relays are wired, I suggest not having a relay for each of the speeds. Instead, use one relay for fan power, and the other relay (downstream in the circuit from the power relay) for speed selection. (i.e. Activating the speed relay when the fan power is off will do nothing, of course)
That will prevent the tragedy of a burned out fan motor if a logic bug were to ever activate both relays (and power both speed windings in the motor) simultaneously.
I grew up with evap cooling in Tucson, so remember fondly the great cooling quality it offers (as long as you keep them clean of mold and scale-free).
As for managing the cooler operation, do you also intend to have the pump come on earlier than the fan, to wet the pads and avoid pulling hot air into the building at first? That could be additional logic.
But you might start with one of ESPHome’s built-in ‘fan’ components, as I’m sure there’s one already tailored to what you need, and will have a high/low speed feature, etc.
As for saving state, as long as the ESP remains powered 24/7 (which you probably want to do, irrespective of whether or not it is signalling the relay to run the cooler), it will remember the state of all the components. If you reboot or power-cycle it, the variables will assume their default values afterward.
If you need it to remember states across a reboot or power-cycle, look at the restore_value parameter on Global Variables under the ‘Automation’ page.
But, pay close attention to the caution on this page, regarding what saving to Flash can do over time.
Thanks for the reply! I do have control over the wiring, but I have already wired it. I have the interlock function enabled. Is that not reliable? I’ll take a look at the fan component, thanks for the tip.
I plan to control the swamp cooler mostly with the thermostat. Maybe I’ll just have the on/off button activate pump and low fan every time. I doubt it will be used much, I’d just like it to work.
Glad to hear you have an interlock, though I have to admit I’ve never used it myself.
Best of luck with your project!
I got the buttons working. For the fan button, I used the following yaml:
- platform: gpio
pin:
number: D2
mode:
input: true
pullup: true
name: fan_button
on_press:
then:
- if:
condition:
and:
- switch.is_off: fan1
- switch.is_off: fan2
then:
- switch.turn_on: fan1
else:
- if:
condition:
and:
- switch.is_on: fan1
- switch.is_off: fan2
then:
- switch.turn_off: fan1
- switch.turn_on: fan2
else:
- switch.turn_off: fan1
- switch.turn_off: fan2
For the on/off button, I decided to bail on keeping the last state. If anything is on, I turn it off, if everything is off I turn on the low fan and the pump. Works like a charm. Here is the yaml for that button:
- platform: gpio
pin:
number: D3
mode:
input: true
pullup: true
name: power_button
on_press:
then:
- if:
condition:
and:
- switch.is_off: pump
- switch.is_off: fan1
- switch.is_off: fan2
then:
- switch.turn_on: pump
- switch.turn_on: fan1
else:
- switch.turn_off: pump
- switch.turn_off: fan1
- switch.turn_off: fan2
Here is the original hardware:
Here is my hardware:
The only functionality I lost is I can no longer use the remote. Maybe someday I’ll get that working too.
I realize this is an old thread, but it looks like it created this new logic board to fit inside an existing control box? What unit did you cannibalize the control pad from?
Is this all manually operated, or do you have it set up to be temperature-sensitive based on some ESPHome or HA automation?
The control pad is from the original unit. It fits in the original control housing and still has functional buttons and the LED indicators are functional as well (all of which is in the ESPHome yaml). It can be manually operated, but I also have it controlled by my ecobee thermostat via Ha automations. It works great!
That’s very cool. I also have an ecobee Thermostat. You mentioned that you’re controlling via HA via automations. Does that mean you’ve told your ecobee you have an A/C & fan connected, and just used those as triggers in HA? Does the ecobee complain if you don’t have any resistive load on the Y1 & G ports? I suppose I could just go poke around on mine directly to figure that out.
Thanks!
That is correct, I set up ecobee for a 2 stage A/C (there is no swamp cooler option), and it doesn’t care at all that there is no physical connection to those terminals. The triggers look for the ecobee status to change and turn the swamp cooler on or off. I even have one that runs the pump for 30 seconds to soak the pads before I turn the fan on.
Thanks so much for the information and inspiration. I’ll have to play with this.