diff --git a/README.md b/README.md index b033c6a..444c4c7 100755 --- a/README.md +++ b/README.md @@ -141,8 +141,6 @@ Diagnostic entities: - Last fetch time - Battery Voltage: - Current battery voltage -- Cardinal Directions: - - Number of cardinal direction 8 or 16 (set during setup) - Last Error Time: - Last error time - Last Success Time: diff --git a/custom_components/davis_vantage/__init__.py b/custom_components/davis_vantage/__init__.py index 7b0e8b5..d812322 100755 --- a/custom_components/davis_vantage/__init__.py +++ b/custom_components/davis_vantage/__init__.py @@ -22,7 +22,6 @@ CONFIG_RAIN_COLLECTOR, CONFIG_STATION_MODEL, CONFIG_INTERVAL, - CONFIG_WINDROSE8, CONFIG_PROTOCOL, CONFIG_LINK ) @@ -49,11 +48,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: protocol = entry.data.get(CONFIG_PROTOCOL, "") link = entry.data.get(CONFIG_LINK, "") rain_collector = entry.data.get(CONFIG_RAIN_COLLECTOR, RAIN_COLLECTOR_IMPERIAL) - windrose8 = entry.data.get(CONFIG_WINDROSE8, False) hass.data[DOMAIN]['interval'] = entry.data.get(CONFIG_INTERVAL, 30) - client = DavisVantageClient(hass, protocol, link, rain_collector, windrose8) + client = DavisVantageClient(hass, protocol, link, rain_collector) await client.connect_to_station() info = await client.async_get_info() firmware_version = info.get('version', None) if info is not None else None diff --git a/custom_components/davis_vantage/client.py b/custom_components/davis_vantage/client.py index b9a0531..6d3f883 100755 --- a/custom_components/davis_vantage/client.py +++ b/custom_components/davis_vantage/client.py @@ -41,13 +41,11 @@ def __init__( hass: HomeAssistant, protocol: str, link: str, - rain_collector: str, - windrose8: bool, + rain_collector: str ) -> None: self._hass = hass self._protocol = protocol self._link = link - self._windrose8 = windrose8 self._rain_collector = rain_collector self._last_data: LoopDataParserRevB = {} # type: ignore self._last_raw_data: DataParser = {} # type: ignore @@ -244,7 +242,7 @@ def add_additional_info(self, data: dict[str, Any]) -> None: data["TempOut"], data["HumOut"], data["WindSpeed"] ) if data["WindDir"] is not None: - data["WindDirRose"] = get_wind_rose(data["WindDir"], self._windrose8) + data["WindDirRose"] = get_wind_rose(data["WindDir"]) if data["WindSpeed10Min"] is not None: data["WindSpeedBft"] = convert_kmh_to_bft( convert_to_kmh(data["WindSpeed10Min"]) @@ -264,7 +262,6 @@ def convert_values(self, data: dict[str, Any]) -> None: if data["ForecastRuleNo"] is not None: data["ForecastRuleNo"] = get_forecast_string(data["ForecastRuleNo"]) data["RainCollector"] = self._rain_collector - data["WindRoseSetup"] = 8 if self._windrose8 else 16 if data["RainCollector"] != RAIN_COLLECTOR_IMPERIAL: self.correct_rain_values(data) data['StormStartDate'] = self.strtodate(data['StormStartDate']) diff --git a/custom_components/davis_vantage/config_flow.py b/custom_components/davis_vantage/config_flow.py index 8fe9bd5..f3d86c5 100755 --- a/custom_components/davis_vantage/config_flow.py +++ b/custom_components/davis_vantage/config_flow.py @@ -26,7 +26,6 @@ CONFIG_RAIN_COLLECTOR, CONFIG_STATION_MODEL, CONFIG_INTERVAL, - CONFIG_WINDROSE8, CONFIG_PROTOCOL, CONFIG_LINK ) @@ -45,7 +44,7 @@ def __init__(self, hass: HomeAssistant) -> None: async def authenticate(self, protocol: str, link: str) -> bool: """Test if we can find data for the given link.""" _LOGGER.info(f"authenticate called") - client = DavisVantageClient(self._hass, protocol, link, "", False) + client = DavisVantageClient(self._hass, protocol, link, "") await client.connect_to_station() return await client.async_get_davis_time() != None @@ -160,8 +159,7 @@ async def async_step_setup_other_info( CONFIG_INTERVAL, default=DEFAULT_SYNC_INTERVAL): vol.All(int, vol.Range(min=30) # type: ignore ), - vol.Required(CONFIG_RAIN_COLLECTOR): vol.In(list_of_rain_collector), - vol.Required(CONFIG_WINDROSE8): bool, + vol.Required(CONFIG_RAIN_COLLECTOR): vol.In(list_of_rain_collector) } ) diff --git a/custom_components/davis_vantage/const.py b/custom_components/davis_vantage/const.py index 9de765c..43bada4 100755 --- a/custom_components/davis_vantage/const.py +++ b/custom_components/davis_vantage/const.py @@ -4,7 +4,7 @@ DOMAIN = "davis_vantage" MANUFACTURER = "Davis" MODEL = "Vantage Pro2/Vue" -VERSION = "1.1.8" +VERSION = "1.1.9" DEFAULT_SYNC_INTERVAL = 30 # seconds DEFAULT_NAME = NAME @@ -27,6 +27,5 @@ CONFIG_RAIN_COLLECTOR = "rain_collector" CONFIG_STATION_MODEL = "station_model" CONFIG_INTERVAL = "interval" -CONFIG_WINDROSE8 = "windrose8" CONFIG_PROTOCOL = "protocol" CONFIG_LINK = "link" diff --git a/custom_components/davis_vantage/icons.json b/custom_components/davis_vantage/icons.json index 1ff74f2..ca57b2d 100644 --- a/custom_components/davis_vantage/icons.json +++ b/custom_components/davis_vantage/icons.json @@ -1,8 +1,35 @@ { - "services": { - "set_davis_time": "mdi:clock-edit-outline", - "get_davis_time": "mdi:clock-outline", - "get_raw_data": "mdi:export", - "get_info": "mdi:information-box-outline" + "services": { + "set_davis_time": "mdi:clock-edit-outline", + "get_davis_time": "mdi:clock-outline", + "get_raw_data": "mdi:export", + "get_info": "mdi:information-box-outline" + }, + "entity": { + "sensor": { + "davis_vantage_barometric_trend": { + "default": "mdi:trending-neutral", + "state": { + "falling_rapidly": "mdi:trending-down", + "falling_slowly": "mdi:trending-down", + "steady": "mdi:trending-neutral", + "rising_slowly": "mdi:trending-up", + "rising_rapidly": "mdi:trending-up" + } + }, + "wind_direction_rose": { + "default": "mdi:compass-outline", + "state": { + "N": "mdi:arrow-down-bold-outline", + "NE": "mdi:arrow-bottom-left-bold-outline", + "E": "mdi:arrow-left-bold-outline", + "SE": "mdi:arrow-top-left-bold-outline", + "S": "mdi:arrow-up-bold-outline", + "SW": "mdi:arrow-top-right-bold-outline", + "W": "mdi:arrow-right-bold-outline", + "NW": "mdi:arrow-bottom-right-bold-outline" + } + } } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/custom_components/davis_vantage/sensor.py b/custom_components/davis_vantage/sensor.py index 35f1d12..dd2712e 100755 --- a/custom_components/davis_vantage/sensor.py +++ b/custom_components/davis_vantage/sensor.py @@ -26,540 +26,561 @@ from .const import ( DEFAULT_NAME, - DOMAIN + DOMAIN, + RAIN_COLLECTOR_IMPERIAL, + RAIN_COLLECTOR_METRIC, + CONFIG_STATION_MODEL, + MODEL_VANTAGE_PRO2PLUS ) from .coordinator import DavisVantageDataUpdateCoordinator -DESCRIPTIONS: list[SensorEntityDescription] = [ - SensorEntityDescription( - key="Datetime", - name="Last Fetch Time", - icon="mdi:clock-outline", - device_class=SensorDeviceClass.TIMESTAMP, - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="LastSuccessTime", - name="Last Success Time", - icon="mdi:clock-outline", - device_class=SensorDeviceClass.TIMESTAMP, - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="LastErrorTime", - name="Last Error Time", - icon="mdi:clock-outline", - device_class=SensorDeviceClass.TIMESTAMP, - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="LastError", - name="Last Error Message", - icon="mdi:message-alert-outline", - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="ArchiveInterval", - name="Archive Interval", - icon="mdi:archive-clock-outline", - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfTime.MINUTES - ), - SensorEntityDescription( - key="TempOut", - name="Temperature", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="TempOutHiDay", - name="Temperature High (Day)", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1, - icon="mdi:thermometer-chevron-up" - ), - SensorEntityDescription( - key="TempOutHiTime", - name="Temperature High Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="TempOutLowDay", - name="Temperature Low (Day)", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1, - icon="mdi:thermometer-chevron-down" - ), - SensorEntityDescription( - key="TempOutLowTime", - name="Temperature Low Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="TempIn", - name="Temperature (Inside)", - device_class=SensorDeviceClass.TEMPERATURE, - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HeatIndex", - name="Heat Index", - icon="mdi:sun-thermometer-outline", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="WindChill", - name="Wind Chill", - icon="mdi:snowflake-thermometer", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="FeelsLike", - name="Feels Like", - icon="mdi:download-circle-outline", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="DewPoint", - name="Dew Point", - icon="mdi:water-thermometer-outline", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="DewPointHiDay", - name="Dew Point High (Day)", - icon="mdi:water-thermometer-outline", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="DewPointHiTime", - name="Dew Point High Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="DewPointLowDay", - name="Dew Point Low (Day)", - icon="mdi:water-thermometer-outline", - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="DewPointLowTime", - name="Dew Point Low Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="Barometer", - name="Barometric Pressure", - device_class=SensorDeviceClass.PRESSURE, - state_class="measurement", - native_unit_of_measurement=UnitOfPressure.INHG, - suggested_display_precision=2 - ), - SensorEntityDescription( - key="BarometerHiDay", - name="Barometric Pressure High (Day)", - device_class=SensorDeviceClass.PRESSURE, - state_class="measurement", - native_unit_of_measurement=UnitOfPressure.INHG, - suggested_display_precision=2 - ), - SensorEntityDescription( - key="BarometerHiTime", - name="Barometric Pressure High Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="BarometerLowDay", - name="Barometric Pressure Low (Day)", - device_class=SensorDeviceClass.PRESSURE, - state_class="measurement", - native_unit_of_measurement=UnitOfPressure.INHG, - suggested_display_precision=2 - ), - SensorEntityDescription( - key="BarometerLoTime", - name="Barometric Pressure Low Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="BarTrend", - name="Barometric Trend", - icon="mdi:trending-up" - ), - SensorEntityDescription( - key="HumIn", - name="Humidity (Inside)", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HumOut", - name="Humidity", - device_class=SensorDeviceClass.HUMIDITY, - state_class="measurement", - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0 - ), - SensorEntityDescription( - key="WindSpeed", - name="Wind Speed", - icon="mdi:weather-windy", - device_class=SensorDeviceClass.WIND_SPEED, - state_class="measurement", - native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="WindSpeed10Min", - name="Wind Speed (Average)", - icon="mdi:weather-windy", - device_class=SensorDeviceClass.WIND_SPEED, - state_class="measurement", - native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="WindGust", - name="Wind Gust", - icon="mdi:windsock", - device_class=SensorDeviceClass.WIND_SPEED, - state_class="measurement", - native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="WindGustDay", - name="Wind Gust (Day)", - icon="mdi:windsock", - device_class=SensorDeviceClass.WIND_SPEED, - state_class="measurement", - native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="WindGustTime", - name="Wind Gust Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="WindDir", - name="Wind Direction", - icon="mdi:compass-outline", - state_class="measurement", - native_unit_of_measurement=DEGREE, - suggested_display_precision=0 - ), - SensorEntityDescription( - key="WindDirRose", - name="Wind Direction Rose", - icon="mdi:compass-outline" - ), - SensorEntityDescription( - key="WindSpeedBft", - name="Wind Speed (Bft)", - icon="mdi:weather-windy", - state_class="measurement", - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="RainDay", - name="Rain (Day)", - icon="mdi:water-outline", - device_class=SensorDeviceClass.PRECIPITATION, - state_class="measurement", - native_unit_of_measurement=UnitOfLength.INCHES, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="RainMonth", - name="Rain (Month)", - icon="mdi:water-outline", - state_class="measurement", - device_class=SensorDeviceClass.PRECIPITATION, - native_unit_of_measurement=UnitOfLength.INCHES, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="RainYear", - name="Rain (Year)", - icon="mdi:water-outline", - state_class="measurement", - device_class=SensorDeviceClass.PRECIPITATION, - native_unit_of_measurement=UnitOfLength.INCHES, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="RainRate", - name="Rain Rate", - icon="mdi:water-outline", - device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, - state_class="measurement", - native_unit_of_measurement=UnitOfVolumetricFlux.INCHES_PER_HOUR, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="RainRateDay", - name="Rain Rate (Day)", - icon="mdi:water-outline", - device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, - state_class="measurement", - native_unit_of_measurement=UnitOfVolumetricFlux.INCHES_PER_HOUR, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="RainRateTime", - name="Rain Rate Time", - icon="mdi:clock-in" - ), - SensorEntityDescription( - key="UV", - name="UV Level", - icon="mdi:sun-wireless-outline", - state_class="measurement", - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="UVDay", - name="UV Level (Day)", - icon="mdi:sun-wireless-outline", - state_class="measurement", - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="UVTime", - name="UV Level Time", - icon="mdi:clock-in", - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="SolarRad", - name="Solar Radiation", - icon="mdi:sun-wireless-outline", - state_class="measurement", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER - ), - SensorEntityDescription( - key="SolarRadDay", - name="Solar Radiation (Day)", - icon="mdi:sun-wireless-outline", - state_class="measurement", - entity_registry_enabled_default=False, - native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER - ), - SensorEntityDescription( - key="SolarRadTime", - name="Solar Radiation Time", - icon="mdi:clock-in", - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="BatteryVolts", - name="Battery Voltage", - device_class=SensorDeviceClass.VOLTAGE, - native_unit_of_measurement=UnitOfElectricPotential.VOLT, - entity_category=EntityCategory.DIAGNOSTIC, - suggested_display_precision=1, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="ForecastIcon", - name="Forecast Icon", - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="ForecastRuleNo", - name="Forecast Rule", - icon="mdi:binoculars" - ), - SensorEntityDescription( - key="RainCollector", - name="Rain Collector", - icon="mdi:bucket-outline", - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="WindRoseSetup", - name="Cardinal Directions", - icon="mdi:compass-rose", - entity_category=EntityCategory.DIAGNOSTIC, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="RainStorm", - name="Rain Storm", - icon="mdi:water-outline", - device_class=SensorDeviceClass.PRECIPITATION, - state_class="measurement", - native_unit_of_measurement=UnitOfLength.INCHES, - suggested_display_precision=1, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="StormStartDate", - name="Rain Storm Start Date", - icon="mdi:calendar-outline", - device_class=SensorDeviceClass.DATE, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="ExtraTemps01", - name="Extra Temperature 1", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - entity_registry_enabled_default=False, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="ExtraTemps02", - name="Extra Temperature 2", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - entity_registry_enabled_default=False, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="ExtraTemps03", - name="Extra Temperature 3", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - entity_registry_enabled_default=False, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="ExtraTemps04", - name="Extra Temperature 4", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - entity_registry_enabled_default=False, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="ExtraTemps05", - name="Extra Temperature 5", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - entity_registry_enabled_default=False, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="ExtraTemps06", - name="Extra Temperature 6", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - entity_registry_enabled_default=False, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="ExtraTemps07", - name="Extra Temperature 7", - native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, - device_class=SensorDeviceClass.TEMPERATURE, - state_class="measurement", - entity_registry_enabled_default=False, - suggested_display_precision=1 - ), - SensorEntityDescription( - key="HumExtra01", - name="Extra Humidity 1", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HumExtra02", - name="Extra Humidity 2", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HumExtra03", - name="Extra Humidity 3", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HumExtra04", - name="Extra Humidity 4", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HumExtra05", - name="Extra Humidity 5", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HumExtra06", - name="Extra Humidity 6", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ), - SensorEntityDescription( - key="HumExtra07", - name="Extra Humidity 7", - device_class=SensorDeviceClass.HUMIDITY, - native_unit_of_measurement=PERCENTAGE, - suggested_display_precision=0, - entity_registry_enabled_default=False - ) -] - _LOGGER: logging.Logger = logging.getLogger(__package__) +def get_sensor_descriptions(model: str) -> list[SensorEntityDescription]: + descriptions: list[SensorEntityDescription] = [ + SensorEntityDescription( + key="Datetime", + name="Last Fetch Time", + icon="mdi:clock-outline", + device_class=SensorDeviceClass.TIMESTAMP, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="LastSuccessTime", + name="Last Success Time", + icon="mdi:clock-outline", + device_class=SensorDeviceClass.TIMESTAMP, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="LastErrorTime", + name="Last Error Time", + icon="mdi:clock-outline", + device_class=SensorDeviceClass.TIMESTAMP, + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="LastError", + name="Last Error Message", + icon="mdi:message-alert-outline", + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="ArchiveInterval", + name="Archive Interval", + icon="mdi:archive-clock-outline", + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False, + native_unit_of_measurement=UnitOfTime.MINUTES + ), + SensorEntityDescription( + key="TempOut", + name="Temperature", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="TempOutHiDay", + name="Temperature High (Day)", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1, + icon="mdi:thermometer-chevron-up" + ), + SensorEntityDescription( + key="TempOutHiTime", + name="Temperature High Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="TempOutLowDay", + name="Temperature Low (Day)", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1, + icon="mdi:thermometer-chevron-down" + ), + SensorEntityDescription( + key="TempOutLowTime", + name="Temperature Low Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="TempIn", + name="Temperature (Inside)", + device_class=SensorDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HeatIndex", + name="Heat Index", + icon="mdi:sun-thermometer-outline", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="WindChill", + name="Wind Chill", + icon="mdi:snowflake-thermometer", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="FeelsLike", + name="Feels Like", + icon="mdi:download-circle-outline", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="DewPoint", + name="Dew Point", + icon="mdi:water-thermometer-outline", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="DewPointHiDay", + name="Dew Point High (Day)", + icon="mdi:water-thermometer-outline", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="DewPointHiTime", + name="Dew Point High Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="DewPointLowDay", + name="Dew Point Low (Day)", + icon="mdi:water-thermometer-outline", + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="DewPointLowTime", + name="Dew Point Low Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="Barometer", + name="Barometric Pressure", + device_class=SensorDeviceClass.PRESSURE, + state_class="measurement", + native_unit_of_measurement=UnitOfPressure.INHG, + suggested_display_precision=2 + ), + SensorEntityDescription( + key="BarometerHiDay", + name="Barometric Pressure High (Day)", + device_class=SensorDeviceClass.PRESSURE, + state_class="measurement", + native_unit_of_measurement=UnitOfPressure.INHG, + suggested_display_precision=2 + ), + SensorEntityDescription( + key="BarometerHiTime", + name="Barometric Pressure High Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="BarometerLowDay", + name="Barometric Pressure Low (Day)", + device_class=SensorDeviceClass.PRESSURE, + state_class="measurement", + native_unit_of_measurement=UnitOfPressure.INHG, + suggested_display_precision=2 + ), + SensorEntityDescription( + key="BarometerLoTime", + name="Barometric Pressure Low Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="BarTrend", + name="Barometric Trend", + device_class=SensorDeviceClass.ENUM, + translation_key="davis_vantage_barometric_trend", + options=[ + "falling_rapidly", + "falling_slowly", + "steady", + "rising_slowly", + "rising_rapidly" + ] + ), + SensorEntityDescription( + key="HumIn", + name="Humidity (Inside)", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HumOut", + name="Humidity", + device_class=SensorDeviceClass.HUMIDITY, + state_class="measurement", + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0 + ), + SensorEntityDescription( + key="WindSpeed", + name="Wind Speed", + icon="mdi:weather-windy", + device_class=SensorDeviceClass.WIND_SPEED, + state_class="measurement", + native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="WindSpeed10Min", + name="Wind Speed (Average)", + icon="mdi:weather-windy", + device_class=SensorDeviceClass.WIND_SPEED, + state_class="measurement", + native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="WindGust", + name="Wind Gust", + icon="mdi:windsock", + device_class=SensorDeviceClass.WIND_SPEED, + state_class="measurement", + native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="WindGustDay", + name="Wind Gust (Day)", + icon="mdi:windsock", + device_class=SensorDeviceClass.WIND_SPEED, + state_class="measurement", + native_unit_of_measurement=UnitOfSpeed.MILES_PER_HOUR, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="WindGustTime", + name="Wind Gust Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="WindDir", + name="Wind Direction", + icon="mdi:compass-outline", + state_class="measurement", + native_unit_of_measurement=DEGREE, + suggested_display_precision=0 + ), + SensorEntityDescription( + key="WindDirRose", + name="Wind Direction Rose", + device_class=SensorDeviceClass.ENUM, + translation_key="wind_direction_rose", + options=[ + "N", + "NE", + "E", + "SE", + "S", + "SW", + "W", + "NW" + ] + ), + SensorEntityDescription( + key="WindSpeedBft", + name="Wind Speed (Bft)", + icon="mdi:weather-windy", + state_class="measurement", + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="RainDay", + name="Rain (Day)", + icon="mdi:water-outline", + device_class=SensorDeviceClass.PRECIPITATION, + state_class="measurement", + native_unit_of_measurement=UnitOfLength.INCHES, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="RainMonth", + name="Rain (Month)", + icon="mdi:water-outline", + state_class="measurement", + device_class=SensorDeviceClass.PRECIPITATION, + native_unit_of_measurement=UnitOfLength.INCHES, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="RainYear", + name="Rain (Year)", + icon="mdi:water-outline", + state_class="measurement", + device_class=SensorDeviceClass.PRECIPITATION, + native_unit_of_measurement=UnitOfLength.INCHES, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="RainRate", + name="Rain Rate", + icon="mdi:water-outline", + device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, + state_class="measurement", + native_unit_of_measurement=UnitOfVolumetricFlux.INCHES_PER_HOUR, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="RainRateDay", + name="Rain Rate (Day)", + icon="mdi:water-outline", + device_class=SensorDeviceClass.PRECIPITATION_INTENSITY, + state_class="measurement", + native_unit_of_measurement=UnitOfVolumetricFlux.INCHES_PER_HOUR, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="RainRateTime", + name="Rain Rate Time", + icon="mdi:clock-in" + ), + SensorEntityDescription( + key="UV", + name="UV Level", + icon="mdi:sun-wireless-outline", + state_class="measurement", + entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS + ), + SensorEntityDescription( + key="UVDay", + name="UV Level (Day)", + icon="mdi:sun-wireless-outline", + state_class="measurement", + entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS + ), + SensorEntityDescription( + key="UVTime", + name="UV Level Time", + icon="mdi:clock-in", + entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS + ), + SensorEntityDescription( + key="SolarRad", + name="Solar Radiation", + icon="mdi:sun-wireless-outline", + state_class="measurement", + entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS, + native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER + ), + SensorEntityDescription( + key="SolarRadDay", + name="Solar Radiation (Day)", + icon="mdi:sun-wireless-outline", + state_class="measurement", + entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS, + native_unit_of_measurement=UnitOfIrradiance.WATTS_PER_SQUARE_METER + ), + SensorEntityDescription( + key="SolarRadTime", + name="Solar Radiation Time", + icon="mdi:clock-in", + entity_registry_enabled_default=model==MODEL_VANTAGE_PRO2PLUS + ), + SensorEntityDescription( + key="BatteryVolts", + name="Battery Voltage", + device_class=SensorDeviceClass.VOLTAGE, + native_unit_of_measurement=UnitOfElectricPotential.VOLT, + entity_category=EntityCategory.DIAGNOSTIC, + suggested_display_precision=1, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="ForecastIcon", + name="Forecast Icon", + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="ForecastRuleNo", + name="Forecast Rule", + icon="mdi:binoculars" + ), + SensorEntityDescription( + key="RainCollector", + name="Rain Collector", + icon="mdi:bucket-outline", + entity_category=EntityCategory.DIAGNOSTIC, + entity_registry_enabled_default=False, + device_class=SensorDeviceClass.ENUM, + options=[ + RAIN_COLLECTOR_IMPERIAL, + RAIN_COLLECTOR_METRIC + ] + ), + SensorEntityDescription( + key="RainStorm", + name="Rain Storm", + icon="mdi:water-outline", + device_class=SensorDeviceClass.PRECIPITATION, + state_class="measurement", + native_unit_of_measurement=UnitOfLength.INCHES, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="StormStartDate", + name="Rain Storm Start Date", + icon="mdi:calendar-outline", + device_class=SensorDeviceClass.DATE + ), + SensorEntityDescription( + key="ExtraTemps01", + name="Extra Temperature 1", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + entity_registry_enabled_default=False, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="ExtraTemps02", + name="Extra Temperature 2", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + entity_registry_enabled_default=False, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="ExtraTemps03", + name="Extra Temperature 3", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + entity_registry_enabled_default=False, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="ExtraTemps04", + name="Extra Temperature 4", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + entity_registry_enabled_default=False, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="ExtraTemps05", + name="Extra Temperature 5", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + entity_registry_enabled_default=False, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="ExtraTemps06", + name="Extra Temperature 6", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + entity_registry_enabled_default=False, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="ExtraTemps07", + name="Extra Temperature 7", + native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class="measurement", + entity_registry_enabled_default=False, + suggested_display_precision=1 + ), + SensorEntityDescription( + key="HumExtra01", + name="Extra Humidity 1", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HumExtra02", + name="Extra Humidity 2", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HumExtra03", + name="Extra Humidity 3", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HumExtra04", + name="Extra Humidity 4", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HumExtra05", + name="Extra Humidity 5", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HumExtra06", + name="Extra Humidity 6", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ), + SensorEntityDescription( + key="HumExtra07", + name="Extra Humidity 7", + device_class=SensorDeviceClass.HUMIDITY, + native_unit_of_measurement=PERCENTAGE, + suggested_display_precision=0, + entity_registry_enabled_default=False + ) + ] + return descriptions + async def async_setup_entry( hass: HomeAssistant, entry: ConfigEntry, @@ -567,11 +588,11 @@ async def async_setup_entry( ) -> None: """Set up Davis Vantage sensors based on a config entry.""" coordinator = hass.data[DOMAIN][entry.entry_id] - entities: list[DavisVantageSensor] = [] + model = entry.data.get(CONFIG_STATION_MODEL, '') # Add all meter sensors described above. - for description in DESCRIPTIONS: + for description in get_sensor_descriptions(model): entities.append( DavisVantageSensor( coordinator=coordinator, diff --git a/custom_components/davis_vantage/strings.json b/custom_components/davis_vantage/strings.json deleted file mode 100755 index 45e36f6..0000000 --- a/custom_components/davis_vantage/strings.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "config": { - "step": { - "user": { - "data": { - "link": "[%key:common::config_flow::data::link%]" - } - }, - "setup_serial": { - "data": { - "link": "[%key:common::config_flow::data::link%]" - } - }, - "setup_network": { - "data": { - "link": "[%key:common::config_flow::data::link%]" - } - }, - "setup_other_info": { - "data": { - "station_model": "[%key:common::config_flow::data::station_model%]", - "interval": "[%key:common::config_flow::data::interval%]", - "rain_collector": "[%key:common::config_flow::data::rain_collector%]", - "windrose8": "[%key:common::config_flow::data::windrose8%]" - } - } - }, - "error": { - "cannot_connect": "[%key:common::config_flow::error::cannot_connect%]", - "invalid_auth": "[%key:common::config_flow::error::invalid_auth%]", - "unknown": "[%key:common::config_flow::error::unknown%]" - }, - "abort": { - "already_configured": "[%key:common::config_flow::abort::already_configured_device%]" - } - } -} diff --git a/custom_components/davis_vantage/translations/en.json b/custom_components/davis_vantage/translations/en.json index c84c267..7a112d0 100755 --- a/custom_components/davis_vantage/translations/en.json +++ b/custom_components/davis_vantage/translations/en.json @@ -28,8 +28,41 @@ "data": { "station_model": "Davis weather station model", "interval": "Interval", - "rain_collector": "Rain collector", - "windrose8": "Wind rose with 8 cardinal directions" + "rain_collector": "Rain collector" + } + } + } + }, + "entity": { + "sensor": { + "davis_vantage_barometric_trend": { + "state": { + "falling_rapidly": "Falling Rapidly", + "falling_slowly": "Falling Slowly", + "steady": "Steady", + "rising_slowly": "Rising Slowly", + "rising_rapidly": "Rising Rapidly", + "not_available": "Not Available" + } + }, + "wind_direction_rose": { + "state": { + "N": "N", + "NNE": "NNE", + "NE": "NE", + "ENE": "ENE", + "E": "E", + "ESE": "ESE", + "SE": "SE", + "SSE": "SSE", + "S": "S", + "SSW": "SSW", + "SW": "SW", + "WSW": "WSW", + "W": "W", + "WNW": "WNW", + "NW": "NW", + "NNW": "NNW" } } } diff --git a/custom_components/davis_vantage/translations/nl.json b/custom_components/davis_vantage/translations/nl.json index 74091c7..1f47c9c 100755 --- a/custom_components/davis_vantage/translations/nl.json +++ b/custom_components/davis_vantage/translations/nl.json @@ -28,8 +28,41 @@ "data": { "station_model": "Davis weerstation model", "interval": "Interval", - "rain_collector": "Regenmeter", - "windrose8": "Windroos met 8 cardinale richtingen" + "rain_collector": "Regenmeter" + } + } + } + }, + "entity": { + "sensor": { + "davis_vantage_barometric_trend": { + "state": { + "falling_rapidly": "Snel dalend", + "falling_slowly": "Langzaam dalend", + "steady": "Stabiel", + "rising_slowly": "Langzaam stijgend", + "rising_rapidly": "Snel stijgend", + "not_available": "Niet beschikbaar" + } + }, + "wind_direction_rose": { + "state": { + "N": "N", + "NNE": "NNO", + "NE": "NO", + "ENE": "ONO", + "E": "O", + "ESE": "OZO", + "SE": "ZO", + "SSE": "ZZO", + "S": "Z", + "SSW": "ZZW", + "SW": "ZW", + "WSW": "WZW", + "W": "W", + "WNW": "WNW", + "NW": "NW", + "NNW": "NNW" } } } diff --git a/custom_components/davis_vantage/utils.py b/custom_components/davis_vantage/utils.py index 4258d11..65383d5 100755 --- a/custom_components/davis_vantage/utils.py +++ b/custom_components/davis_vantage/utils.py @@ -200,6 +200,163 @@ "FORECAST REQUIRES 3 HRS. OF RECENT DATA", "Mostly clear and cooler." ] +ForecastStringsNL = ["Meestal helder en koeler.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal helder gedurende 12 uur met weinig temperatuursverandering.", +"Meestal helder gedurende 12 tot 24 uur en koeler.", +"Meestal helder met weinig temperatuursverandering.", +"Gedeeltelijk bewolkt en koeler.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder en warmer.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 24 tot 48 uur.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk binnen 24 uur.", +"Meestal helder met weinig temperatuursverandering.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk binnen 12 uur.", +"Meestal helder met weinig temperatuursverandering.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 24 uur. Toenemende wind.", +"Meestal helder en warmer. Toenemende wind.", +"Toenemende bewolking en warmer.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 12 tot 24 uur. Toenemende wind.", +"Meestal helder en warmer. Toenemende wind.", +"Toenemende bewolking en warmer.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 12 tot 24 uur. Toenemende wind.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal helder en warmer. Neerslag mogelijk binnen 48 uur.", +"Meestal helder en warmer.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk binnen 24 tot 48 uur.", +"Toenemende bewolking met weinig temperatuursverandering.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 12 tot 24 uur.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 12 tot 24 uur. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 12 tot 24 uur. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 6 tot 12 uur.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 6 tot 12 uur. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 12 tot 24 uur. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag mogelijk binnen 12 uur.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en warmer. Neerslag waarschijnlijk.", +"opklarend en koeler. Neerslag eindigt binnen 6 uur.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"opklarend en koeler. Neerslag eindigt binnen 6 uur.", +"Meestal helder met weinig temperatuursverandering.", +"Opklarend en koeler. Neerslag eindigt binnen 6 uur.", +"Gedeeltelijk bewolkt en koeler.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder en koeler.", +"opklarend en koeler. Neerslag eindigt binnen 6 uur.", +"Meestal helder met weinig temperatuursverandering.", +"Opklarend en koeler. Neerslag eindigt binnen 6 uur.", +"Meestal helder en koeler.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk binnen 24 uur.", +"Meestal bewolkt en koeler. Neerslag aanhoudend.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt en koeler. Neerslag waarschijnlijk.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag aanhoudend.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag waarschijnlijk.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en koeler. Neerslag mogelijk en winderig binnen 6 uur.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk en winderig binnen 6 uur.", +"Meestal bewolkt en koeler. Neerslag aanhoudend. Toenemende wind.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt en koeler. Neerslag waarschijnlijk. Toenemende wind.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag aanhoudend. Toenemende wind.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag waarschijnlijk. Toenemende wind.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en koeler. Neerslag mogelijk binnen 12 tot 24 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk binnen 12 tot 24 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en koeler. Neerslag mogelijk binnen 6 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk binnen 6 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt en koeler. Neerslag eindigt binnen 12 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt en koeler. Mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag eindigt binnen 12 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt met weinig temperatuursverandering. Mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt en koeler. Neerslag eindigt binnen 12 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt en koeler. Neerslag mogelijk binnen 24 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag eindigt binnen 12 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag mogelijk binnen 24 uur. Mogelijke winddraaiing naar het W, NW, of N.", +"opklarend, koeler en winderig. Neerslag eindigt binnen 6 uur.", +"opklarend, koeler en winderig.", +"Meestal bewolkt en koeler. Neerslag eindigt binnen 6 uur. Winderig met mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt en koeler. Winderig met mogelijke winddraaiing naar het W, NW, of N.", +"Opklarend, koeler en winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag mogelijk binnen 12 uur. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking en koeler. Neerslag mogelijk binnen 12 uur, mogelijk zwaar. Winderig.", +"Meestal bewolkt en koeler. Neerslag eindigt binnen 6 uur. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt en koeler. Neerslag mogelijk binnen 12 uur. Winderig.", +"Meestal bewolkt en koeler. Neerslag eindigend in 12 tot 24 uur.", +"Meestal bewolkt en koeler.", +"Meestal bewolkt en koeler. Neerslag aanhoudend, mogelijk zwaar. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt en koeler. Neerslag mogelijk binnen 6 tot 12 uur. Winderig.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag aanhoudend, mogelijk zwaar. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag mogelijk binnen 6 tot 12 uur. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Toenemende bewolking met weinig temperatuursverandering. Neerslag mogelijk binnen 12 uur, mogelijk zwaar. Winderig.", +"Meestal bewolkt en koeler. Winderig.", +"Meestal bewolkt en koeler. Neerslag aanhoudend, mogelijk zwaar. Winderig.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt en koeler. Neerslag waarschijnlijk, winderig met mogelijke winddraaiing naar het W, NW, of N.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag aanhoudend.", +"Meestal bewolkt met weinig temperatuursverandering. Neerslag waarschijnlijk.", +"Gedeeltelijk bewolkt met weinig temperatuursverandering.", +"Meestal helder met weinig temperatuursverandering.", +"Meestal bewolkt en koeler. Neerslag mogelijk binnen 12 uur, mogelijk zwaar. Winderig.", +"VOORSPELLING VEREIST 3 UUR RECENTE GEGEVENS", +"Meestal helder en koeler."] + + def convert_to_celcius(value: float) -> float: return round((value - 32.0) * (5.0/9.0), 1) @@ -331,13 +488,9 @@ def calc_feels_like(temperature_f: float, humidity: float, windspeed_mph: float) def convert_to_iso_datetime(value: datetime, tzinfo: ZoneInfo) -> datetime: return value.replace(tzinfo=tzinfo) -def get_wind_rose(bearing: int, windrose8: bool) -> str: - directions = [ 'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', - 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW' ] - if windrose8: - index = (round(bearing / 45) % 8) * 2 - else: - index = round(bearing / 22.5) % 16 +def get_wind_rose(bearing: int) -> str: + directions = [ 'N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW' ] + index = round(bearing / 45) % 8 return directions[index] def has_correct_value(value: float) -> bool: @@ -346,19 +499,19 @@ def has_correct_value(value: float) -> bool: def round_to_one_decimal(value: float) -> float: return round(value, 1) -def get_baro_trend(trend: int) -> str: +def get_baro_trend(trend: int) -> str | None: if trend in [-60,196]: - return "Falling Rapidly" + return "falling_rapidly" elif trend in [-20,236]: - return "Falling Slowly" + return "falling_slowly" elif trend == 0: - return "Steady" + return "steady" elif trend == 20: - return "Rising Slowly" + return "rising_slowly" elif trend == 60: - return "Rising Rapidly" + return "rising_rapidly" else: - return f"n/a ({trend})" + return None def get_forecast_string(wrule: int) -> str: if wrule > 194: diff --git a/hacs.json b/hacs.json index 1bc81f0..b91d436 100755 --- a/hacs.json +++ b/hacs.json @@ -1,5 +1,5 @@ { "name": "Davis Vantage", - "homeassistant": "2022.12.0", + "homeassistant": "2024.2.0", "render_readme": true }