Sensor state lost after restart

Hello friends, I managed to set up a fuel price sensor using Rest + template sensors. Everything works great, except that it doesn’t assume the last known state when the system is off/ restarts and generates holes in the log graph. In order to have a nicer continous graph, i’d like it to assume that the missing state is equal to the last known one. I want it to retain the last known price, and I’m pretty sure there’s a setting for that. Before this I used a Scrape integration that didn’t have this issue.

Little holes of missing information in the graph

Piece of the code I use

  - platform: rest
    name: enibenzsensors
    resource: *<json-resource>*
    json_attributes_path: "$.fuels[0]"
      - price
    value_template: "OK"
  - platform: template
        value_template: "{{ state_attr('sensor.enibenzsensors', 'price' ) }}"
        friendly_name: Benzina ENI
        unit_of_measurement: "€ / lt"

Thanks in advance

You can achieve this with the Multiscrape on-error feature (disclosure: i’m the author)
It’s scrape component but you can use it for all your rest sensors as well with the bonus of not requiring an additional template sensor.