The firmware is based on ESPHome, which integrates particularly well into Home Assistant, a popular home automation software; therefore I would recommend to implement such features on a higher layer than the firmware. See here how to e.g. implement a "sundial" function:
https://gitlab.com/sephalon/deathstar_lamp#home-assistant-in...