Fail to understand LTS of sensor data

I have some sensor data coming in via ble bridge and some from a shelly3em. The recorder is configured like this:

recorder:
  purge_keep_days: 31
  commit_interval: 30
  include:
    entity_globs:
      - sensor.ble_*
      - sensor.shelly3em_channel_a_*

Now it seems like data is purged after 31 days.
But IIUC increasing the purge_keep_days is not the way to go for long term storage.

How can I move the data over to LTS to keep the data forever?

To generate LTS (long term statistics) your sensors need to have an appropriate state_class defined.
If you can not add this to a discovered sensor you can add it using customize.

For sensors that are not energy sensors use state_class: measurement, for energy sensors use either total (if the value never resets) or total_increasing (if the value resets perodically).

To be a little more specific: The sensor is a thermometer via esphome:

sensor:
  - platform: atc_mithermometer
    mac_address: "xxxx"
    temperature:
      name: "Kitchen Temperature"
    humidity:
      name: "Kitchen Humidity"
    battery_level:
      name: "Kitchen Thermometer Battery Level"
    battery_voltage:
      name: "Kitchen Thermometer Battery Voltage"
    signal_strength:
      name: "Kitchen Thermometer Signal Strength"

and the entities are

sensor.ble_bridge_kitchen_temperature
sensor.ble_bridge_kitchen_humidity

Where would the state_class: measurement need to be defined?

sensor:
  - platform: atc_mithermometer
    mac_address: "xxxx"
    temperature:
      name: "Kitchen Temperature"
      device_class: temperature
      state_class: measurement
    humidity:
      name: "Kitchen Humidity"
      device_class: humidity
      state_class: measurement

See: https://esphome.io/components/sensor/index.html#base-sensor-configuration