Automation, auto task

How to add automation task

Objective:
Set a specific time when a Mag lock stays disengaged.
For example:
Mon - Fri : 08:00-17:00 Mag lock not engaged
Mon - Fri : 17:00-07:59 Mag lock engaged.
Sat - Sun. Mag lock engaged.

Here are the screenshots of sequence:
1.
2.
3.
4.
5.
6.