From 53d63c12237ef97ba7ca444181ddbcabf6b137dd Mon Sep 17 00:00:00 2001 From: Marco Gosselink Date: Sun, 12 May 2024 16:19:56 +0200 Subject: [PATCH] Corrected translation keys --- .../davis_vantage/binary_sensor.py | 8 +- custom_components/davis_vantage/const.py | 71 +++++++++ custom_components/davis_vantage/sensor.py | 141 +++++++++--------- .../davis_vantage/translations/en.json | 134 ++++++++--------- .../davis_vantage/translations/nl.json | 136 ++++++++--------- 5 files changed, 281 insertions(+), 209 deletions(-) diff --git a/custom_components/davis_vantage/binary_sensor.py b/custom_components/davis_vantage/binary_sensor.py index be5a2c7..c0df96c 100755 --- a/custom_components/davis_vantage/binary_sensor.py +++ b/custom_components/davis_vantage/binary_sensor.py @@ -8,13 +8,13 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity -from .const import DEFAULT_NAME, DOMAIN +from .const import DEFAULT_NAME, DOMAIN, KEY_TO_NAME from .coordinator import DavisVantageDataUpdateCoordinator DESCRIPTIONS: list[BinarySensorEntityDescription] = [ BinarySensorEntityDescription( key="IsRaining", - translation_key="Is Raining" + translation_key="is_raining" ) ] @@ -57,8 +57,8 @@ def __init__( """Initialize Davis Vantage sensor.""" super().__init__(coordinator=coordinator) self.entity_description = description - self.entity_id = f"{BINARY_SENSOR_DOMAIN}.{DEFAULT_NAME} {description.translation_key}".lower() - self._attr_unique_id = f"{entry_id}-{DEFAULT_NAME} {description.translation_key}" + self.entity_id = f"{BINARY_SENSOR_DOMAIN}.{DEFAULT_NAME} {KEY_TO_NAME[description.key]}".lower() + self._attr_unique_id = f"{entry_id}-{DEFAULT_NAME} {KEY_TO_NAME[description.key]}" self._attr_device_info = coordinator.device_info @property diff --git a/custom_components/davis_vantage/const.py b/custom_components/davis_vantage/const.py index fbda66d..9dde2a2 100755 --- a/custom_components/davis_vantage/const.py +++ b/custom_components/davis_vantage/const.py @@ -30,3 +30,74 @@ CONFIG_INTERVAL = "interval" CONFIG_PROTOCOL = "protocol" CONFIG_LINK = "link" + +KEY_TO_NAME = { + "Datetime": "Last Fetch Time", + "LastSuccessTime": "Last Success Time", + "LastErrorTime": "Last Error Time", + "LastError": "Last Error Message", + "ArchiveInterval": "Archive Interval", + "TempOut": "Temperature", + "TempOutHiDay": "Temperature High (Day)", + "TempOutHiTime": "Temperature High Time", + "TempOutLowDay": "Temperature Low (Day)", + "TempOutLowTime": "Temperature Low Time", + "TempIn": "Temperature (Inside)", + "HeatIndex": "Heat Index", + "WindChill": "Wind Chill", + "FeelsLike": "Feels Like", + "DewPoint": "Dew Point", + "DewPointHiDay": "Dew Point High (Day)", + "DewPointHiTime": "Dew Point High Time", + "DewPointLowDay": "Dew Point Low (Day)", + "DewPointLowTime": "Dew Point Low Time", + "Barometer": "Barometric Pressure", + "BarometerHiDay": "Barometric Pressure High (Day)", + "BarometerHiTime": "Barometric Pressure High Time", + "BarometerLowDay": "Barometric Pressure Low (Day)", + "BarometerLoTime": "Barometric Pressure Low Time", + "BarTrend": "Barometric Trend", + "HumIn": "Humidity (Inside)", + "HumOut": "Humidity", + "WindSpeed": "Wind Speed", + "WindSpeed10Min": "Wind Speed (Average)", + "WindGust": "Wind Gust", + "WindGustDay": "Wind Gust (Day)", + "WindGustTime": "Wind Gust Time", + "WindDir": "Wind Direction", + "WindDirRose": "Wind Direction Rose", + "WindSpeedBft": "Wind Speed (Bft)", + "RainDay": "Rain (Day)", + "RainMonth": "Rain (Month)", + "RainYear": "Rain (Year)", + "RainRate": "Rain Rate", + "RainRateDay": "Rain Rate (Day)", + "RainRateTime": "Rain Rate Time", + "UV": "UV Level", + "UVDay": "UV Level (Day)", + "UVTime": "UV Level Time", + "SolarRad": "Solar Radiation", + "SolarRadDay": "Solar Radiation (Day)", + "SolarRadTime": "Solar Radiation Time", + "BatteryVolts": "Battery Voltage", + "ForecastIcon": "Forecast Icon", + "ForecastRuleNo": "Forecast Rule", + "RainCollector": "Rain Collector", + "RainStorm": "Rain Storm", + "StormStartDate": "Rain Storm Start Date", + "ExtraTemps01": "Extra Temperature 1", + "ExtraTemps02": "Extra Temperature 2", + "ExtraTemps03": "Extra Temperature 3", + "ExtraTemps04": "Extra Temperature 4", + "ExtraTemps05": "Extra Temperature 5", + "ExtraTemps06": "Extra Temperature 6", + "ExtraTemps07": "Extra Temperature 7", + "HumExtra01": "Extra Humidity 1", + "HumExtra02": "Extra Humidity 2", + "HumExtra03": "Extra Humidity 3", + "HumExtra04": "Extra Humidity 4", + "HumExtra05": "Extra Humidity 5", + "HumExtra06": "Extra Humidity 6", + "HumExtra07": "Extra Humidity 7", + "IsRaining": "Is Raining" +} \ No newline at end of file diff --git a/custom_components/davis_vantage/sensor.py b/custom_components/davis_vantage/sensor.py index d3bf57a..3980e1d 100755 --- a/custom_components/davis_vantage/sensor.py +++ b/custom_components/davis_vantage/sensor.py @@ -30,7 +30,8 @@ RAIN_COLLECTOR_IMPERIAL, RAIN_COLLECTOR_METRIC, CONFIG_STATION_MODEL, - MODEL_VANTAGE_PRO2PLUS + MODEL_VANTAGE_PRO2PLUS, + KEY_TO_NAME ) from .coordinator import DavisVantageDataUpdateCoordinator @@ -41,7 +42,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: descriptions: list[SensorEntityDescription] = [ SensorEntityDescription( key="Datetime", - translation_key="Last Fetch Time", + translation_key="last_fetch_time", icon="mdi:clock-outline", device_class=SensorDeviceClass.TIMESTAMP, entity_category=EntityCategory.DIAGNOSTIC, @@ -49,7 +50,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="LastSuccessTime", - translation_key="Last Success Time", + translation_key="last_success_time", icon="mdi:clock-outline", device_class=SensorDeviceClass.TIMESTAMP, entity_category=EntityCategory.DIAGNOSTIC, @@ -57,7 +58,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="LastErrorTime", - translation_key="Last Error Time", + translation_key="last_error_time", icon="mdi:clock-outline", device_class=SensorDeviceClass.TIMESTAMP, entity_category=EntityCategory.DIAGNOSTIC, @@ -65,14 +66,14 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="LastError", - translation_key="Last Error Message", + translation_key="last_error_message", icon="mdi:message-alert-outline", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False ), SensorEntityDescription( key="ArchiveInterval", - translation_key="Archive Interval", + translation_key="archive_interval", icon="mdi:archive-clock-outline", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -80,7 +81,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="TempOut", - translation_key="Temperature", + translation_key="temperature", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, @@ -88,7 +89,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="TempOutHiDay", - translation_key="Temperature High (Day)", + translation_key="temperature_high_day", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, @@ -97,12 +98,12 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="TempOutHiTime", - translation_key="Temperature High Time", + translation_key="temperature_high_time", icon="mdi:clock-in" ), SensorEntityDescription( key="TempOutLowDay", - translation_key="Temperature Low (Day)", + translation_key="temperature_low_day", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, @@ -111,12 +112,12 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="TempOutLowTime", - translation_key="Temperature Low Time", + translation_key="temperature_low_time", icon="mdi:clock-in" ), SensorEntityDescription( key="TempIn", - translation_key="Temperature (Inside)", + translation_key="temperature_inside", device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, suggested_display_precision=1, @@ -124,7 +125,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HeatIndex", - translation_key="Heat Index", + translation_key="heat_index", icon="mdi:sun-thermometer-outline", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -133,7 +134,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindChill", - translation_key="Wind Chill", + translation_key="wind_chill", icon="mdi:snowflake-thermometer", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -142,7 +143,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="FeelsLike", - translation_key="Feels Like", + translation_key="feels_like", icon="mdi:download-circle-outline", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -151,7 +152,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="DewPoint", - translation_key="Dew Point", + translation_key="dew_point", icon="mdi:water-thermometer-outline", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -160,7 +161,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="DewPointHiDay", - translation_key="Dew Point High (Day)", + translation_key="dew_point_high_day", icon="mdi:water-thermometer-outline", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -169,12 +170,12 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="DewPointHiTime", - translation_key="Dew Point High Time", + translation_key="dew_point_high_time", icon="mdi:clock-in" ), SensorEntityDescription( key="DewPointLowDay", - translation_key="Dew Point Low (Day)", + translation_key="dew_point_low_day", icon="mdi:water-thermometer-outline", device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -183,12 +184,12 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="DewPointLowTime", - translation_key="Dew Point Low Time", + translation_key="dew_point_low_time", icon="mdi:clock-in" ), SensorEntityDescription( key="Barometer", - translation_key="Barometric Pressure", + translation_key="barometric_pressure", device_class=SensorDeviceClass.PRESSURE, state_class="measurement", native_unit_of_measurement=UnitOfPressure.INHG, @@ -196,7 +197,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="BarometerHiDay", - translation_key="Barometric Pressure High (Day)", + translation_key="barometric_pressure_high_day", device_class=SensorDeviceClass.PRESSURE, state_class="measurement", native_unit_of_measurement=UnitOfPressure.INHG, @@ -204,12 +205,12 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="BarometerHiTime", - translation_key="Barometric Pressure High Time", + translation_key="barometric_pressure_high_time", icon="mdi:clock-in" ), SensorEntityDescription( key="BarometerLowDay", - translation_key="Barometric Pressure Low (Day)", + translation_key="barometric_pressure_low_day", device_class=SensorDeviceClass.PRESSURE, state_class="measurement", native_unit_of_measurement=UnitOfPressure.INHG, @@ -217,12 +218,12 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="BarometerLoTime", - translation_key="Barometric Pressure Low Time", + translation_key="barometric_pressure_low_time", icon="mdi:clock-in" ), SensorEntityDescription( key="BarTrend", - translation_key="Barometric Trend", + translation_key="barometric_trend", device_class=SensorDeviceClass.ENUM, options=[ "falling_rapidly", @@ -234,7 +235,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumIn", - translation_key="Humidity (Inside)", + translation_key="humidity_inside", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -242,7 +243,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumOut", - translation_key="Humidity", + translation_key="humidity", device_class=SensorDeviceClass.HUMIDITY, state_class="measurement", native_unit_of_measurement=PERCENTAGE, @@ -250,7 +251,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindSpeed", - translation_key="Wind Speed", + translation_key="wind_speed", icon="mdi:weather-windy", device_class=SensorDeviceClass.WIND_SPEED, state_class="measurement", @@ -259,7 +260,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindSpeed10Min", - translation_key="Wind Speed (Average)", + translation_key="wind_speed_average", icon="mdi:weather-windy", device_class=SensorDeviceClass.WIND_SPEED, state_class="measurement", @@ -268,7 +269,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindGust", - translation_key="Wind Gust", + translation_key="wind_gust", icon="mdi:windsock", device_class=SensorDeviceClass.WIND_SPEED, state_class="measurement", @@ -277,7 +278,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindGustDay", - translation_key="Wind Gust (Day)", + translation_key="wind_gust_day", icon="mdi:windsock", device_class=SensorDeviceClass.WIND_SPEED, state_class="measurement", @@ -286,12 +287,12 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindGustTime", - translation_key="Wind Gust Time", + translation_key="wind_gust_time", icon="mdi:clock-in" ), SensorEntityDescription( key="WindDir", - translation_key="Wind Direction", + translation_key="wind_direction", icon="mdi:compass-outline", state_class="measurement", native_unit_of_measurement=DEGREE, @@ -299,7 +300,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindDirRose", - translation_key="Wind Direction Rose", + translation_key="wind_direction_rose", device_class=SensorDeviceClass.ENUM, options=[ "n", @@ -314,14 +315,14 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="WindSpeedBft", - translation_key="Wind Speed (Bft)", + translation_key="wind_speed_bft", icon="mdi:weather-windy", state_class="measurement", entity_registry_enabled_default=False ), SensorEntityDescription( key="RainDay", - translation_key="Rain (Day)", + translation_key="rain_day", icon="mdi:water-outline", device_class=SensorDeviceClass.PRECIPITATION, state_class="measurement", @@ -330,7 +331,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="RainMonth", - translation_key="Rain (Month)", + translation_key="rain_month", icon="mdi:water-outline", state_class="measurement", device_class=SensorDeviceClass.PRECIPITATION, @@ -339,7 +340,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="RainYear", - translation_key="Rain (Year)", + translation_key="rain_year", icon="mdi:water-outline", state_class="measurement", device_class=SensorDeviceClass.PRECIPITATION, @@ -348,7 +349,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="RainRate", - translation_key="Rain Rate", + translation_key="rain_rate", icon="mdi:water-outline", device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, state_class="measurement", @@ -357,7 +358,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="RainRateDay", - translation_key="Rain Rate (Day)", + translation_key="rain_rate_day", icon="mdi:water-outline", device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, state_class="measurement", @@ -366,32 +367,32 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="RainRateTime", - translation_key="Rain Rate Time", + translation_key="rain_rate_time", icon="mdi:clock-in" ), SensorEntityDescription( key="UV", - translation_key="UV Level", + translation_key="uv_level", icon="mdi:sun-wireless-outline", state_class="measurement", entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS ), SensorEntityDescription( key="UVDay", - translation_key="UV Level (Day)", + translation_key="uv_level_day", icon="mdi:sun-wireless-outline", state_class="measurement", entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS ), SensorEntityDescription( key="UVTime", - translation_key="UV Level Time", + translation_key="uv_level_time", icon="mdi:clock-in", entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS ), SensorEntityDescription( key="SolarRad", - translation_key="Solar Radiation", + translation_key="solar_radiation", icon="mdi:sun-wireless-outline", state_class="measurement", entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS, @@ -399,7 +400,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="SolarRadDay", - translation_key="Solar Radiation (Day)", + translation_key="solar_radiation_day", icon="mdi:sun-wireless-outline", state_class="measurement", entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS, @@ -407,13 +408,13 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="SolarRadTime", - translation_key="Solar Radiation Time", + translation_key="solar_radiation_time", icon="mdi:clock-in", entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS ), SensorEntityDescription( key="BatteryVolts", - translation_key="Battery Voltage", + translation_key="battery_voltage", device_class=SensorDeviceClass.VOLTAGE, native_unit_of_measurement=UnitOfElectricPotential.VOLT, entity_category=EntityCategory.DIAGNOSTIC, @@ -422,17 +423,17 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="ForecastIcon", - translation_key="Forecast Icon", + translation_key="forecast_icon", entity_registry_enabled_default=False ), SensorEntityDescription( key="ForecastRuleNo", - translation_key="Forecast Rule", + translation_key="forecast_rule", icon="mdi:binoculars" ), SensorEntityDescription( key="RainCollector", - translation_key="Rain Collector", + translation_key="rain_collector", icon="mdi:bucket-outline", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, @@ -444,7 +445,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="RainStorm", - translation_key="Rain Storm", + translation_key="rain_storm", icon="mdi:water-outline", device_class=SensorDeviceClass.PRECIPITATION, state_class="measurement", @@ -453,13 +454,13 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="StormStartDate", - translation_key="Rain Storm Start Date", + translation_key="rain_storm_start_date", icon="mdi:calendar-outline", device_class=SensorDeviceClass.DATE ), SensorEntityDescription( key="ExtraTemps01", - translation_key="Extra Temperature 1", + translation_key="extra_temperature_1", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -468,7 +469,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="ExtraTemps02", - translation_key="Extra Temperature 2", + translation_key="extra_temperature_2", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -477,7 +478,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="ExtraTemps03", - translation_key="Extra Temperature 3", + translation_key="extra_temperature_3", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -486,7 +487,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="ExtraTemps04", - translation_key="Extra Temperature 4", + translation_key="extra_temperature_4", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -495,7 +496,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="ExtraTemps05", - translation_key="Extra Temperature 5", + translation_key="extra_temperature_5", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -504,7 +505,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="ExtraTemps06", - translation_key="Extra Temperature 6", + translation_key="extra_temperature_6", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -513,7 +514,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="ExtraTemps07", - translation_key="Extra Temperature 7", + translation_key="extra_temperature_7", native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, device_class=SensorDeviceClass.TEMPERATURE, state_class="measurement", @@ -522,7 +523,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumExtra01", - translation_key="Extra Humidity 1", + translation_key="extra_humidity_1", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -530,7 +531,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumExtra02", - translation_key="Extra Humidity 2", + translation_key="extra_humidity_2", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -538,7 +539,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumExtra03", - translation_key="Extra Humidity 3", + translation_key="extra_humidity_3", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -546,7 +547,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumExtra04", - translation_key="Extra Humidity 4", + translation_key="extra_humidity_4", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -554,7 +555,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumExtra05", - translation_key="Extra Humidity 5", + translation_key="extra_humidity_5", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -562,7 +563,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumExtra06", - translation_key="Extra Humidity 6", + translation_key="extra_humidity_6", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -570,7 +571,7 @@ def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: ), SensorEntityDescription( key="HumExtra07", - translation_key="Extra Humidity 7", + translation_key="extra_humidity_7", device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, suggested_display_precision=0, @@ -616,8 +617,8 @@ def __init__( """Initialize Davis Vantage sensor.""" super().__init__(coordinator=coordinator) self.entity_description = description - self.entity_id = f"{SENSOR_DOMAIN}.{DEFAULT_NAME} {description.translation_key}".lower() - self._attr_unique_id = f"{entry_id}-{DEFAULT_NAME} {description.translation_key}" + self.entity_id = f"{SENSOR_DOMAIN}.{DEFAULT_NAME} {KEY_TO_NAME[description.key]}".lower() + self._attr_unique_id = f"{entry_id}-{DEFAULT_NAME} {KEY_TO_NAME[description.key]}" self._attr_device_info = coordinator.device_info @property diff --git a/custom_components/davis_vantage/translations/en.json b/custom_components/davis_vantage/translations/en.json index 50cc7b8..7c84123 100755 --- a/custom_components/davis_vantage/translations/en.json +++ b/custom_components/davis_vantage/translations/en.json @@ -35,79 +35,79 @@ }, "entity": { "sensor": { - "Last Fetch Time": { + "last_fetch_time": { "name": "Last Fetch Time" }, - "Last Success Time": { + "last_success_time": { "name": "Last Success Time" }, - "Last Error Time": { + "last_error_time": { "name": "Last Error Time" }, - "Last Error Message": { + "last_error_message": { "name": "Last Error Message" }, - "Archive Internal": { + "archive_internal": { "name": "Archive Interval" }, - "Temperature": { + "temperature": { "name": "Temperature" }, - "Temperature High (Day)": { + "temperature_high_day": { "name": "Temperature High (Day)" }, - "Temperature High Time": { + "temperature_high_time": { "name": "Temperature High Time" }, - "Temperature Low (Day)": { + "temperature_low_day": { "name": "Temperature Low (Day)" }, - "Temperature Low Time": { + "temperature_low_time": { "name": "Temperature Low Time" }, - "Temperature (Inside)": { + "temperature_inside": { "name": "Temperatuur (Inside)" }, "heat_index": { "name": "Heat Index" }, - "Wind Chill": { + "wind_chill": { "name": "Wind Chill" }, - "Feels Like": { + "feels_like": { "name": "Feels Like" }, - "Dew Point": { + "dew_point": { "name": "Dew Point" }, - "Dew Point High (Day)": { + "dew_point_high_day": { "name": "Dew Point High (Day)" }, - "Dew Point High Time": { + "dew_point_high_time": { "name": "Dew Point High Time" }, - "Dew Point Low (Day)": { + "dew_point_low_day": { "name": "Dew Point Low (Day)" }, - "Dew Point Low Time": { + "dew_point_low_time": { "name": "Dew Point Low Time" }, - "Barometric Pressure": { + "barometric_pressure": { "name": "Barometric Pressure" }, - "Barometric Pressure High (Day)": { + "barometric_pressure_high_day": { "name": "Barometric Pressure High (Day)" }, - "Barometric Pressure High Time": { + "barometric_pressure_high_time": { "name": "Barometric Pressure High Time" }, - "Barometric Pressure Low (Day)": { + "barometric_pressure_low_day": { "name": "Barometric Pressure Low (Day)" }, - "Barometric Pressure Low Time": { + "barometric_pressure_low_time": { "name": "Barometric Pressure Low Time" }, - "Barometric Trend": { + "barometric_trend": { "name": "Barometric Trend", "state": { "falling_rapidly": "Falling Rapidly", @@ -117,31 +117,31 @@ "rising_rapidly": "Rising Rapidly" } }, - "Humidity (Inside)": { + "humidity_inside": { "name": "Humidity (Inside)" }, - "Humidity": { + "humidity": { "name": "Humidity" }, - "Wind Speed": { + "wind_speed": { "name": "Wind Speed" }, - "Wind Speed (Average)": { + "wind_speed_average": { "name": "Wind Speed (Average)" }, - "Wind Gust": { + "wind_gust": { "name": "Wind Gust" }, - "Wind Gust (Day)": { + "wind_gust_day": { "name": "Wind Gust (Day)" }, - "Wind Gust Time": { + "wind_gust_time": { "name": "Wind Gust Time" }, - "Wind Direction": { + "wind_direction": { "name": "Wind Direction" }, - "Wind Direction Rose": { + "wind_direction_rose": { "name": "Wind Direction (Rose)", "state": { "n": "N", @@ -154,108 +154,108 @@ "nw": "NW" } }, - "Wind Speed (Bft)": { + "wind_speed_bft": { "name": "Wind Speed (Bft)" }, - "Rain (Day)": { + "rain_day": { "name": "Rain (Day)" }, - "Rain (Month)": { + "rain_month": { "name": "Rain (Month)" }, - "Rain (Year)": { + "rain_year": { "name": "Rain (Year)" }, - "Rain Rate": { + "rain_rate": { "name": "Rain Rate" }, - "Rain Rate (Day)": { + "rain_rate_day": { "name": "Rain Rate (Day)" }, - "Rain Rate Time": { + "rain_date_time": { "name": "Rain Rate Time" }, - "UV Level": { + "uv_level": { "name": "UV Level" }, - "UV Level (Day)": { + "uv_level_day": { "name": "UV Level (Day)" }, - "UV Level Time": { + "uv_level_time": { "name": "UV Level Time" }, - "Solar Radiation": { + "solar_radiation": { "name": "Solar Radiation" }, - "Solar Radiation (Day)": { + "solar_radiation_day": { "name": "Solar Radiation (Day)" }, - "Solar Radiation Time": { + "solar_radiation_time": { "name": "Solar Radiation Time" }, - "Battery Voltage": { + "battery_voltage": { "name": "Battery Voltage" }, - "Forecast Icon": { + "forecast_icon": { "name": "Forecast Icon" }, - "Forecast Rule": { + "forecast_rule": { "name": "Forecast Rule" }, - "Rain Collector": { + "rain_collector": { "name": "Rain Collector" }, - "Rain Storm": { + "rain_storm": { "name": "Rain Storm" }, - "Rain Storm Start Date": { + "rain_storm_start_date": { "name": "Rain Storm Start Date" }, - "Extra Temperature 1": { + "extra_temperature_1": { "name": "Extra Temperature 1" }, - "Extra Temperature 2": { + "extra_temperature_2": { "name": "Extra Temperature 2" }, - "Extra Temperature 3": { + "extra_temperature_3": { "name": "Extra Temperature 3" }, - "Extra Temperature 4": { + "extra_temperature_4": { "name": "Extra Temperature 4" }, - "Extra Temperature 5": { + "extra_temperature_5": { "name": "Extra Temperature 5" }, - "Extra Temperature 6": { + "extra_temperature_6": { "name": "Extra Temperature 6" }, - "Extra Temperature 7": { + "extra_temperature_7": { "name": "Extra Temperature 7" }, - "Extra Humidity 1": { + "extra_humidity_1": { "name": "Extra Humidity 1" }, - "Extra Humidity 2": { + "extra_humidity_2": { "name": "Extra Humidity 2" }, - "Extra Humidity 3": { + "extra_humidity_3": { "name": "Extra Humidity 3" }, - "Extra Humidity 4": { + "extra_humidity_4": { "name": "Extra Humidity 4" }, - "Extra Humidity 5": { + "extra_humidity_5": { "name": "Extra Humidity 5" }, - "Extra Humidity 6": { + "extra_humidity_6": { "name": "Extra Humidity 6" }, - "Extra Humidity 7": { + "extra_humidity_7": { "name": "Extra Humidity 7" } }, "binary_sensor": { - "Is Raining": { + "is_raining": { "name": "Is Raining" } } diff --git a/custom_components/davis_vantage/translations/nl.json b/custom_components/davis_vantage/translations/nl.json index 40d9dcc..bb4340d 100755 --- a/custom_components/davis_vantage/translations/nl.json +++ b/custom_components/davis_vantage/translations/nl.json @@ -35,79 +35,79 @@ }, "entity": { "sensor": { - "Last Fetch Time": { + "last_fetch_time": { "name": "Laatst opgehaald" }, - "Last Success Time": { + "last_success_time": { "name": "Laatst geslaagd" }, - "Last Error Time": { + "last_error_time": { "name": "Laatste fout om" }, - "Last Error Message": { + "last_error_message": { "name": "Laatste foutmelding" }, - "Archive Interval": { + "archive_interval": { "name": "Archief interval" }, - "Temperature": { + "temperature": { "name": "Temperatuur" }, - "Temperature High (Day)": { + "temperature_high_day": { "name": "Max. temperatuur" }, - "Temperature High Time": { + "temperature_high_time": { "name": "Max. temperatuur om" }, - "Temperature Low (Day)": { + "temperature_low_day": { "name": "Min. temperatuur" }, - "Temperature Low Time": { + "temperature_low_time": { "name": "Min. temperatuur om" }, - "Temperature (Inside)": { + "temperature_inside": { "name": "Temperatuur (binnen)" }, - "Heat Index": { + "heat_index": { "name": "Hitte index" }, - "Wind Chill": { + "wind_chill": { "name": "Gevoelstemperatuur" }, - "Feels Like": { + "feels_like": { "name": "Voelt als" }, - "Dew Point": { + "dew_point": { "name": "Dauwpunt" }, - "Dew Point High (Day)": { + "dew_point_high_day": { "name": "Max. dauwpunt" }, - "Dew Point High Time": { + "dew_point_high_time": { "name": "Max. dauwpunt om" }, - "Dew Point Low (Day)": { + "dew_point_low_day": { "name": "Min. dauwpunt" }, - "Dew Point Low Time": { + "dew_point_low_time": { "name": "Min. dauwpunt om" }, - "Barometric Pressure": { + "barometric_pressure": { "name": "Luchtdruk" }, - "Barometric Pressure High (Day)": { + "barometric_pressure_high_day": { "name": "Max. luchtdruk" }, - "Barometric Pressure High Time": { + "barometric_pressure_high_time": { "name": "Max. luchtdruk om" }, - "Barometric Pressure Low (Day)": { + "barometric_pressure_low_day": { "name": "Min. luchtdruk" }, - "Barometric Pressure Low Time": { + "barometric_pressure_low_time": { "name": "Min. luchtdruk om" }, - "Barometric Trend": { + "barometric_trend": { "name": "Luchtdruk trend", "state": { "falling_rapidly": "Snel dalend", @@ -117,31 +117,31 @@ "rising_rapidly": "Snel stijgend" } }, - "Humidity (Inside)": { + "humidity_inside": { "name": "Luchtvochtigheid (binnen)" }, - "Humidity": { + "humidity": { "name": "Luchtvochtigheid" }, - "Wind Speed": { + "wind_speed": { "name": "Windsnelheid" }, - "Wind Speed (Average)": { + "wind_speed_average": { "name": "Gem. windsnelheid" }, - "Wind Gust": { + "wind_gust": { "name": "Windstoot" }, - "Wind Gust (Day)": { + "wind_gust_day": { "name": "Max. windstoot" }, - "Wind Gust Time": { + "wind_gust_time": { "name": "Max. windstoot om" }, - "Wind Direction": { + "wind_direction": { "name": "Windrichting" }, - "Wind Direction Rose": { + "wind_direction_rose": { "name": "Windrichting (roos)", "state": { "n": "N", @@ -154,108 +154,108 @@ "nw": "NW" } }, - "Wind Speed (Bft)": { + "wind_speed_bft": { "name": "Windsnelheid (Bft)" }, - "Rain (Day)": { + "rain_day": { "name": "Regen (dag)" }, - "Rain (Month)": { + "rain_month": { "name": "Regen (maand)" }, - "Rain (Year)": { + "rain_year": { "name": "Regen (jaar)" }, - "Rain Rate": { + "rain_rate": { "name": "Regenintensiteit" }, - "Rain Rate (Day)": { + "rain_rate_day": { "name": "Max. regenintensiteit" }, - "Rain Rate Time": { + "rain_rate_time": { "name": "Max. regenintensiteit om" }, - "UV Level": { + "uv_level": { "name": "UV index" }, - "UV Level (Day)": { + "uv_level_day": { "name": "Max. UV index" }, - "UV Level Time": { + "uv_level_time": { "name": "Max. UV index om" }, - "Solar Radiation": { + "solar_radiation": { "name": "Zonnestraling" }, - "Solar Radiation (Day)": { + "solar_radiation_day": { "name": "Max. zonnestraling" }, - "Solar Radiation Time": { + "solar_radiation_time": { "name": "Max. zonnestraling om" }, - "Battery Voltage": { + "battery_voltage": { "name": "Batterij voltage" }, - "Forecast Icon": { + "forecast_icon": { "name": "Verwachtingsicoon" }, - "Forecast Rule": { + "forecast_rule": { "name": "Verwachting" }, - "Rain Collector": { + "rain_collector": { "name": "Regenvanger" }, - "Rain Storm": { + "rain_storm": { "name": "Regenstorm" }, - "Rain Storm Start Date": { + "rain_storm_start_date": { "name": "Regenstorm startdatum" }, - "Extra Temperature 1": { + "extra_temperature_1": { "name": "Extra temperatuur 1" }, - "Extra Temperature 2": { + "extra_temperature_2": { "name": "Extra temperatuur 2" }, - "Extra Temperature 3": { + "extra_temperature_3": { "name": "Extra temperatuur 3" }, - "Extra Temperature 4": { + "extra_temperature_4": { "name": "Extra temperatuur 4" }, - "Extra Temperature 5": { + "extra_temperature_5": { "name": "Extra temperatuur 5" }, - "Extra Temperature 6": { + "extra_temperature_6": { "name": "Extra temperatuur 6" }, - "Extra Temperature 7": { + "extra_temperature_7": { "name": "Extra temperatuur 7" }, - "Extra Humidity 1": { + "extra_humidity_1": { "name": "Extra luchtvochtigheid 1" }, - "Extra Humidity 2": { + "extra_humidity_2": { "name": "Extra luchtvochtigheid 2" }, - "Extra Humidity 3": { + "extra_humidity_3": { "name": "Extra luchtvochtigheid 3" }, - "Extra Humidity 4": { + "extra_humidity_4": { "name": "Extra luchtvochtigheid 4" }, - "Extra Humidity 5": { + "extra_humidity_5": { "name": "Extra luchtvochtigheid 5" }, - "Extra Humidity 6": { + "extra_humidity_6": { "name": "Extra luchtvochtigheid 6" }, - "Extra Humidity 7": { + "extra_humidity_7": { "name": "Extra luchtvochtigheid 7" } }, "binary_sensor": { - "Is Raining": { + "is_raining": { "name": "Het regent" } }