mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-19 15:26:36 +00:00
Use unit system definitions for weather units (#10657)
This commit is contained in:
parent
2a5fc5181e
commit
a6b5262d02
@ -102,7 +102,7 @@
|
|||||||
"fuse.js": "^6.0.0",
|
"fuse.js": "^6.0.0",
|
||||||
"google-timezones-json": "^1.0.2",
|
"google-timezones-json": "^1.0.2",
|
||||||
"hls.js": "^1.0.11",
|
"hls.js": "^1.0.11",
|
||||||
"home-assistant-js-websocket": "^5.11.1",
|
"home-assistant-js-websocket": "^5.11.3",
|
||||||
"idb-keyval": "^5.1.3",
|
"idb-keyval": "^5.1.3",
|
||||||
"intl-messageformat": "^9.9.1",
|
"intl-messageformat": "^9.9.1",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
|
@ -152,17 +152,11 @@ 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":
|
||||||
case "length":
|
return hass.config.unit_system.length || "";
|
||||||
return lengthUnit;
|
|
||||||
case "precipitation":
|
case "precipitation":
|
||||||
return lengthUnit === "km" ? "mm" : "in";
|
return hass.config.unit_system.accumulated_precipitation || "";
|
||||||
case "humidity":
|
case "humidity":
|
||||||
case "precipitation_probability":
|
case "precipitation_probability":
|
||||||
return "%";
|
return "%";
|
||||||
|
@ -10,6 +10,9 @@ export const demoConfig: HassConfig = {
|
|||||||
mass: "kg",
|
mass: "kg",
|
||||||
temperature: "°C",
|
temperature: "°C",
|
||||||
volume: "L",
|
volume: "L",
|
||||||
|
pressure: "Pa",
|
||||||
|
wind_speed: "m/s",
|
||||||
|
accumulated_precipitation: "mm",
|
||||||
},
|
},
|
||||||
components: [
|
components: [
|
||||||
"notify.html5",
|
"notify.html5",
|
||||||
|
10
yarn.lock
10
yarn.lock
@ -9113,7 +9113,7 @@ fsevents@^1.2.7:
|
|||||||
gulp-rename: ^2.0.0
|
gulp-rename: ^2.0.0
|
||||||
gulp-zopfli-green: ^3.0.1
|
gulp-zopfli-green: ^3.0.1
|
||||||
hls.js: ^1.0.11
|
hls.js: ^1.0.11
|
||||||
home-assistant-js-websocket: ^5.11.1
|
home-assistant-js-websocket: ^5.11.3
|
||||||
html-minifier: ^4.0.0
|
html-minifier: ^4.0.0
|
||||||
husky: ^1.3.1
|
husky: ^1.3.1
|
||||||
idb-keyval: ^5.1.3
|
idb-keyval: ^5.1.3
|
||||||
@ -9184,10 +9184,10 @@ fsevents@^1.2.7:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
"home-assistant-js-websocket@npm:^5.11.1":
|
"home-assistant-js-websocket@npm:^5.11.3":
|
||||||
version: 5.11.1
|
version: 5.11.3
|
||||||
resolution: "home-assistant-js-websocket@npm:5.11.1"
|
resolution: "home-assistant-js-websocket@npm:5.11.3"
|
||||||
checksum: 4b3f4310ea15f758a47082ddde06ed46eeddcae490a59a16dbcec4fb798507a5cc4761b9e880261aed9f83335475abea8356d5239c081774caa335e5e76fba50
|
checksum: 3ab90e5105c5f379d77fb23ab53eaec2789be7bf1fd507a7520d9cf329d36942b8e978a591b822cff96100630d43bd036a4e25e2f49c40d0c56a111808fb90a5
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user