Add entity translations to trafikverket weatherstation (#96251)
parent
cf999d9ba4
commit
b8369a5831
|
@ -87,32 +87,33 @@ class TrafikverketSensorEntityDescription(
|
||||||
SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="air_temp",
|
key="air_temp",
|
||||||
|
translation_key="air_temperature",
|
||||||
api_key="air_temp",
|
api_key="air_temp",
|
||||||
name="Air temperature",
|
|
||||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="road_temp",
|
key="road_temp",
|
||||||
|
translation_key="road_temperature",
|
||||||
api_key="road_temp",
|
api_key="road_temp",
|
||||||
name="Road temperature",
|
|
||||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="precipitation",
|
key="precipitation",
|
||||||
|
translation_key="precipitation",
|
||||||
api_key="precipitationtype_translated",
|
api_key="precipitationtype_translated",
|
||||||
name="Precipitation type",
|
name="Precipitation type",
|
||||||
icon="mdi:weather-snowy-rainy",
|
icon="mdi:weather-snowy-rainy",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
translation_key="precipitation",
|
|
||||||
options=PRECIPITATION_TYPE,
|
options=PRECIPITATION_TYPE,
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="wind_direction",
|
key="wind_direction",
|
||||||
|
translation_key="wind_direction",
|
||||||
api_key="winddirection",
|
api_key="winddirection",
|
||||||
name="Wind direction",
|
name="Wind direction",
|
||||||
native_unit_of_measurement=DEGREE,
|
native_unit_of_measurement=DEGREE,
|
||||||
|
@ -121,25 +122,24 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="wind_direction_text",
|
key="wind_direction_text",
|
||||||
|
translation_key="wind_direction_text",
|
||||||
api_key="winddirectiontext_translated",
|
api_key="winddirectiontext_translated",
|
||||||
name="Wind direction text",
|
name="Wind direction text",
|
||||||
icon="mdi:flag-triangle",
|
icon="mdi:flag-triangle",
|
||||||
translation_key="wind_direction_text",
|
|
||||||
options=WIND_DIRECTIONS,
|
options=WIND_DIRECTIONS,
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="wind_speed",
|
key="wind_speed",
|
||||||
api_key="windforce",
|
api_key="windforce",
|
||||||
name="Wind speed",
|
|
||||||
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
|
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
|
||||||
device_class=SensorDeviceClass.WIND_SPEED,
|
device_class=SensorDeviceClass.WIND_SPEED,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="wind_speed_max",
|
key="wind_speed_max",
|
||||||
|
translation_key="wind_speed_max",
|
||||||
api_key="windforcemax",
|
api_key="windforcemax",
|
||||||
name="Wind speed max",
|
|
||||||
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
|
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
|
||||||
device_class=SensorDeviceClass.WIND_SPEED,
|
device_class=SensorDeviceClass.WIND_SPEED,
|
||||||
icon="mdi:weather-windy-variant",
|
icon="mdi:weather-windy-variant",
|
||||||
|
@ -149,9 +149,7 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="humidity",
|
key="humidity",
|
||||||
api_key="humidity",
|
api_key="humidity",
|
||||||
name="Humidity",
|
|
||||||
native_unit_of_measurement=PERCENTAGE,
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
icon="mdi:water-percent",
|
|
||||||
device_class=SensorDeviceClass.HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
@ -159,25 +157,23 @@ SENSOR_TYPES: tuple[TrafikverketSensorEntityDescription, ...] = (
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="precipitation_amount",
|
key="precipitation_amount",
|
||||||
api_key="precipitation_amount",
|
api_key="precipitation_amount",
|
||||||
name="Precipitation amount",
|
|
||||||
native_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
|
native_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
|
||||||
device_class=SensorDeviceClass.PRECIPITATION_INTENSITY,
|
device_class=SensorDeviceClass.PRECIPITATION_INTENSITY,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="precipitation_amountname",
|
key="precipitation_amountname",
|
||||||
|
translation_key="precipitation_amountname",
|
||||||
api_key="precipitation_amountname_translated",
|
api_key="precipitation_amountname_translated",
|
||||||
name="Precipitation name",
|
|
||||||
icon="mdi:weather-pouring",
|
icon="mdi:weather-pouring",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
translation_key="precipitation_amountname",
|
|
||||||
options=PRECIPITATION_AMOUNTNAME,
|
options=PRECIPITATION_AMOUNTNAME,
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
),
|
),
|
||||||
TrafikverketSensorEntityDescription(
|
TrafikverketSensorEntityDescription(
|
||||||
key="measure_time",
|
key="measure_time",
|
||||||
|
translation_key="measure_time",
|
||||||
api_key="measure_time",
|
api_key="measure_time",
|
||||||
name="Measure Time",
|
|
||||||
icon="mdi:clock",
|
icon="mdi:clock",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
|
|
|
@ -20,7 +20,29 @@
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
"sensor": {
|
"sensor": {
|
||||||
|
"air_temperature": {
|
||||||
|
"name": "Air temperature"
|
||||||
|
},
|
||||||
|
"road_temperature": {
|
||||||
|
"name": "Road temperature"
|
||||||
|
},
|
||||||
|
"precipitation": {
|
||||||
|
"name": "Precipitation type",
|
||||||
|
"state": {
|
||||||
|
"drizzle": "Drizzle",
|
||||||
|
"hail": "Hail",
|
||||||
|
"none": "None",
|
||||||
|
"rain": "Rain",
|
||||||
|
"snow": "Snow",
|
||||||
|
"rain_snow_mixed": "Rain and snow mixed",
|
||||||
|
"freezing_rain": "Freezing rain"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wind_direction": {
|
||||||
|
"name": "Wind direction"
|
||||||
|
},
|
||||||
"wind_direction_text": {
|
"wind_direction_text": {
|
||||||
|
"name": "Wind direction text",
|
||||||
"state": {
|
"state": {
|
||||||
"east": "East",
|
"east": "East",
|
||||||
"north_east": "North east",
|
"north_east": "North east",
|
||||||
|
@ -36,7 +58,11 @@
|
||||||
"west": "West"
|
"west": "West"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"wind_speed_max": {
|
||||||
|
"name": "Wind speed max"
|
||||||
|
},
|
||||||
"precipitation_amountname": {
|
"precipitation_amountname": {
|
||||||
|
"name": "Precipitation name",
|
||||||
"state": {
|
"state": {
|
||||||
"error": "Error",
|
"error": "Error",
|
||||||
"mild_rain": "Mild rain",
|
"mild_rain": "Mild rain",
|
||||||
|
@ -53,16 +79,8 @@
|
||||||
"unknown": "Unknown"
|
"unknown": "Unknown"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"precipitation": {
|
"measure_time": {
|
||||||
"state": {
|
"name": "Measure time"
|
||||||
"drizzle": "Drizzle",
|
|
||||||
"hail": "Hail",
|
|
||||||
"none": "None",
|
|
||||||
"rain": "Rain",
|
|
||||||
"snow": "Snow",
|
|
||||||
"rain_snow_mixed": "Rain and snow mixed",
|
|
||||||
"freezing_rain": "Freezing rain"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue