Skip to content

Commit

Permalink
Add QFF pressure, QNH pressure and wind gusts as sensor (Fixes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
izacus committed Jul 9, 2024
1 parent 959028f commit 3c0e744
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions meteo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 3c0e744

Please sign in to comment.