How to set polling for certain time of day

For integrations that use local or cloud polling, I understand how to set the update interval as described here.

However, there are cases where periodical polling only makes sense for a certain time window during the day. E.g. when you know that an API always updates once around 7:00 in the morning. Our when your solar panel obviously doesn’t produce energy during the night.

What is the best way to implement such schedules in an integration?

A workaround could be a combination of an integration that doesn’t poll itself and an automation in HA doing the triggering. But that doesn’t feel very user friendly.

I am working on an integration and inside update coordinator update_data class, based on the condition, either calling the underlying api’s update function or checking the time delta between latest update and now, and calling api’s update function if it is long enough.

In essence, i would like to update every 20 minutes throughout day and every 60 minutes throughout night.