From 765d4eb3b4deb171f7133a5827256774caa6b496 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Tue, 14 Jun 2022 20:03:05 +0200 Subject: [PATCH] Revert Use unit system definitions for weather units (#10657) (#12946) --- src/data/weather.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/data/weather.ts b/src/data/weather.ts index 3fb6dca152..a09385b526 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -178,11 +178,17 @@ export const getWeatherUnit = ( hass: HomeAssistant, measure: string ): string => { + const lengthUnit = hass.config.unit_system.length || ""; switch (measure) { + case "pressure": + return lengthUnit === "km" ? "hPa" : "inHg"; + case "wind_speed": + return `${lengthUnit}/h`; case "visibility": - return hass.config.unit_system.length || ""; + case "length": + return lengthUnit; case "precipitation": - return hass.config.unit_system.accumulated_precipitation || ""; + return lengthUnit === "km" ? "mm" : "in"; case "humidity": case "precipitation_probability": return "%";