hass-core/homeassistant/components/metoffice/const.py
avee87 2d1744c573
Add forecasts to MetOffice integration (#50876)
* MetOfficeData now retrieves both 3-hourly and daily data (full forecast data, as well as "now" snapshot) on each update

* Bump datapoint API up to latest version

* Create 2 sets of sensors - one of each set for 3-hourly and for daily data (same ones initially enabled, for now)

* Create two entities (one each for 3-hourly and daily data) and also add in the forecast data for each dataset

* Testing changes to accommodate now having two sets of everything for 3-hourly and daily update data

* Removed unused import (reported by flake8)

* As per conversation with @MatthewFlamm leave the 3-hourly entity's unique_id unchanged (although the display name is changed)

* Make some improvements based on reviews

Make some improvements and fix up the formatting/linting failures.

* Make some improvements based on reviews

Make some improvements and fix up the formatting/linting failures.

* Added more test coverage

* import asyncio

* Try to fix test

* Rewrote everything using CoordinatorEntity

* Fixed config flow

* Fixed lint errors

Co-authored-by: MrHarcombe <ian.harcombe@gmail.com>
Co-authored-by: Henco Appel <hencoappel+github@gmail.com>
2021-06-27 15:04:42 -04:00

72 lines
1.9 KiB
Python

"""Constants for Met Office Integration."""
from datetime import timedelta
from homeassistant.components.weather import (
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_EXCEPTIONAL,
ATTR_CONDITION_FOG,
ATTR_CONDITION_HAIL,
ATTR_CONDITION_LIGHTNING,
ATTR_CONDITION_LIGHTNING_RAINY,
ATTR_CONDITION_PARTLYCLOUDY,
ATTR_CONDITION_POURING,
ATTR_CONDITION_RAINY,
ATTR_CONDITION_SNOWY,
ATTR_CONDITION_SNOWY_RAINY,
ATTR_CONDITION_SUNNY,
ATTR_CONDITION_WINDY,
ATTR_CONDITION_WINDY_VARIANT,
)
DOMAIN = "metoffice"
DEFAULT_NAME = "Met Office"
ATTRIBUTION = "Data provided by the Met Office"
DEFAULT_SCAN_INTERVAL = timedelta(minutes=15)
METOFFICE_COORDINATES = "metoffice_coordinates"
METOFFICE_HOURLY_COORDINATOR = "metoffice_hourly_coordinator"
METOFFICE_DAILY_COORDINATOR = "metoffice_daily_coordinator"
METOFFICE_MONITORED_CONDITIONS = "metoffice_monitored_conditions"
METOFFICE_NAME = "metoffice_name"
MODE_3HOURLY = "3hourly"
MODE_3HOURLY_LABEL = "3-Hourly"
MODE_DAILY = "daily"
MODE_DAILY_LABEL = "Daily"
CONDITION_CLASSES = {
ATTR_CONDITION_CLOUDY: ["7", "8"],
ATTR_CONDITION_FOG: ["5", "6"],
ATTR_CONDITION_HAIL: ["19", "20", "21"],
ATTR_CONDITION_LIGHTNING: ["30"],
ATTR_CONDITION_LIGHTNING_RAINY: ["28", "29"],
ATTR_CONDITION_PARTLYCLOUDY: ["2", "3"],
ATTR_CONDITION_POURING: ["13", "14", "15"],
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_WINDY: [],
ATTR_CONDITION_WINDY_VARIANT: [],
ATTR_CONDITION_EXCEPTIONAL: [],
}
VISIBILITY_CLASSES = {
"VP": "Very Poor",
"PO": "Poor",
"MO": "Moderate",
"GO": "Good",
"VG": "Very Good",
"EX": "Excellent",
}
VISIBILITY_DISTANCE_CLASSES = {
"VP": "<1",
"PO": "1-4",
"MO": "4-10",
"GO": "10-20",
"VG": "20-40",
"EX": ">40",
}