Help with converting piston to automation

I’m trying to convert a piston that I’ve been using for nearly 4 years to an automation.

It changes the mode to night and turns stuff off if no motion on 5 motion sensors for 15 minutes and time is between 10:30pm to 5:30 am.

The automation I created to replace the piston didn’t work last night. Can someone please help?? Below are screenshots of the piston and the corresponding automation.