Create a simple sensor that does not depend on anything and does not reset to zero each time it is restarted

I’m using a Rest command for a Python script to send data into the sensor sensor.wallbox_sessions_de_charge:

rest_command:
  send_data_to_api:
    url: 'http://homeassistant.local:8123/api/states/sensor.wallbox_sessions_de_charge'
    method: 'post'
    content_type: 'application/json'
    headers:
      Authorization: 'Bearer ggggggggggggggggjjjjjjjjjjjjjjjjj'  # Remplacez {{ token }} par votre token
    payload: '{{ data | tojson }}'

It works very well, but my difficulty is this sensor sensor.wallbox_sessions_de_charge, I don’t really know how to create it, where to save it.

If I make a template, it starts from zero each time it is restarted.
I haven’t found a ‘platform’ that allows you to create a simple sensor that doesn’t reset to zero on each restart.

Thanks if you have an idea, I’ve been looking for a week…

Not sure, but maybe take a look at:

Trigger-based Template Sensor

The state, including attributes, of trigger-based sensors and binary sensors is restored when Home Assistant is restarted.