Are surface area units (m²) available in templates?

Hi everyone,

I’m trying to create a helper, template, or sensor through the UI based on an attribute from my vacuum cleaner that shows the total cleaned area:

arduino

{{ state_attr('vacuum.dreame_mc1808_ef51_robot_cleaner', 'clean.total_clean_area') }}

I would like this value to have the unit of square meters (m²). However, I don’t see a Device Class for area, and there’s no option for m² as a unit either. Despite the large list of available units, I’m surprised this isn’t included, as it seems like a practical piece of information for a vacuum cleaner.

Is this a bug, or are surface area units not supported in templates? Any advice or clarification would be greatly appreciated!

Thanks!

There is no sensor device class for area currently. You can assign whatever unit of measurement you like by configuring the sensor in YAML or by using manual customization.

Manual customization is only needed for sensors defined by integrations, when you cannot set your own attributes. Pretty much any template sensor created in yaml or helper allows to set the unit of measurement without needing to use customize.

1 Like

Perfect, thanks to both of you! I wasn’t aware of the manual customization or that units could be set directly by the user.