The simplest way would be to use the switch that turns on when the NPC is at home and variable values for time that corresponds to what you want their bed time to be, both in conditional branches.
And yes, I didn’t think of that. The script won’t work because the event ID would be different since they are being spawned. I’ll add a plugin command for this in the next update.