I have created a replacement control board for my Cat Olympian GenSet/Cutler Hammer Transfer Switch to bring WiFi, MQTT, and a few other features to the party. The beta control board is, at its most basic, an ESP32-WROOM and a collection of relays and switches. I originally intended on writing a custom firmware based on C++ or MicroPython, but having over 50 devices in my home running Tasmota I thought....Could it be possible?
So I'm in the rabbit hole now, with an ESP32 breadboard setup to simulate a few functions of the transfer switch, and hit my first snag that I'm hoping the community can help with.
During power failure, the Generator starts up and is stable after several seconds. I need Tasmota to sense that the generator is ON by seeing a state change from Low to High (GPIO27), waiting a programmable delay time, then turning on relay1 (GPIO25) which starts an AC motor to 'flip' the breakers inside the transfer switch. Finally look for (GPI34) to go low (bottom limit switch) and turn off relay1 (GPIO25).
Similarly, when grid power returns, the sequence is: sense return to grid power by seeing a state change from High to Low (GPIO27), waiting a programmable delay time, then turning on relay2 (GPIO26) which starts an AC motor to 'flip' the breakers inside the transfer switch. Finally look for (GPI39) to go low (top limit switch) and turn off relay2 (GPI39).
The above sequencing (specifically) needs to happen independent of ESP32 WiFi and MQTT connectivity for reliability.
I have been experimenting with two LED's standing in for the two relays and two wires with pull-up resistors standing in for the limit switches, and can't seem to get the behaviors I need. I tried decoupling switches from relays (SetOption114) and simply using rules like Rule1 ON switch1#state=0 DO POWER1 0 ENDON but it seems SetOption114 disables the use of switch/power rules as well.
Does anyone have any idea how to configure Tasmota to achieve the sequencing I have described?