We didn’t have any lighting in our winter garden and had been using an Aqara door sensor for a long time. This area would get dark in the evening, so as a solution we bought a plug-in light and an Aqara smart plug.
By writing an automation, I made it so that when the door opens, the plug turns on and therefore the light turns on. This way I both solved my lighting problem and prevented it from staying on unnecessarily. Also, if the plug is already on, it doesn’t pass the first if condition, so it doesn’t turn off after 2 minutes; in other words, if I manually turned the light on and want it to stay on, the light will keep shining even if the door is opened and closed. Thank you, Aqara!
Hi, just for information, if you add a condition in the IF condition that is the opposite of the WHET condition, this way you avoid spammy automation triggering when performing an action in WHEN. I practice this all the time.