Fan switch timer with override

Is there a way to differentiate a manual physical switch toggle vs mqtt (sonoff in switch mode)?
Here is the scenario:
If the switch is turned on using phone etc., input number slider can be set for desired duration and that works.
If switch is physically turned on, the sonoff still uses the duration previously set by input number.

If automation in HA is turned off, node-red based on switch “on” state, using bigtimer turns off fan after 3hrs - as in forgot to turn off fan… and that works.

What I would like is to be able to somehow differentiate the physical flip of wall switch. The idea is that I can leave the fan as long as I want instead of duration set by input number when I use physical switch and if I really forget, node-red bigtimer should turn it off after a maximum duration of 3hrs.

Somehow I don’t think it is possible… one avenue I explored is to see if tasmota itself provides a timer off function but it is schedule based and not a simple off timer… unless I missed something.

Any thoughts?