Platform: statistics - value_max and relative recording time

hi, I created a sensor to record the peak production of the photovoltaic. How do I record the hour and minute of when it first occurred?

- platform: statistics
  name: "produzione_max_oggi"
  entity_id: sensor.solaredge_i1_ac_power
  state_characteristic: value_max
  max_age:
    hours: 12

I tried this solution but it always returns: N/A

 {% set timestamp = state_attr('sensor.produzione_max_oggi', 'state_timestamp') %}
        {% if timestamp %}
          {{ timestamp.hour }}:{{ timestamp.minute }}
        {% else %}
          N/A
        {% endif %}

in the history you can see all the changes

some idea? Thank you