The REST sensor has shorter history than other type of sensors

Hi everyone. Quick question about the long term statistic table.

I’m using the public REST API of GasBuddy to track the gas price around me. However, the REST sensor only has history of around one week(probably the default history length set in recorder field? Not sure) while other sensors can keep their history in long term statistic table, see below.

May I ask if there’s a special setting for REST sensor, or if there’s a way to debug this. Thanks!

Recorder setting:

  db_url: !secret recorder_db_url

Sensor setting:

- platform: rest
  scan_interval: 3600
  method: POST
    Content-Type: application/json
  payload: |
      "operationName": "GetStation",
      "variables": {
        "id": "xxxxx"
      "query": "query GetStation($id: ID!) { station(id: $id) { prices { credit { nickname postedTime price } } } }"
  unique_id: gasbuddy_arco_price
  name: Arco gas price
  icon: mdi:gas-station
  unit_of_measurement: USD
  value_template: "{{ | float }}"

Other sensors, e.g., Xiaomi thermometer

For long term statistics to be generated an entity needs a state_class. The RESTful sensor does support this option. In your case use:

  state_class: measurement

I see. Thanks for the explanation.