From f2f7009e589c879eee65aedd89f79c42efbcf0ea Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 28 Jun 2022 10:23:12 +0200 Subject: [PATCH] Add blog post about WeatherEntity refactoring (#1375) Co-authored-by: Martin Hjelmare Co-authored-by: Franck Nijhof --- blog/2022-06-27-weather_entity_refactoring.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 blog/2022-06-27-weather_entity_refactoring.md diff --git a/blog/2022-06-27-weather_entity_refactoring.md b/blog/2022-06-27-weather_entity_refactoring.md new file mode 100644 index 00000000..a11dbf03 --- /dev/null +++ b/blog/2022-06-27-weather_entity_refactoring.md @@ -0,0 +1,30 @@ +--- +author: Erik Montnemery +authorURL: https://github.com/emontnemery +title: "Weather entity refactoring to support unit conversions" +--- + +`WeatherEntity` now supports temperature unit conversion following a similar pattern +as the unit conversion supported by `NumberEntity` and `SensorEntity`. + +Precipitation, pressure, temperature, visibility and wind speed are automatically +converted according to the unit system configured by the users. In addition, users can +override units for specific weather entities. + +To make this possible, custom component integrations should be updated to override +properties `native_precipitation_unit`, `native_pressure`, `native_pressure_unit`, + `native_temperature`, `native_temperature_unit`,`native_visibility`, `native_visibility_unit`, + `native_wind_speed` and `native_wind_speed_unit`, instead of `precipitation_unit`, + `pressure`, `pressure_unit`, `temperature`, `temperature_unit`,`visibility`, `visibility_unit`, + `wind_speed` and `wind_speed_unit`. + +The same renaming has been done for the corresponding `_attr_*` attributes as well +as for members of the `Forecast` typed dict + +In Home Assistant Core 2023.1, overriding `precipitation_unit`, + `pressure`, `pressure_unit`, `temperature`, `temperature_unit`,`visibility`, `visibility_unit`, + `wind_speed`, `wind_speed_unit`, setting `_attr_precipitation_unit`, + `_attr_pressure`, `_attr_pressure_unit`, `_attr_temperature`, `_attr_temperature_unit`, + `_attr_visibility`, `_attr_visibility_unit`, `_attr_wind_speed`, `_attr_wind_speed_unit` and +setting `precipitation`, `pressure`, `temperature`, `templow`, `wind_speed` on instances of +`Forecast` is no longer supported.