I’m trying to detect what input performed an action so that I can perform an automation or not.
Here is my situation: I have a TP-Link wall light switch that goes to a ceiling fan. I have an automation that detects if my Ecobee is running the air conditioning “cooling” then turns on the fan. When the air conditioning stops, the switch is turned off to stop the fan. Easy enough so far.
However, if I turn on the fan manually by pushing the wall switch or using the app, the “turn off” automation is ignored until I manually turn off the fan again. This way if I turn on the fan because I want it on indefinitely, the automation does not later override that action when the AC turns off.
The automation “turn off” pseudo-code would go like this:
- State: Ecobee goes from cooling
- Condition: An automation did not turn on the switch the last time the switch was turned on
- Action: Turn off the switch
It’s getting that condition part that is stumping me. I’ve Googled but I’m likely not asking the right questions (I can’t be the first to do this).
What are some good ways to detect and store what input (manual input vs. automation) performed an action last on a device/entity?
Thanks for being awesome!