Use separate weather condition for clear night in MetOffice forecasts (#55135)

This commit is contained in:
avee87 2021-10-16 23:57:47 +01:00 committed by GitHub
parent d64f210b67
commit 6a80559fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@
from datetime import timedelta
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_EXCEPTIONAL,
ATTR_CONDITION_FOG,
@ -37,6 +38,7 @@ MODE_DAILY = "daily"
MODE_DAILY_LABEL = "Daily"
CONDITION_CLASSES = {
ATTR_CONDITION_CLEAR_NIGHT: ["0"],
ATTR_CONDITION_CLOUDY: ["7", "8"],
ATTR_CONDITION_FOG: ["5", "6"],
ATTR_CONDITION_HAIL: ["19", "20", "21"],
@ -47,7 +49,7 @@ CONDITION_CLASSES = {
ATTR_CONDITION_RAINY: ["9", "10", "11", "12"],
ATTR_CONDITION_SNOWY: ["22", "23", "24", "25", "26", "27"],
ATTR_CONDITION_SNOWY_RAINY: ["16", "17", "18"],
ATTR_CONDITION_SUNNY: ["0", "1"],
ATTR_CONDITION_SUNNY: ["1"],
ATTR_CONDITION_WINDY: [],
ATTR_CONDITION_WINDY_VARIANT: [],
ATTR_CONDITION_EXCEPTIONAL: [],

View File

@ -231,7 +231,7 @@ async def test_two_weather_sites_running(hass, requests_mock, legacy_patchable_t
weather.attributes.get("forecast")[18]["datetime"]
== "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]["wind_speed"] == 4
assert weather.attributes.get("forecast")[18]["wind_bearing"] == "NW"