have a cupboard Heater
and a micro switch on the door
if i open the door the heater goes OFF
and Closed the door heater turn back on
now the bit want to do is
if the heater is off and I open/close door it to stays off
but if the heater is on before i open the door when the door is closed again to turn on the heater
The way I would do it is have 2 automations and an Input_boolean.
The first automation triggers on the door opening and checks the condition if the heater is on. If so runs the action of turning the input_boolean on.
The second automation triggers on the door closing, and checks the condition if the heater is on and if the input_boolean is on (from the first automation) and then runs the action of turning on the heater.
With that said, if the heater is already on, thereβs no point in turning it on again right? So do you mean to have it turn it on if by the time you close the door the heater was off?? If so, then Iβd change the second automations condition to if the heater is off.