Virtual Switch For Bright When Dark and or bright after sunset

Hello, I have tried to edit the code provided by the SmartApps but was unsuccessful.

Bright When Dark and or bright after sunset

Instead of using a motion sensor I would like to use a simulated switch which is turned on a by my ring doorbell using a IFTTT rule

Practical Use for this. When the motion sensor, built into the Ring Doorbell, is activated, the IFTTT rule activates a simulated switch which in turn activates a SmartApp that only turns on the smart bulb on the front porch during night and auto shuts off the light after X minutes, as well as turns off the virtual switch.

Try Rule Machine. It will do this for you.

Thank you, after an hour of research i finished and testing. Is there a better way to implement this?
would a momentary switch be better?