CoRE for arlo

I’ve done a couple of CoRE pistons (very basic ) but i want to try a more complicated one but it kind of baffles me , I want one of my Arlo’s to turn on a light when it detects motion , but then turn it back off after a period of inactivity and only at night time between certain hours.
Any help greatly appreciated.

Altered it slightly and it works OK
But not for the light I want ( something wrong with osram bulb I think )