History stats sensor duration bug?

Hello,

I have created two history stats sensors for a flaky vibration sensor on my dryer to check how long a sensor reports ON and OFF in a minute.

  - platform: history_stats
    name: Dryer vibrations ON
    entity_id: binary_sensor.dryer
    state: "on"
    type: time
    end: "{{ now() }}"
    duration:
      minutes: 1

  - platform: history_stats
    name: Dryer vibrations OFF
    entity_id: binary_sensor.dryer
    state: "off"
    type: time
    end: "{{ now() }}"
    duration:
      minutes: 1

If the vibrations are seen for a full minute, I see history stats show value of 72. I expected the max value to be 60 because its only looking at past minute.

Am I missing something? Or is this a bug that needs to be reported?

Regards,
Vaibhav

I tried setting the duration in the same history stats sensor to 2 minutes.
When the sensor was ON for full 2 minutes, I got 107.99 seconds. I was expecting 120 seconds.

Any ideas why this is happening?

Regards,
Vaibhav