Sunrise Blueprint starting at 100% issue

Need some help figuring out what is going on. No matter what I do or try, the lights always start at 100% brightness. Any help would be much appreciated.

variables:
light_entity: light.closet_light
sensor: none
sunrise_duration: 20
start_brightness: 5
end_brightness: 255
range_brightness: ‘{{float(end_brightness)-float(start_brightness)}}’
manual_time: ‘11:53:00’
seconds: ‘{{float(sunrise_duration) * 60}}’
min_mired: 500
start_mired: ‘{{state_attr(light_entity, ‘‘max_mireds’’)}}’
end_mired: ‘{{[state_attr(light_entity, ‘‘min_mireds’’)|int(0), min_mired|int(0)]|max}}’
tick_time: ‘{{float(seconds) / float(range_brightness)}}’
check_entity: none
trigger:
platform: time_pattern
minutes: ‘*’
condition:
action:
wait_template: ‘{{sensor == ‘‘none’’ or as_timestamp(states(sensor), None) != None}}’
wait_template: >-
{{0 < as_timestamp(states(sensor) if sensor != ‘none’ else
states(‘sensor.date’) ~ ’ ’ ~ manual_time) -
as_timestamp(states(‘sensor.date_time_iso’)) <= float(seconds) and
states(check_entity) in [‘unknown’, ‘on’, ‘home’]}}
choose:
default:
condition: template
value_template: ‘{{sensor == ‘‘none’’ or as_timestamp(states(sensor), None) != None}}’
condition: template
value_template: >-
{{0 < as_timestamp(states(sensor) if sensor != ‘none’ else
states(‘sensor.date’) ~ ’ ’ ~ manual_time) - as_timestamp(now()) <=
float(seconds) and states(check_entity) in [‘unknown’, ‘on’, ‘home’]}}
choose:
- conditions:
- ‘{{state_attr(light_entity, ‘‘min_mireds’’) != None}}’
sequence:
- service: light.turn_on
data:
brightness: ‘{{start_brightness}}’
color_temp: ‘{{start_mired}}’
entity_id: light.closet_light
default:
- service: light.turn_on
data:
brightness: ‘{{start_brightness}}’
entity_id: light.closet_light
repeat:
while:
- ‘{{sensor == ‘‘none’’ or as_timestamp(states(sensor), None) != None}}’
- >-
{{0 < as_timestamp(states(sensor) if sensor != ‘none’ else
states(‘sensor.date’) ~ ’ ’ ~ manual_time) - as_timestamp(now()) <=
float(seconds)}}
sequence:
- delay: ‘{{tick_time}}’
- choose:
- conditions:
- >-
{{0 < state_attr(light_entity, ‘brightness’) | int(0) <
end_brightness | int}}
- >-
{{sensor == ‘none’ or as_timestamp(states(sensor), None) !=
None}}
- >-
{{0 < as_timestamp(states(sensor) if sensor != ‘none’ else
states(‘sensor.date’) ~ ’ ’ ~ manual_time) -
as_timestamp(now()) <= float(seconds)}}
sequence:
- choose:
- conditions:
- ‘{{state_attr(light_entity, ‘‘min_mireds’’) != None}}’
sequence:
- service: light.turn_on
data:
brightness: >-
{{(float(end_brightness) -
(float(range_brightness) *
(as_timestamp(states(sensor) if sensor != ‘none’
else states(‘sensor.date’) ~ ’ ’ ~ manual_time) -
as_timestamp(now())) / float(seconds))) | int(0)}}
color_temp: >-
{{(float(end_mired) + (float(start_mired) -
float(end_mired)) * ((as_timestamp(states(sensor)
if sensor != ‘none’ else states(‘sensor.date’) ~ ’
’ ~ manual_time) - as_timestamp(now())) /
float(seconds))) | int(0)}}
entity_id: light.closet_light
default:
- service: light.turn_on
data:
brightness: >-
{{(float(end_brightness) - (float(range_brightness) *
(as_timestamp(states(sensor) if sensor != ‘none’ else
states(‘sensor.date’) ~ ’ ’ ~ manual_time) -
as_timestamp(now())) / float(seconds))) | int(0)}}
entity_id: light.closet_light
choose:
default:
mode: single
max_exceeded: silent
id: ‘1639068894917’
alias: Wake-up light alarm with sunrise effect
description: ‘’