Device_class: gas AND unit_of_measurement: gallons

I see an error in the log that “gallons” is not a valid unit of measurement for device_class: gas.

Should I just ignore it? Does one of these need to be changed?

The units are definetly gallons.

Propane is in liquid form in the tank.

Here is the code:

template:
  - sensor:
      - name: "Daily Propane Usage 371 claude Continuous"
        unit_of_measurement: "gallons"
        state: >
          {% set current = states('sensor.propane_tank_neevo_371_gallons') | float %}
          {% set last_day = states('sensor.propane_tank_neevo_371_gallons', now() - timedelta(days=1)) | float %}
          {% if is_number(current) and is_number(last_day) %}
            {{ (last_day - current) | round(2) }}
          {% else %}
            {{ 0 }}
          {% endif %}
        state_class: measurement
        device_class: gas

Thank you.

That device class ‘gas’ is for something in a gaseous state like natural gas in a pipe. Not LP

You’re probably looking for
volume_storage: Generic stored volume in L, mL, gal, fl. oz., m³, ft³, or CCF

2 Likes

That did it!

Thank you very much.

Awesome don’t forget to mark the solution for other people looking for the same thing. Glad it got you moving.

(yeah it’s like using ‘Coke’ in Texas, everywhere else in the world ‘gas’ has special meaning)

1 Like

I don’t see any place to mark it as solved.