1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00
ha-core/homeassistant/components/met_eireann/const.py
Dylan Gore f3399aa8aa
Add a new weather integration - Met Éireann (#39429)
* Added a new weather integration - Met Éireann

* Fix codespell error

* Update met_eireann to use CoordinatorEntity

* Remove deprecated platform setup

* Fix merge conflict

* Remove unnecessary onboarding/home tracking code

* Use common strings for config flow

* Remove unnecessary code

* Switch to using unique IDs in config flow

* Use constants where possible

* Fix failing tests

* Fix isort errors

* Remove unnecessary DataUpdateCoordinator class

* Add device info

* Explicitly define forecast data

* Disable hourly forecast entity by default

* Update config flow to reflect requested changes

* Cleanup code

* Update entity naming to match other similar components

* Convert forecast time to UTC

* Fix test coverage

* Update test coverage

* Remove elevation conversion

* Update translations for additional clarity

* Remove en-GB translation
2021-04-05 23:23:57 +02:00

122 lines
3.1 KiB
Python

"""Constants for Met Éireann component."""
import logging
from homeassistant.components.weather import (
ATTR_CONDITION_CLEAR_NIGHT,
ATTR_CONDITION_CLOUDY,
ATTR_CONDITION_FOG,
ATTR_CONDITION_LIGHTNING_RAINY,
ATTR_CONDITION_PARTLYCLOUDY,
ATTR_CONDITION_RAINY,
ATTR_CONDITION_SNOWY,
ATTR_CONDITION_SNOWY_RAINY,
ATTR_CONDITION_SUNNY,
ATTR_FORECAST_CONDITION,
ATTR_FORECAST_PRECIPITATION,
ATTR_FORECAST_PRESSURE,
ATTR_FORECAST_TEMP,
ATTR_FORECAST_TEMP_LOW,
ATTR_FORECAST_TIME,
ATTR_FORECAST_WIND_BEARING,
ATTR_FORECAST_WIND_SPEED,
DOMAIN as WEATHER_DOMAIN,
)
ATTRIBUTION = "Data provided by Met Éireann"
DEFAULT_NAME = "Met Éireann"
DOMAIN = "met_eireann"
HOME_LOCATION_NAME = "Home"
ENTITY_ID_SENSOR_FORMAT_HOME = f"{WEATHER_DOMAIN}.met_eireann_{HOME_LOCATION_NAME}"
_LOGGER = logging.getLogger(".")
FORECAST_MAP = {
ATTR_FORECAST_CONDITION: "condition",
ATTR_FORECAST_PRESSURE: "pressure",
ATTR_FORECAST_PRECIPITATION: "precipitation",
ATTR_FORECAST_TEMP: "temperature",
ATTR_FORECAST_TEMP_LOW: "templow",
ATTR_FORECAST_TIME: "datetime",
ATTR_FORECAST_WIND_BEARING: "wind_bearing",
ATTR_FORECAST_WIND_SPEED: "wind_speed",
}
CONDITION_MAP = {
ATTR_CONDITION_CLEAR_NIGHT: ["Dark_Sun"],
ATTR_CONDITION_CLOUDY: ["Cloud"],
ATTR_CONDITION_FOG: ["Fog"],
ATTR_CONDITION_LIGHTNING_RAINY: [
"LightRainThunderSun",
"LightRainThunderSun",
"RainThunder",
"SnowThunder",
"SleetSunThunder",
"Dark_SleetSunThunder",
"SnowSunThunder",
"Dark_SnowSunThunder",
"LightRainThunder",
"SleetThunder",
"DrizzleThunderSun",
"Dark_DrizzleThunderSun",
"RainThunderSun",
"Dark_RainThunderSun",
"LightSleetThunderSun",
"Dark_LightSleetThunderSun",
"HeavySleetThunderSun",
"Dark_HeavySleetThunderSun",
"LightSnowThunderSun",
"Dark_LightSnowThunderSun",
"HeavySnowThunderSun",
"Dark_HeavySnowThunderSun",
"DrizzleThunder",
"LightSleetThunder",
"HeavySleetThunder",
"LightSnowThunder",
"HeavySnowThunder",
],
ATTR_CONDITION_PARTLYCLOUDY: [
"LightCloud",
"Dark_LightCloud",
"PartlyCloud",
"Dark_PartlyCloud",
],
ATTR_CONDITION_RAINY: [
"LightRainSun",
"Dark_LightRainSun",
"LightRain",
"Rain",
"DrizzleSun",
"Dark_DrizzleSun",
"RainSun",
"Dark_RainSun",
"Drizzle",
],
ATTR_CONDITION_SNOWY: [
"SnowSun",
"Dark_SnowSun",
"Snow",
"LightSnowSun",
"Dark_LightSnowSun",
"HeavySnowSun",
"Dark_HeavySnowSun",
"LightSnow",
"HeavySnow",
],
ATTR_CONDITION_SNOWY_RAINY: [
"SleetSun",
"Dark_SleetSun",
"Sleet",
"LightSleetSun",
"Dark_LightSleetSun",
"HeavySleetSun",
"Dark_HeavySleetSun",
"LightSleet",
"HeavySleet",
],
ATTR_CONDITION_SUNNY: "Sun",
}