mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 18:27:51 +00:00
Use separate weather condition for clear night in MetOffice forecasts (#55135)
This commit is contained in:
parent
d64f210b67
commit
6a80559fa8
@ -2,6 +2,7 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from homeassistant.components.weather import (
|
from homeassistant.components.weather import (
|
||||||
|
ATTR_CONDITION_CLEAR_NIGHT,
|
||||||
ATTR_CONDITION_CLOUDY,
|
ATTR_CONDITION_CLOUDY,
|
||||||
ATTR_CONDITION_EXCEPTIONAL,
|
ATTR_CONDITION_EXCEPTIONAL,
|
||||||
ATTR_CONDITION_FOG,
|
ATTR_CONDITION_FOG,
|
||||||
@ -37,6 +38,7 @@ MODE_DAILY = "daily"
|
|||||||
MODE_DAILY_LABEL = "Daily"
|
MODE_DAILY_LABEL = "Daily"
|
||||||
|
|
||||||
CONDITION_CLASSES = {
|
CONDITION_CLASSES = {
|
||||||
|
ATTR_CONDITION_CLEAR_NIGHT: ["0"],
|
||||||
ATTR_CONDITION_CLOUDY: ["7", "8"],
|
ATTR_CONDITION_CLOUDY: ["7", "8"],
|
||||||
ATTR_CONDITION_FOG: ["5", "6"],
|
ATTR_CONDITION_FOG: ["5", "6"],
|
||||||
ATTR_CONDITION_HAIL: ["19", "20", "21"],
|
ATTR_CONDITION_HAIL: ["19", "20", "21"],
|
||||||
@ -47,7 +49,7 @@ CONDITION_CLASSES = {
|
|||||||
ATTR_CONDITION_RAINY: ["9", "10", "11", "12"],
|
ATTR_CONDITION_RAINY: ["9", "10", "11", "12"],
|
||||||
ATTR_CONDITION_SNOWY: ["22", "23", "24", "25", "26", "27"],
|
ATTR_CONDITION_SNOWY: ["22", "23", "24", "25", "26", "27"],
|
||||||
ATTR_CONDITION_SNOWY_RAINY: ["16", "17", "18"],
|
ATTR_CONDITION_SNOWY_RAINY: ["16", "17", "18"],
|
||||||
ATTR_CONDITION_SUNNY: ["0", "1"],
|
ATTR_CONDITION_SUNNY: ["1"],
|
||||||
ATTR_CONDITION_WINDY: [],
|
ATTR_CONDITION_WINDY: [],
|
||||||
ATTR_CONDITION_WINDY_VARIANT: [],
|
ATTR_CONDITION_WINDY_VARIANT: [],
|
||||||
ATTR_CONDITION_EXCEPTIONAL: [],
|
ATTR_CONDITION_EXCEPTIONAL: [],
|
||||||
|
@ -231,7 +231,7 @@ async def test_two_weather_sites_running(hass, requests_mock, legacy_patchable_t
|
|||||||
weather.attributes.get("forecast")[18]["datetime"]
|
weather.attributes.get("forecast")[18]["datetime"]
|
||||||
== "2020-04-27T21:00:00+00:00"
|
== "2020-04-27T21:00:00+00:00"
|
||||||
)
|
)
|
||||||
assert weather.attributes.get("forecast")[18]["condition"] == "sunny"
|
assert weather.attributes.get("forecast")[18]["condition"] == "clear-night"
|
||||||
assert weather.attributes.get("forecast")[18]["temperature"] == 9
|
assert weather.attributes.get("forecast")[18]["temperature"] == 9
|
||||||
assert weather.attributes.get("forecast")[18]["wind_speed"] == 4
|
assert weather.attributes.get("forecast")[18]["wind_speed"] == 4
|
||||||
assert weather.attributes.get("forecast")[18]["wind_bearing"] == "NW"
|
assert weather.attributes.get("forecast")[18]["wind_bearing"] == "NW"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user