I have some Christmas lights connected to a smart plug (switch.christmas_lights). I’d like them to turn on at sunset and turn off at sunrise.
However, if at any time between sunset and sunrise the garage door (binary_sensor.garage_door) opens I want to turn the smart plug off, but turn it back on when the garage door closes.
I’d do two automations, 1 for turning on the lights and one for cycling with the door.
Door automation triggers when the door is opened/closed and condition on lights being on (or sunset to sunrise) and a choose options for turning the lights on or off depending on open/closed
In situations like this (where I want something on or off based on a number of environmental factors) all I do is create a binary sensor to monitor the factors, and then mirror the state of the sensor to the device in an automation.