How to turn lights off and on during night and day cycle

HI there I really could use some help with this.

I have asked this question on this website before but to no avail. So I thought I would try again.

How do I turn lights off and on when it switches to day and night. I have placed these lights onto lamposts and to buildings if that is any help.

Thank you for your help!

You can either deactive the gameobjects that Light components are on altogether via

go.SetActive(false);

or just deactive the Light components via

go.GetComponent<Light>().enabled = false;