How to configurate lightning time?

How can Home Assistant measure how long a value is above a certain threshold?
I would like to measure the duration of light.
My goal is to provide plants with light for 16 hours a day.
The time that is missing, I would like to fill with a grow light switched on a relay.
But how can I do this? Unfortunately, I don’t what to do.
Can someone help me?

The first question is, how to you determine if it is light or not? Do you have a light sensor? If so, then there might be an easier way, but what comes to mind is, first create a Threshold Binary Sensor that determines when the light sensor is indicating a value above the desired threshold. Then create a History Statistics Sensor that measures the amount of time the Threshold Binary Sensor is on (i.e., light is above the threshold) during the desired period.