Deprecation of "unit" configuration for integration platform

EDIT: Never mind, it did guess the unit correctly and I can see the correct unit in the database - it was just the diagram in Lovelace that wasn’t showing it yet.

Hi,
I’m measuring my gas usage with the integration platform.
I have a sensor gas_current that delivers current gas flow in m³/h. To get the total gas usage, I configured a sensor like this:

  - platform: integration
    name: Gas total
    source: sensor.gas_current
    round: 6
    unit_time: h
    unit: "m³"
    method: left

The gas_current sensor has a unit_of_measurement: "m³/h" set.
With this I was able to get a sensor that I could use for HAs energy monitoring.

However, the unit has now been deprecated and will be removed in the future, see: Deprecate definition of unit in integration sensors by dgomes · Pull Request #55876 · home-assistant/core · GitHub

Now I wonder how I can configure an integration like that in the future. I tried adding a new sensor for testing and left the unit out, but the integration platform was not able to auto-determine the unit to m³/h x h which would equal .

How can I configure this correctly now, without the fixed unit?

1 Like