Normal switch and timer off

I want to use the same switch that function as normal (which turns ON and OFF when it is needed) Also want to turn OFF automatically once it has been turned ON (automatically turn off after particular time it has been turned ON) pls help me with solution

You will need to use virtual pins, and a switch widget that initiates a timer. It will also need to delete the timer if it the switch is turned off before the timer expires in addition to turning OFF the device…

If you want to make the timer interval (time before automatic shutoff) adjustable, you will also need a slider widget (or similar) to change that interval. This widget will receive the new value, delete the old timer and create a new one.

The code for all of this will be up to you, as I doubt anyone here will just write it for you. So give it a try, and if you get hung up on something, post your code here and ask about that specific problem. I am sure people will be more willing to help then.


@Aravindvr Don’t forget to search this forum for answers already provided…

I have done something similar using the manual button on a Sonoff Basic and a timer widget… Can be used on any MCU, with a button on a GPIO.