From 3c0e74466b65fa8e5f824999f52ba6b621499d33 Mon Sep 17 00:00:00 2001 From: Jernej Virag Date: Tue, 9 Jul 2024 19:27:25 +0200 Subject: [PATCH] Add QFF pressure, QNH pressure and wind gusts as sensor (Fixes #4) --- manifest.json | 2 +- meteo.py | 1 + sensor.py | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 167f13f..b42b5cd 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "domain": "swissweather", "name": "Swiss Weather", - "version": "1.0.4", + "version": "1.0.5", "config_flow": true, "documentation": "https://github.com/izacus/hass-swissweather", "issue_tracker": "https://github.com/izacus/hass-swissweather/issues", diff --git a/meteo.py b/meteo.py index 2e9c6d1..43f48f4 100644 --- a/meteo.py +++ b/meteo.py @@ -171,6 +171,7 @@ def _get_current_data_for_row(self, csv_row) -> CurrentWeather: ## Forecast def get_forecast(self, postCode) -> Optional[WeatherForecast]: forecastJson = self._get_forecast_json(postCode, self.language) + logger.debug("Forecast JSON: %s", forecastJson) if forecastJson is None: return None diff --git a/sensor.py b/sensor.py index c4b28db..e116787 100644 --- a/sensor.py +++ b/sensor.py @@ -58,7 +58,10 @@ def first_or_none(value): SwissWeatherSensorEntry("dew_point", "Dew Point", lambda weather: first_or_none(weather.dewPoint), UnitOfTemperature.CELSIUS, None, SensorStateClass.MEASUREMENT), SwissWeatherSensorEntry("wind_direction", "Wind Direction", lambda weather: first_or_none(weather.windDirection), DEGREE, None, SensorStateClass.MEASUREMENT), SwissWeatherSensorEntry("wind_speed", "Wind Speed", lambda weather: first_or_none(weather.windSpeed), UnitOfSpeed.KILOMETERS_PER_HOUR, SensorDeviceClass.SPEED, SensorStateClass.MEASUREMENT), + SwissWeatherSensorEntry("gust_peak1s", "Wind Gusts - Peak 1s", lambda weather: first_or_none(weather.gustPeak1s), UnitOfSpeed.KILOMETERS_PER_HOUR, SensorDeviceClass.SPEED, SensorStateClass.MEASUREMENT), SwissWeatherSensorEntry("pressure", "Air Pressure", lambda weather: first_or_none(weather.pressureStationLevel), UnitOfPressure.HPA, SensorDeviceClass.PRESSURE, SensorStateClass.MEASUREMENT), + SwissWeatherSensorEntry("pressure_qff", "Air Pressure - Sea Level (QFF)", lambda weather: first_or_none(weather.pressureSeaLevel), UnitOfPressure.HPA, SensorDeviceClass.PRESSURE, SensorStateClass.MEASUREMENT), + SwissWeatherSensorEntry("pressure_qnh", "Air Pressure - Sea Level (QNH)", lambda weather: first_or_none(weather.pressureSeaLevelAtStandardAtmosphere), UnitOfPressure.HPA, SensorDeviceClass.PRESSURE, SensorStateClass.MEASUREMENT) ] async def async_setup_entry(