Gas index sensor with MQTT which updates with a counter

Hello,
I need help to define a gas meter sensor.
The value would come from mqtt and increase by 10 liter each time the payload is received.

mqtt:
  sensor:
    - name: Gas Index
      state_topic: "zigbee2mqtt/gas_index"
      device_class: gas
      state_class: total_increasing
      unit_of_measurement: "m³"
      value_template:  >
        {% if value_json is defined %}
            {% set g = states(entity_id) | float(0) %}
            {{ (g + 0.01) | round(3) }}
        {% else %}
            {{ '' }}
        {% endif %}

this kinda works but I have 2 questions:
Q1: the sensor.gas_index starts at 0 in the UI. How to I set its actual initial value (equal to the one on the gas meter device)

Q2: when the payload is not defined (not sure how / when this happens), I simply return the empty string ‘’. As per the doc this should not update the doc. Does this mean g will be equal to the last known numeric value ?