HA is now remembering the last state in 2023.5/6 , but it didn’t in 2023.4

I visualise my Solar Thermal and boiler input to my water cylinder with the following graph.

In 2023.4 it looks like this, item 1 in the image

But in 2023.5/6 I get this, item 2 in the image

Everything else is the same, same graph, same template, same inputs and the same version of Apex charts (latest v2.0.4).

The only symptom I can see is that in the history it now appears to now save the last state.
See item 4 in the image

Where in 2023.4 it doesn’t.
See item 3 in the image

This has been in and running since Q3 2022. I do think it took me a few attempts to get it right, as I had tried using unavailable and null in my sensor, but none of them worked. So the configuration I ended up using is;

#Solar pump
  - sensor:
      - name: sensor.solar_pump_set_temperature
        unique_id: sensor.solar_pump_set_temperature
        state: >
          {% if states('sensor.pump_speed_relay_1')|float(0) > 10.0 %}
            {{states('sensor.temperature_sensor_2')}}
          {% endif %}
        unit_of_measurement: "°C"
        state_class: measurement

I have checked the release notes and can see no mention of this being affected by any changes. I tried putting in an ‘else’ so it was a complete if statement, but that also hasn’t worked.

So have I coded it wrong, or is it no longer the right way?