How to create virtual sensor?

You will copy the code and paste it into the IDE, which is the web portal to your smartthings account. The instructions are in the community FAQ:

FAQ: Can I trigger an Echo Action without Speaking to It?