Revert Use unit system definitions for weather units (#10657) (#12946)

This commit is contained in:
Erik Montnemery 2022-06-14 20:03:05 +02:00 committed by GitHub
parent cc09e24d66
commit 765d4eb3b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,11 +178,17 @@ export const getWeatherUnit = (
hass: HomeAssistant, hass: HomeAssistant,
measure: string measure: string
): string => { ): string => {
const lengthUnit = hass.config.unit_system.length || "";
switch (measure) { switch (measure) {
case "pressure":
return lengthUnit === "km" ? "hPa" : "inHg";
case "wind_speed":
return `${lengthUnit}/h`;
case "visibility": case "visibility":
return hass.config.unit_system.length || ""; case "length":
return lengthUnit;
case "precipitation": case "precipitation":
return hass.config.unit_system.accumulated_precipitation || ""; return lengthUnit === "km" ? "mm" : "in";
case "humidity": case "humidity":
case "precipitation_probability": case "precipitation_probability":
return "%"; return "%";