From 80935d4b8a1f6a2c41a18b38edb0e18eb09e5b90 Mon Sep 17 00:00:00 2001 From: Michael Arthur Date: Fri, 27 Dec 2024 00:45:35 +1300 Subject: [PATCH] Add blog and update number and sensor entity docs (#2448) * add blog and update number and sensor entity docs * Update docs/core/entity/sensor.md Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update blog/2024-12-04-area-squared-units.md Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * remove space * add number and sensor changes to the blog * Update blog/2024-12-04-area-squared-units.md Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update blog/2024-12-04-area-squared-units.md Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update blog/2024-12-04-area-squared-units.md Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * remove example * Update blog/2024-12-04-area-squared-units.md Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Update blog/2024-12-04-area-squared-units.md Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> * Rename 2024-12-04-area-squared-units.md to 2024-12-26-area-squared-units.md --------- Co-authored-by: epenet <6771947+epenet@users.noreply.github.com> --- blog/2024-12-26-area-squared-units.md | 15 +++++++++++++++ docs/core/entity/number.md | 1 + docs/core/entity/sensor.md | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 blog/2024-12-26-area-squared-units.md diff --git a/blog/2024-12-26-area-squared-units.md b/blog/2024-12-26-area-squared-units.md new file mode 100644 index 00000000..f6742344 --- /dev/null +++ b/blog/2024-12-26-area-squared-units.md @@ -0,0 +1,15 @@ +--- +author: mikey0000 +authorURL: https://github.com/mikey0000 +title: "New area device class" +--- + +### Summary of changes +A new `AREA` device class is now available for number and sensor entities, together with automatic unit conversion based on the unit system. +A corresponding `UnitOfArea` unit enumerator, and `AreaConverter` converter class have been added to support the new device class. + +### Backward compatibility +The `AREA_SQUARE_METERS` constant has been deprecated and will be removed in Home Assistant `2025.12`. +Custom integrations should be adjusted to use `UnitOfArea.SQUARE_METERS`. + +More details can be found in the [Number documentation](/docs/core/entity/number#available-device-classes) and [Sensor documentation](/docs/core/entity/sensor#available-device-classes) diff --git a/docs/core/entity/number.md b/docs/core/entity/number.md index 5fb90ff5..4a0f5f18 100644 --- a/docs/core/entity/number.md +++ b/docs/core/entity/number.md @@ -33,6 +33,7 @@ If specifying a device class, your number entity will need to also return the co | ---- | ---- | ----------- | `NumberDeviceClass.APPARENT_POWER` | VA | Apparent power | | `NumberDeviceClass.AQI` | None | Air Quality Index +| `NumberDeviceClass.AREA` | m², cm², km², mm², in², ft², yd², mi², ac, ha | Area | | `NumberDeviceClass.ATMOSPHERIC_PRESSURE` | cbar, bar, hPa, inHg, kPa, mbar, Pa, psi | Atmospheric pressure, statistics will be stored in Pa. | `NumberDeviceClass.BATTERY` | % | Percentage of battery that is left | `NumberDeviceClass.BLOOD_GLUCOSE_CONCENTRATION` | mg/dL, mmol/L | Blood glucose concentration``` diff --git a/docs/core/entity/sensor.md b/docs/core/entity/sensor.md index ed593d20..218d13b7 100644 --- a/docs/core/entity/sensor.md +++ b/docs/core/entity/sensor.md @@ -34,7 +34,8 @@ If specifying a device class, your sensor entity will need to also return the co | ---- | ---- | ----------- | `SensorDeviceClass.APPARENT_POWER` | VA | Apparent power | `SensorDeviceClass.AQI` | None | Air Quality Index -| `SensorDeviceClass.ATMOSPHERIC_PRESSURE` | cbar, bar, hPa, mmHG, inHg, kPa, mbar, Pa, psi | Atmospheric pressure. +| `SensorDeviceClass.AREA` | m², cm², km², mm², in², ft², yd², mi², ac, ha | Area +| `SensorDeviceClass.ATMOSPHERIC_PRESSURE` | cbar, bar, hPa, mmHG, inHg, kPa, mbar, Pa, psi | Atmospheric pressure | `SensorDeviceClass.BATTERY` | % | Percentage of battery that is left | `SensorDeviceClass.BLOOD_GLUCOSE_CONCENTRATION` | mg/dL, mmol/L | Blood glucose concentration``` | `SensorDeviceClass.CO2` | ppm | Concentration of carbon dioxide.