Add the template below in your template.yaml file or in Configuation.yaml. (Format and place in correct location in configuation.yaml depending on your setup)
change the name of the sensor.pixel_5_next_alarm to the name of the persons next alarm sensor.
I was having some issues with this script as it was turning on my lights when any alarm was triggered including calendar events. I have added the following to the automation so it is only triggered by my phone alarm and when I am home.
{{ (now().strftime("%a %h %d %H:%M %Z %Y") ==
(((state_attr('sensor.matt_s23_ultra_next_alarm', 'Time in Milliseconds') | int / 1000)) | timestamp_custom('%a %h %d %H:%M %Z %Y'))
and (state_attr('sensor.matt_s23_ultra_next_alarm', 'Package')) == 'com.sec.android.app.clockpackage')
and (states('sensor.mattgoogle') =='Home') }}