Automation Question

When i set a schedule for my indoor camera in which the camera goes into privacy mode during part of the day. I set an automation that when my doorbell camera sees movement my indoor camera will come out of this privacy mode. How do i make the camera go back into privacy mode after this has happend and there no more movement at my front door? Or even after a set time to return to the privacy mode as per the schedule.