I have an IR-controlled fan that I’m trying to automate.
The fan only supports a “toggle” command, so I have an IR transmitter in ESPHome that sends the same IR command for both “on” and “off”. This works, but the switch state in HA keeps getting out of sync with the real state.
Instead of a “toggle”, I want to implement discrete “on” and “off” commands that detect the current state of the fan and only trigger an IR transmission if the state needs to actually change.
I have a sensor driven by a power monitoring outlet that tells me if the fan is on or off based upon its power draw, so I know the current state of the fan.
I have set up a Template Switch for the fan using the state of that sensor, but it is still sending “on” and “off” commands to the ESPHome switch, which is still sending a “toggle” command.
What I want to do is configure a condition on one of these switches so that if they get sent a “turn on” command, but that sensor says its already “on”, then nothing actually happens.
Sorry for the image, I should have posted both. (I wanted to highlight the image to make it super clear what I was trying to accomplish)
I am using IR to change the fan state because if I just power cycle the smart plug, the fan doesn’t remember it’s last setting. It always defaults to “0” (no air blowing). The smart plug can tell me if it’s drawing power, and can effectively shut it down, but it can’t start it back up.