How do I ? Bulbs, motion, Pan

So, I put 4 Wyze bulbs in my back deck fan. I then set the Wyze motion detector at the entrance to my deck and setup a shortcut that if my Motion detector is active, it turns on the light bulbs… then after 5 minutes of no motion it turns them off. I thought I was able to setup my Pan Camera to take a picture at motion, but then I found out that the camera has to be 'on" and I don’t keep that camera on except at night, and when I am gone from home.
So Questions:

How do I set the motion detection to only work at night, or certain hours?
Is there a way to turn on motion detection when I leave home?

Thanks

If you want to turn on motion detection automatically when you leave home you can do a IFTTT applet using the Life360 service. Life360 is a family tracking app that allows you to set two location points without paying a fee. In IFTTT you can set the trigger to be when the last family member leaves your home location it enables motion detection and then do a second trigger to turn motion back off when you arrive home. I have this similar setup and I use it to turn off my cameras when my wife and I are home and turn them back on when we leave.
image

using shortcuts in the Wyze app and the automate feature for times/days you can also set it up to turn on motion detection only during certain hours, or turn it off the say way.