Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blog and update number and sensor entity docs #2448

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
25 changes: 25 additions & 0 deletions blog/2024-12-04-area-squared-units.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
author: mikey0000
authorURL: https://github.com/mikey0000
title: "Area squared unit enumerators"
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved
---

As of Home Assistant Core 2024.12, the following unit constant is deprecated and replaced by a corresponding enum:
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved

- `UnitOfArea` enumerator replaces `AREA_SQUARE_METERS` constant
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved

Area units can also be converted between us customary and metric units using `AreaConverter`

mikey0000 marked this conversation as resolved.
Show resolved Hide resolved
# Example

```python
AreaConverter.convert(10, UnitOfArea.SQUARE_KILOMETERS, UnitOfArea.SQUARE_MILES)
```
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved

Number entity has the addition of `NumberDeviceClass.AREA`.

More details can be found in the Number [documentation](/docs/core/entity/number#available-device-classes)

Sensor entity has the addition of `SensorDeviceClass.AREA`.

More details can be found in the Sensor [documentation](/docs/core/entity/sensor#available-device-classes)
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved
mikey0000 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions docs/core/entity/number.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ If specifying a device class, your number entity will need to also return the co
| ---- | ---- | -----------
| `NumberDeviceClass.APPARANT_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```
Expand Down
3 changes: 2 additions & 1 deletion docs/core/entity/sensor.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down