The right way to work out the earliest time something happened

I am asking this question in the hope of some guidance on how to establish, later in the day, the earliest time in a day that something happened.
My use case is simple, I have solar panels and a battery and if the power stored falls below a partivular level before there is solar power then I need to do something about it.
Sun rise is not usefull as when it happens and when solar starts to produce vary throughout the year. But if at 11pm I check what time solar started producing this morning, I should be prety close and can make a handy decision on that.

Thank you for any help you can provide.

A light sensor is the obvious suggestion. Many motion sensors have them built in if you already have one of those. Then you have a choice of history graph for manual checks or live light levels to trigger automations.

This doesn’t address your original question, but it might be useful for…

You can use a trigger-based template binary sensor that resets to “off” at whatever time you think is best and toggles “on” the first time the sensors’ values fall below your desired range…:

template:
  - trigger:
      - platform: time
        at: "00:00:01"
      - platform: template
        value_template: |-
          {{ states('sensor.battery')|float < 50 and states('sensor.solar_production')|float < 10 }}
    binary_sensor:
      - name: first_time_only
        state: "{{ trigger.platform != 'time' }}"

Just base whatever warning automation you need off the state of the binary sensor changing to “on”.

The issue I have is that I need a way to use an automation to judge what I can see in a history graph. I can see when the light got bright or when the solar started to produce. but in an automation I have no easy way to get the time that the value started to rise.

My issue is that, the “fix” for not enough power, is to charge on cheap early morning power. So I have to use a formula to work out if the power in the battery is enough to get through to when solar power is available. I can use maths to establish roughly when batter power will run out.
The question is how to work out when solar power will be available; in March it is almost 11am in June it is 7am. The easy way to work this out is to select the time power started to arrive this mornoing and use that to work out what it is likely to be tomorrow.
I could store a date time each mornig, but I would hope access to this information in the database would preclude setting up an automation and helper.