diff --git a/homeassistant/components/trafikverket_weatherstation/sensor.py b/homeassistant/components/trafikverket_weatherstation/sensor.py index 6dfd6a5e7c4..8523ded1fff 100644 --- a/homeassistant/components/trafikverket_weatherstation/sensor.py +++ b/homeassistant/components/trafikverket_weatherstation/sensor.py @@ -30,6 +30,45 @@ from homeassistant.util.dt import as_utc from .const import ATTRIBUTION, CONF_STATION, DOMAIN, NONE_IS_ZERO_SENSORS from .coordinator import TVDataUpdateCoordinator +WIND_DIRECTIONS = [ + "east", + "north_east", + "east_south_east", + "north", + "north_north_east", + "north_north_west", + "north_west", + "south", + "south_east", + "south_south_west", + "south_west", + "west", +] +PRECIPITATION_AMOUNTNAME = [ + "error", + "mild_rain", + "moderate_rain", + "heavy_rain", + "mild_snow_rain", + "moderate_snow_rain", + "heavy_snow_rain", + "mild_snow", + "moderate_snow", + "heavy_snow", + "other", + "none", + "error", +] +PRECIPITATION_TYPE = [ + "drizzle", + "hail", + "none", + "rain", + "snow", + "rain_snow_mixed", + "freezing_rain", +] + @dataclass class TrafikverketRequiredKeysMixin: @@ -64,10 +103,13 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = ( ), TrafikverketSensorEntityDescription( key="precipitation", - api_key="precipitationtype", + api_key="precipitationtype_translated", name="Precipitation type", icon="mdi:weather-snowy-rainy", entity_registry_enabled_default=False, + translation_key="precipitation", + options=PRECIPITATION_TYPE, + device_class=SensorDeviceClass.ENUM, ), TrafikverketSensorEntityDescription( key="wind_direction", @@ -79,9 +121,12 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = ( ), TrafikverketSensorEntityDescription( key="wind_direction_text", - api_key="winddirectiontext", + api_key="winddirectiontext_translated", name="Wind direction text", icon="mdi:flag-triangle", + translation_key="wind_direction_text", + options=WIND_DIRECTIONS, + device_class=SensorDeviceClass.ENUM, ), TrafikverketSensorEntityDescription( key="wind_speed", @@ -121,10 +166,13 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = ( ), TrafikverketSensorEntityDescription( key="precipitation_amountname", - api_key="precipitation_amountname", + api_key="precipitation_amountname_translated", name="Precipitation name", icon="mdi:weather-pouring", entity_registry_enabled_default=False, + translation_key="precipitation_amountname", + options=PRECIPITATION_AMOUNTNAME, + device_class=SensorDeviceClass.ENUM, ), TrafikverketSensorEntityDescription( key="measure_time", diff --git a/homeassistant/components/trafikverket_weatherstation/strings.json b/homeassistant/components/trafikverket_weatherstation/strings.json index 1ac4bbed01e..3680fae6d8c 100644 --- a/homeassistant/components/trafikverket_weatherstation/strings.json +++ b/homeassistant/components/trafikverket_weatherstation/strings.json @@ -17,5 +17,53 @@ } } } + }, + "entity": { + "sensor": { + "wind_direction_text": { + "state": { + "east": "East", + "north_east": "North east", + "east_south_east": "East-south east", + "north": "North", + "north_north_east": "North-north east", + "north_north_west": "North-north west", + "north_west": "North west", + "south": "South", + "south_east": "South east", + "south_south_west": "South-south west", + "south_west": "South west", + "west": "West" + } + }, + "precipitation_amountname": { + "state": { + "error": "Error", + "mild_rain": "Mild rain", + "moderate_rain": "Moderate rain", + "heavy_rain": "Heavy rain", + "mild_snow_rain": "Mild rain and snow mixed", + "moderate_snow_rain": "Moderate rain and snow mixed", + "heavy_snow_rain": "Heavy rain and snow mixed", + "mild_snow": "Mild snow", + "moderate_snow": "Moderate snow", + "heavy_snow": "Heavy snow", + "other": "Other", + "none": "None", + "unknown": "Unknown" + } + }, + "precipitation": { + "state": { + "drizzle": "Drizzle", + "hail": "Hail", + "none": "None", + "rain": "Rain", + "snow": "Snow", + "rain_snow_mixed": "Rain and snow mixed", + "freezing_rain": "Freezing rain" + } + } + } } }