How to handle failed or empty scrapes

Hi,

I have setup a scrape sensor to get the gas spot prices. The prices are updates every day around 19:00. Before it will show - as value, so most of the time the value of the sensor is empty:

<template TemplateState(<state sensor.gas_spot=; unit_of_measurement=EUR, friendly_name=Gas Spot @ 2023-01-16T03:50:40.163903+01:00>)>

I thought I had this handled in my template, by only setting it when there is an actual number as value. However, that does not seem to work.

How can I can keep the last correct value (number) till the scrape returns a new valid value number)?

- resource: http://...
  scan_interval: 3600
  sensor:
    - name: Gas spot
      select: "td[style='text-align: left;']:-soup-contains-own('price')"
      index: 2
      value_template: >
        {% if is_number(value) %}
          {{ value | float }}
        {% endif %}
      unit_of_measurement: "EUR"