Legacy template to new - no errors, but no sensor

I still cannot wrap my head around the syntax of HA. “Solution A isnt supported anymore, but when you move to solution B, this no longer works” Its a struggle sometimes.

In any case. I am apparently using an ‘old’ way of doing sensors, which do not support state_class. So im trying to migrate to the new way. When I use the following, I do not see any errors in config.yaml, but I also do not see my sensor in HA. I do have other template sensors in my config. Am I breaking it by mixing old and new?

template:
  - sensor:
      - name: "waterheater_sensor_totaltherm"
        device_class: gas
        unique_id: f5846b01-aca9-4480-aa33-02d6a69bd306
        unit_of_measurement: Therms
        value_template: "{{ states('sensor.ch2_unit1_cumulative_gas_use') | float(0) / 39.81103633916554 }}"

#  - platform: template
#    sensors:
#      waterheater_sensor_totaltherms:
#        device_class: gas
#        unique_id: f5846b01-aca9-4480-aa33-02d6a69bd306
#        unit_of_measurement: Therms
#        value_template: "{{ states('sensor.ch2_unit1_cumulative_gas_use') | float(0) / 39.81103633916554 }}"
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

try with " Therms" and does the template work in /Dev-Tools/templates ?
and

state: >
  "{{ states('sensor.ch2_unit1_cumulative_gas_use') | float(0) / 39.81103633916554 }}"

instead of value_template

In addition to the state issue pointed out above… Where did you put what you have shown?

I tried putting in template.yaml. The actual code above is in base configuration though. I’m going to try again with the recommended changes