The High-Luminosity LHC will open an unprecedented window on the weak-scale nature of the universe, providing high-precision measurements of the Standard Model (SM) as well as searches for new physics beyond the SM. The CMS Collaboration is planning to replace entirely its trigger and data acquisition systems to match this ambitious physics program. Efficiently collecting datasets in Phase 2 will be a challenging task, given the harsh environment of 200 proton-proton interactions per LHC bunch crossing. The already challenging implementation of an efficient tau lepton trigger will become, in this conditions, an even crucial and harder task; especially interesting will be the case of hadronically decaying taus. To this end, the foreseen high-granularity endcap calorimeter (HGCAL), and the astonishing amount of information it will provide, play a key role in the design of the new online level-1 (L1) triggering system. In this talk I will present the development of a L1 trigger for hadronically decaying taus based on the sole information from the HGCAL detector. I will present some novel ideas for a L1 trigger based on machine learning that can be implemented in FPGA firmware. The expected performance of the new trigger algorithm will be presented, based on simulated collision data of the HL-LHC.