You could test this exact config, which would help isolate whether it is related to your more customised implementation or an issue with the base logic.
Just leaving this here for anybody who wants to know the current time of your ESPHome device. This text-sensor template updates the time into the text sensor every 60 seconds. I could not find the time anywhere so i created this solution. It takes 60 seconds after the reboot before the time is set correctly, probably the time is not up to date directly after reboot.
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Amsterdam
text_sensor:
- platform: template
…