You can’t put expressions in the state option. Only states, like “on” or “off” or “12”.
What you are matching on is the literal string / word “>25”. It is not the expression “greater than 25”.
You need to make a template binary sensor that is on when your sensor is greater than 25. Then use the history stats integration to track when that binary sensor is “on”.